What do you meant by "unlearn" ?
The unit does not learn the ability yet ?
For example, a unit can learn 3 abilities, Fire, Water, Thunder but that unit only leans Fire.
Then you want to remove Water and Thunder from the unit - therefore making that unit can't learn those 2 abilities ?
If this is what you mean, you can just Enable/Disable Ability for that Player
Here's a test map showing the process.
WARNING: If you do this method, you would disable those abilities for all Hero-type of that Player. This method is safe to use if you only have 1 Hero of that Unit-type per Player.