Lim Chee Hau created FLINK-4886:
-----------------------------------

             Summary: Example in Machine Learning Quickstart Guide causes error
                 Key: FLINK-4886
                 URL: https://issues.apache.org/jira/browse/FLINK-4886
             Project: Flink
          Issue Type: Bug
          Components: Documentation
            Reporter: Lim Chee Hau
            Priority: Minor


Under *Loading Data/LibSVM* files section, loading test data with below line 
will causes error when execute prediction method *svm.predict(astroTest)*:
{code}
val astroTest: DataSet[LabeledVector] = 
MLUtils.readLibSVM("/path/to/svmguide1.t")
{code}

Error will be looks like:
{noformat}
Exception in thread "main" java.lang.RuntimeException: There is no 
PredictOperation defined for org.apache.flink.ml.classification.SVM which takes 
a DataSet[org.apache.flink.ml.common.LabeledVector] as input.
        at 
org.apache.flink.ml.pipeline.Estimator$$anon$1.predictDataSet(Estimator.scala:113)
        at 
org.apache.flink.ml.pipeline.Predictor$class.predict(Predictor.scala:59)
        at org.apache.flink.ml.classification.SVM.predict(SVM.scala:131)
        at org.apache.flink.quickstart.BatchJob$.main(BatchJob.scala:116)
        at org.apache.flink.quickstart.BatchJob.main(BatchJob.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:497)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
{noformat}

Because *predict* method expects *DataSet\[Vector\]* instead of 
*DataSet\[LabeledVector\]*, loading test data with below line will solve the 
problem:
{code}
val astroTest: DataSet[Vector] = 
MLUtils.readLibSVM("/path/to/svmguide1.t").map(_.vector)
{code}



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

Reply via email to