[英]Flink Multiple Linear Regression: does it have Predict?
I've a multiple regression model trained and now I want to use it to predict. 我已经训练了一个多元回归模型,现在我想用它来预测。
Reading the documents I understand that the input is a labeled vector and the output is a Dataset with tuple [ InputValue, PredictValue ], right? 阅读文档,我知道输入是带标签的向量,输出是具有元组[ InputValue,PredictValue ]的数据集,对吗?
I create my labeled Vector: 我创建了标记的Vector:
val mapped = data.map {x => new org.apache.flink.ml.common.LabeledVector (x._4, org.apache.flink.ml.math.DenseVector(x._1,x._2,x._3)) }
//Print
mapped: org.apache.flink.api.scala.DataSet[org.apache.flink.ml.common.LabeledVector] = org.apache.flink.api.scala.DataSet@7d4fefdc
LabeledVector(6.7, DenseVector(33.0, -52.26, 28.3))
LabeledVector(5.8, DenseVector(36.0, 45.53, 150.93))
.....
And with my model created and trained I predict: 通过创建和训练我的模型,我可以预测:
// Calculate the predictions for the test data
val predictions = mlr.predict(mapped)
I got this ERROR : 我收到此错误 :
java.lang.RuntimeException: There is no PredictOperation defined for org.apache.flink.ml.regression.MultipleLinearRegression which takes a DataSet[org.apache.flink.ml.common.LabeledVector] as input.
But you can see here that the official documentation say that it exits. 但是您可以在这里看到官方文档说它已经退出。
Thanks for your help! 谢谢你的帮助! :) :)
The prediction of LabeledVectors
has been removed with this commit . 此提交已删除LabeledVectors
的预测。 Unfortunately, the Flink documentation has not been updated. 不幸的是,Flink文档尚未更新。 I've created an issue to update the documentation. 我创建了一个问题来更新文档。
If you want to predict LabeledVectors
, then you have to write your own PredictOperation
which supports the respective types. 如果要预测LabeledVectors
,则必须编写支持各自类型的自己的PredictOperation
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.