For transition metal there is not a fixed pattern to find the valence electron. But the group number give us the range of valence electron.
Group 3: 3 valence electrons
Group 4: 2 to 4 valence electrons
Group 5: 2 to 5 valence electrons
Group 6: 2 to 6 valence electrons
Group 7: 2 to 7 valence electrons
Group 8: 2 or 3 valence electrons
Group 9: 2 or 3 valence electrons
Group 10: 2 or 3 valence electrons
Group 11: 1 or 2 valence electrons
Group 12: 2 valence electrons