Hello Thomas, since you are calling evaluate here, you should be creating an EvaluateDataSet operation that works with LabeledVector, I see you are creating a new PredictOperation.
On Wed, Oct 19, 2016 at 3:05 PM, Thomas FOURNIER < thomasfournier...@gmail.com> wrote: > Hi, > > I'd like to improve SVM evaluate function so that it can use LabeledVector > (and not only Vector). > Indeed, what is done in test is the following (data is a > DataSet[LabeledVector]): > > val test = data.map(l => (l.vector, l.label)) > svm.evaluate(test) > > We would like to do: > sm.evaluate(data) > > > Adding this "new" code: > > implicit def predictLabeledPoint[T <: LabeledVector] = { > new PredictOperation ... > } > > gives me a predictOperation that should be used with > defaultEvaluateDataSetOperation > with the correct signature (ie with T <: LabeledVector and not T<: Vector). > > Nonetheless, tests are failing: > > > it should "predict with LabeledDataPoint" in { > > val env = ExecutionEnvironment.getExecutionEnvironment > > val svm = SVM(). > setBlocks(env.getParallelism). > setIterations(100). > setLocalIterations(100). > setRegularization(0.002). > setStepsize(0.1). > setSeed(0) > > val trainingDS = env.fromCollection(Classification.trainingData) > svm.fit(trainingDS) > val predictionPairs = svm.evaluate(trainingDS) > > .... > } > > There is no PredictOperation defined for > org.apache.flink.ml.classification.SVM which takes a > DataSet[org.apache.flink.ml.common.LabeledVector] as input. > 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. > > > > Thanks > > Regards > Thomas >