tensorflow / lattice

Lattice methods in TensorFlow
Apache License 2.0
518 stars 94 forks source link

more than two classes in CannedClassifier #69

Closed bjoernpiepenburg closed 3 years ago

bjoernpiepenburg commented 3 years ago

Hi I want to use a DLN to classify one label with 18 features. The label has more than two classes (something near to 30). If I set the n-classes parameter of the CannedClassifier-estimator to a number higher than 2 and start the training of the estimator I get the message "ValueError: Only 1-dimensional output is supported." (but I use just one label-column). If I reduce the number of classes in the data to two an set the n-classes parameter also to two, the training runs without any errors. Could the CannedClassifier-estimator just handle one label with two classes? Thanks for your help...

mmilanifard commented 3 years ago

Multi-class estimators typically have to have a separate logit output per class, and the predicted class is taken to be the highest value among them. We do not directly support multi-output models since the effect of monotonicity constraints are not well defined for such cases. You probably want the output for one class to be monotonically increasing in a feature while all other outputs should be decreasing in that feature.

A couple of things you can try: