CategoricalComponent autodetection

Closes #329