私は使用してLinearRegressionWithSGD
おり、モデルの重みと切片を保存しています。
重みを含むファイルの形式は次のとおりです。
1.20455
0.1356
0.000456
インターセプトを設定せずにトレインを使用しているため、インターセプトは 0 であり、現時点では無視できます。ここで、新しいモデル オブジェクトを初期化し、上記のファイルから保存した重みを使用したいと思います。CDH 5.1を使用しています
これらの行に沿ったもの:
// Here is the code the load data and train the model on it.
val weights = sc.textFile("linear-weights");
val model = new LinearRegressionWithSGD(weights);
次に、使用は次のとおりです。
// Here is where I want to use the trained model to predict on new data.
val valuesAndPreds = testData.map { point =>
// Predicting on new data.
val prediction = model.predict(point.features)
(point.label, prediction)
}
どうすればそれを行うことができますか?