How to check dataset if valid for some classify in WEKA api?
api, machine-learning, weka
Solution
Weka disables classifiers which can't handle your data. Classifiers are only enabled if the data matches the classifier's `capabilities` which you can view if you click on the classifier's name once you have selected it from the classifiers list. For example here are the capabilities of J48 (a decision tree):
- Class -- Binary class, Nominal class, Missing class values
- Attributes -- Nominal attributes, Numeric attributes, Date attributes, Unary attributes, Missing values, Binary attributes, Empty nominal attributes
- Additional -- min # of instances: 0
So the class data must either be Binary or Nominal and allows for Missing class values. Th attributes data can be Nominal, Numeric, Date, Unary, Binary and handle Missing values and Empty nominal values. A additional restriction states that at least 0 instance are needed (which is kind of silly, but other classifiers state more important additional requirements in this section).
You can alter your class and attributes using the `Preprocess` tab. For example, if a classifier only has the capability to work with Binary attributes then you can use the `NominalToBinary` filter to convert attributes from Nominal to Binary.
One more thing, make sure that Weka knows which data column it should use a class. By default it selects the last column as the class column. If you class is in another column then you have to change this manually using the drop-down menu in the `Classify` tab.
Problem
In Weka 3.6.5 I follow these steps: - I use Weka's Explorer and open a dataset file. - I change to the Classify panel and click the button "choose". Now you can see WEKA will block/grey out classifiers, because they can't handle the dataset, see the image. I would like to know what Weka API is used to determine whether this dataset can be used for some classifier or not. I had found it in the Weka API document but didn't get any useful info.