What makes you a target for piracy?
Amount of cargo
Value of cargo
Combat Rank
They all increases your possibilities to be a target for a pirate.
See it as a coefficient that increases every time that some requirement is met. Remeber that you can still be a target, even if you have no cargo and low combat rank.
Ship type means little (it's not rare to see an Eagle interdicting an Anaconda)