It's a massive load of combined issues. I grew up with a German shepherd who was fiercely protective over me. I was playing when a man approached me and she stood over me growling at him
Breeding - my grandad bred pit bulls and said breed shit, get shit. Don't breed from crap dogs!
Environment - how you bring them up and the training you do
Home - do they have somewhere to get away, are they being constantly pestered by a toddler, are they crate trained
Supervision
Exercise - so many over fed and under exercised dogs
You can minimise the risks a LOT. By watching all of the above and supervision. I honestly don't think the breed matters - I've been bitten by a collie. And incredibly frightened by an Akita, they're the only dogs I won't go near and I'm a huge dog lover
I find smaller yappy dogs more aggressive sometimes as people aren't as quick to train/discipline as "they're cute"