简体   繁体   English

我是火花的新手,试图在Scala中生成决策树模型并在Java中使用该模型进行预测。如何在Java中加载该模型?

[英]I'm new to spark,trying to generate the decision tree model in scala and use that model in java to predict.How to load that model in java?

i have saved the model generated in scala to disc. 我已经将在scala中生成的模型保存到光盘中。

val model = DecisionTree.trainClassifier(trainingData, numClasses, categoricalFeaturesInfo, impurity, maxDepth, maxBins) model.save(sc, "C:\\Model") val模型= DecisionTree.trainClassifier(trainingData,numClasses,categoricalFeaturesInfo,杂质,maxDepth,maxBins)model.save(sc,“ C:\\ Model”)

对Java使用相同的导入以加载模型:

DecisionTreeModel model = DecisionTreeModel.load(sc, "C:\\Model");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM