Refactor Encoder with Generics

Generics added.  See what you think.  My comment in CategoryEncoder with the TODO hopefully is clear.  Also dropped the return value in favor of the output parameter.