Samurai were a specific station in the caste system, they held a loyalty to a lord, but had their own lands, and were armor weilding soldiers who trained constantly. They held to specific principles and followed a Bushido code, which above all things dealt with death as an every day fact of life. , they learned archery, horsemanship, sword work, hand to hand, as well as balanced that with battlefield tactics, caligraphy, and other things that kept them focused and balanced.
Ninja: Basically ninja were spies. That didn't hold any sort of rank in a caste system and while they may be a associated to a certain shogun, lord, or clan.you see them in TV and movies doesn't exists, there are a few books that talked known as Ninjutsu