I'd put the Doctor on the same level as Data after he got the mobile emitter. Apart from Data's physical advantages, they operate on the same level (well, Data is fully functional so he's got that going for him too).
I'd rank the Borg over both of them though. They're a hive mind with the combined knowledge of thousands (if not millions) of civilizations.
The borg however are not AI they are cyborgs a combination of organic and machine. They already had life before the borg they (for lack of better terminology) re-write the organic components to accept borg implants and data from the hive mind. They are not AI in any sense of the term as the hive mind is just one Queen controlling the information of trillions of minds directing the flow as required like an almighty ISP.