You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yanbo Liang (JIRA)" <ji...@apache.org> on 2016/11/14 04:27:58 UTC

[jira] [Resolved] (SPARK-18412) SparkR spark.randomForest classification throws exception when training on libsvm data

     [ https://issues.apache.org/jira/browse/SPARK-18412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yanbo Liang resolved SPARK-18412.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.1.0

> SparkR spark.randomForest classification throws exception when training on libsvm data
> --------------------------------------------------------------------------------------
>
>                 Key: SPARK-18412
>                 URL: https://issues.apache.org/jira/browse/SPARK-18412
>             Project: Spark
>          Issue Type: Bug
>          Components: ML, SparkR
>            Reporter: Yanbo Liang
>            Assignee: Yanbo Liang
>             Fix For: 2.1.0
>
>
> {{spark.randomForest}} classification throws exception when training on libsvm data. It can be reproduced as following:
> {code}
> df <- read.df("data/mllib/sample_multiclass_classification_data.txt", source = "libsvm")
> model <- spark.randomForest(df, label ~ features, "classification")
> {code}
> The exception is:
> {code}
> Error in handleErrors(returnStatus, conn) :
>   java.lang.IllegalArgumentException: requirement failed: If label column already exists, forceIndexLabel can not be set with true.
> 	at scala.Predef$.require(Predef.scala:224)
> 	at org.apache.spark.ml.feature.RFormula.transformSchema(RFormula.scala:205)
> 	at org.apache.spark.ml.PipelineStage.transformSchema(Pipeline.scala:70)
> 	at org.apache.spark.ml.feature.RFormula.fit(RFormula.scala:136)
> 	at org.apache.spark.ml.r.RandomForestClassifierWrapper$.fit(RandomForestClassificationWrapper.scala:86)
> 	at org.apache.spark.ml.r.RandomForestClassifierWrapper.fit(RandomForestClassificationWrapper.scala)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.apache.spark.api.r.RBackendHandler.handleMethodCall(RBackendHandler.scala:172)
> {code}
> This error is caused by the label column of the R formula already exists, we can not force to index label. However, it must index the label for classification algorithms, so we need to rename the RFormula.labelCol to a new value and then we can index the original label.
> This issue also appears at other algorithms: spark.naiveBayes, spark.glm(only for binomial family) and spark.gbt (only for classification).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org