Java, Weka: How to predict numeric attribute?

What you want to do is regression, not classification. The difference is exactly what you describe/want:

  • Classification has discrete classes/labels, any nominal attribute could be used as class here
  • Regression has continuous labels, classes would be a wrong term here.

Most regression based techniques can be transformed into a binary classification by defining a threshold and the class is determined by whether the predicted value is above or below this threshold.

I don't know all of WEKA's classifiers that offer regression, but you can start by looking at those two:

  • MultilayerPerceptron: Basically a neural network.
  • LinearRegression: As the name says, linear regression.

You might have to use the NominalToBinary filter to convert your nominal attributes to numerical (binary) ones.


you can find use regression in weka classifiers > functions > linear regression. here is an example of creating a regression model in weka https://developer.ibm.com/articles/os-weka1/


These days, I believe first introduced in Weka 3.7, RandomForest would work just as you want it. The features can be a mix of nominal and numeric and the prediction is allowed to be numeric as well.

The drawback (I would imagine in your case) is that it is not an Updateable class as NaiveBayesUpdateable works well with large amounts of data that may not fit in memory all at once.