Predictionio random forest
In fact, predictionio also supports random forest algorithm. Unfortunately, there is no official example. I briefly wrote a point. You can also refer to this address:
Https://github.com/runapal5/PredictionIO-DefectPrediction/blob/master/engine.json
Public class RandomForestAlgorithm extends P2LJavaAlgorithm {/ * / private static final long serialVersionUID = 1L; private final RandomForestAlgorithmParams ap; public RandomForestAlgorithm (RandomForestAlgorithmParams ap) {this.ap = ap;} @ Override public RandomForestModel train (SparkContext sc, PreparedData preparedData) {String datapath = "/ root/whk/company.txt"; JavaRDD treedata = MLUtils.loadLibSVMFile (sc, datapath). ToJavaRDD (); Map categoricalFeaturesInfo = new HashMap () Return RandomForest.trainClassifier (treedata, ap.getNumClasses (), categoricalFeaturesInfo, ap.getNumTrees (), ap.getFeatureSubsetStrategy (), ap.getImpurity (), ap.getMaxDepth (), ap.getMaxBins (), 12345);} @ Override public PredictedResult predict (RandomForestModel model, final Query query) {double [] b = {12Power0}; model.predict (Vectors.dense (b)) Return null;}}