I usually change unit types according enemies. I usually ask for volunteers and get 5-10 nobles willing to change their unit types. Good to be in a realm with active and willing people
.
Having 2-300 cavalry units help a lot against infantry heavy armies.
Do not worry too much about cavalry charges. Just shove a lot of units in the same line to spread the damage across as many units as possible.
If you are defending the dig-in option+sentry helps a lot.