It really depends upon the map type, my playing style for a particular game, and the era of the game.
Early on (The first half of the Ancient Era), I will often send out unescorted settlers, and only have warriors in my larger cities as MP.
Once the second half of the Ancient Era rolls around, I try and get at least one unit in every city, even if it's only a conscript warrior. Around this time is when the AI will start making demands, and I've had inummerable early wars where an AI decided they really liked the look of an unguarded town of mine.
In the Middle Ages, I try and start producing Spearmen/Pikemen to replace the Warriors on guard duty. By the time the Middle Ages are over, I have at least one Pikeman/Musketman in every city, with cannons and additional units in my border cities.
If I'm playing a Continents map, I'll try and finish consolidating my entire continent by this time. Once that happens, I keep two-three units in every coastal town, and a single unit in every other town. The extras I fortify in piles of each type, to use for invasions.
For a Pangea map, I still keep two-three in every coastal city, but also as many as 10-15 in border cities. I also establish a defensive barrier with fortresses, and fortify a defensive unit in every one. This locks my land off, so I don't need to worry about ROP abuse by the AI. I still keep at least one defensive unit in every town though.