Class DecisionTreeRegressor

All Implemented Interfaces:
Serializable, org.apache.spark.internal.Logging, Params, HasCheckpointInterval, HasFeaturesCol, HasLabelCol, HasPredictionCol, HasSeed, HasVarianceCol, HasWeightCol, org.apache.spark.ml.PredictorParams, org.apache.spark.ml.tree.DecisionTreeParams, org.apache.spark.ml.tree.DecisionTreeRegressorParams, org.apache.spark.ml.tree.HasVarianceImpurity, org.apache.spark.ml.tree.TreeRegressorParams, DefaultParamsWritable, Identifiable, MLWritable

public class DecisionTreeRegressor extends Regressor<Vector,DecisionTreeRegressor,DecisionTreeRegressionModel> implements org.apache.spark.ml.tree.DecisionTreeRegressorParams, DefaultParamsWritable
Decision tree learning algorithm for regression. It supports both continuous and categorical features.
See Also:
  • Constructor Details

    • DecisionTreeRegressor

      public DecisionTreeRegressor(String uid)
    • DecisionTreeRegressor

      public DecisionTreeRegressor()
  • Method Details

    • supportedImpurities

      public static final String[] supportedImpurities()
      Accessor for supported impurities: variance
    • load

      public static DecisionTreeRegressor load(String path)
    • read

      public static MLReader<T> read()
    • varianceCol

      public final Param<String> varianceCol()
      Description copied from interface: HasVarianceCol
      Param for Column name for the biased sample variance of prediction.
      Specified by:
      varianceCol in interface HasVarianceCol
      Returns:
      (undocumented)
    • impurity

      public final Param<String> impurity()
      Specified by:
      impurity in interface org.apache.spark.ml.tree.HasVarianceImpurity
    • leafCol

      public final Param<String> leafCol()
      Specified by:
      leafCol in interface org.apache.spark.ml.tree.DecisionTreeParams
    • maxDepth

      public final IntParam maxDepth()
      Specified by:
      maxDepth in interface org.apache.spark.ml.tree.DecisionTreeParams
    • maxBins

      public final IntParam maxBins()
      Specified by:
      maxBins in interface org.apache.spark.ml.tree.DecisionTreeParams
    • minInstancesPerNode

      public final IntParam minInstancesPerNode()
      Specified by:
      minInstancesPerNode in interface org.apache.spark.ml.tree.DecisionTreeParams
    • minWeightFractionPerNode

      public final DoubleParam minWeightFractionPerNode()
      Specified by:
      minWeightFractionPerNode in interface org.apache.spark.ml.tree.DecisionTreeParams
    • minInfoGain

      public final DoubleParam minInfoGain()
      Specified by:
      minInfoGain in interface org.apache.spark.ml.tree.DecisionTreeParams
    • maxMemoryInMB

      public final IntParam maxMemoryInMB()
      Specified by:
      maxMemoryInMB in interface org.apache.spark.ml.tree.DecisionTreeParams
    • cacheNodeIds

      public final BooleanParam cacheNodeIds()
      Specified by:
      cacheNodeIds in interface org.apache.spark.ml.tree.DecisionTreeParams
    • weightCol

      public final Param<String> weightCol()
      Description copied from interface: HasWeightCol
      Param for weight column name. If this is not set or empty, we treat all instance weights as 1.0.
      Specified by:
      weightCol in interface HasWeightCol
      Returns:
      (undocumented)
    • seed

      public final LongParam seed()
      Description copied from interface: HasSeed
      Param for random seed.
      Specified by:
      seed in interface HasSeed
      Returns:
      (undocumented)
    • checkpointInterval

      public final IntParam checkpointInterval()
      Description copied from interface: HasCheckpointInterval
      Param for set checkpoint interval (&gt;= 1) or disable checkpoint (-1). E.g. 10 means that the cache will get checkpointed every 10 iterations. Note: this setting will be ignored if the checkpoint directory is not set in the SparkContext.
      Specified by:
      checkpointInterval in interface HasCheckpointInterval
      Returns:
      (undocumented)
    • uid

      public String uid()
      Description copied from interface: Identifiable
      An immutable unique ID for the object and its derivatives.
      Specified by:
      uid in interface Identifiable
      Returns:
      (undocumented)
    • setMaxDepth

      public DecisionTreeRegressor setMaxDepth(int value)
    • setMaxBins

      public DecisionTreeRegressor setMaxBins(int value)
    • setMinInstancesPerNode

      public DecisionTreeRegressor setMinInstancesPerNode(int value)
    • setMinWeightFractionPerNode

      public DecisionTreeRegressor setMinWeightFractionPerNode(double value)
    • setMinInfoGain

      public DecisionTreeRegressor setMinInfoGain(double value)
    • setMaxMemoryInMB

      public DecisionTreeRegressor setMaxMemoryInMB(int value)
    • setCacheNodeIds

      public DecisionTreeRegressor setCacheNodeIds(boolean value)
    • setCheckpointInterval

      public DecisionTreeRegressor setCheckpointInterval(int value)
      Specifies how often to checkpoint the cached node IDs. E.g. 10 means that the cache will get checkpointed every 10 iterations. This is only used if cacheNodeIds is true and if the checkpoint directory is set in SparkContext. Must be at least 1. (default = 10)
      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • setImpurity

      public DecisionTreeRegressor setImpurity(String value)
    • setSeed

      public DecisionTreeRegressor setSeed(long value)
    • setVarianceCol

      public DecisionTreeRegressor setVarianceCol(String value)
    • setWeightCol

      public DecisionTreeRegressor setWeightCol(String value)
      Sets the value of param weightCol(). If this is not set or empty, we treat all instance weights as 1.0. Default is not set, so all instances have weight one.

      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • copy

      public DecisionTreeRegressor copy(ParamMap extra)
      Description copied from interface: Params
      Creates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly. See defaultCopy().
      Specified by:
      copy in interface Params
      Specified by:
      copy in class Predictor<Vector,DecisionTreeRegressor,DecisionTreeRegressionModel>
      Parameters:
      extra - (undocumented)
      Returns:
      (undocumented)