SparkR保存ML模型

时间:2017-07-30 13:24:38

标签: apache-spark apache-spark-mllib sparkr

如何保存SparkR模型并单独加载模型并预测?
Spark版本2.0

# Load training data
 df <- read.df("data/mllib/sample_libsvm_data.txt", source = "libsvm")
 training <- df
 testing <- df

# Fit a random forest classification model with spark.randomForest
 model <- spark.randomForest(training, label ~ features, "classification", numTrees = 10)

# Model summary
 summary(model)



 ### Save and Load
 ??

# Prediction
 predictions <- predict(model, test)
 head(predictions)

1 个答案:

答案 0 :(得分:2)

我相信您正在寻找read.ml(path)write.ml(object, path)