Package org.apache.spark.mllib.tree.model

Examples of org.apache.spark.mllib.tree.model.DecisionTreeModel.predict()


    // Evaluate model on training instances and compute training error
    JavaPairRDD<Double, Double> predictionAndLabel =
      data.mapToPair(new PairFunction<LabeledPoint, Double, Double>() {
        @Override public Tuple2<Double, Double> call(LabeledPoint p) {
          return new Tuple2<Double, Double>(model.predict(p.features()), p.label());
        }
      });
    Double trainErr =
      1.0 * predictionAndLabel.filter(new Function<Tuple2<Double, Double>, Boolean>() {
        @Override public Boolean call(Tuple2<Double, Double> pl) {
View Full Code Here


    // Evaluate model on training instances and compute training error
    JavaPairRDD<Double, Double> regressorPredictionAndLabel =
      data.mapToPair(new PairFunction<LabeledPoint, Double, Double>() {
        @Override public Tuple2<Double, Double> call(LabeledPoint p) {
          return new Tuple2<Double, Double>(regressionModel.predict(p.features()), p.label());
        }
      });
    Double trainMSE =
      regressorPredictionAndLabel.map(new Function<Tuple2<Double, Double>, Double>() {
        @Override public Double call(Tuple2<Double, Double> pl) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.