haifengl / smile

Statistical Machine Intelligence & Learning Engine
https://haifengl.github.io
Other
6.02k stars 1.13k forks source link

Exception in thread "main" java.lang.UnsupportedOperationException in RandomForest #652

Closed abubakr-awad closed 3 years ago

abubakr-awad commented 3 years ago

Hi, I am trying to run a simple classification using RandomForest where the class is numeric

import smile.classification
import smile.data.formula.Formula
import smile.io.Read

val df = Read.arff("./TEST.txt")
val formula = lhs("loan")
val rf = classification.randomForest(formula, df)

And the exception is as follows:

Exception in thread "main" java.lang.UnsupportedOperationException
    at smile.data.vector.BaseVector.toIntArray(BaseVector.java:90)
    at smile.data.vector.BaseVector.toIntArray(BaseVector.java:82)
    at smile.classification.ClassLabels.fit(ClassLabels.java:106)
    at smile.classification.RandomForest.fit(RandomForest.java:300)
    at smile.classification.package$.$anonfun$randomForest$1(package.scala:662)
    at smile.util.package$time$.apply(package.scala:57)
    at smile.classification.package$.randomForest(package.scala:662)

scalaVersion = "2.13.4" smileVersion = "com.github.haifengl" %% "smile-scala" % "2.6.0" sbtVersion = "1.4.4" javaVersion = "14_2020-03-17_Oracle Corporation"

TEST.txt

haifengl commented 3 years ago

Use smile.regression.RandomForest.