package regression
- Alphabetic
- Public
- Protected
Type Members
- class AFTSurvivalRegression extends Regressor[Vector, AFTSurvivalRegression, AFTSurvivalRegressionModel] with AFTSurvivalRegressionParams with DefaultParamsWritable with Logging
Fit a parametric survival regression model named accelerated failure time (AFT) model (see Accelerated failure time model (Wikipedia)) based on the Weibull distribution of the survival time.
Fit a parametric survival regression model named accelerated failure time (AFT) model (see Accelerated failure time model (Wikipedia)) based on the Weibull distribution of the survival time.
Since 3.1.0, it supports stacking instances into blocks and using GEMV for better performance. The block size will be 1.0 MB, if param maxBlockSizeInMB is set 0.0 by default.
- Annotations
- @Since("1.6.0")
- class AFTSurvivalRegressionModel extends RegressionModel[Vector, AFTSurvivalRegressionModel] with AFTSurvivalRegressionParams with MLWritable
Model produced by AFTSurvivalRegression.
Model produced by AFTSurvivalRegression.
- Annotations
- @Since("1.6.0")
- class DecisionTreeRegressionModel extends RegressionModel[Vector, DecisionTreeRegressionModel] with DecisionTreeModel with DecisionTreeRegressorParams with MLWritable with Serializable
Decision tree (Wikipedia) model for regression.
Decision tree (Wikipedia) model for regression. It supports both continuous and categorical features.
- Annotations
- @Since("1.4.0")
- class DecisionTreeRegressor extends Regressor[Vector, DecisionTreeRegressor, DecisionTreeRegressionModel] with DecisionTreeRegressorParams with DefaultParamsWritable
Decision tree learning algorithm for regression.
Decision tree learning algorithm for regression. It supports both continuous and categorical features.
- Annotations
- @Since("1.4.0")
- class FMRegressionModel extends RegressionModel[Vector, FMRegressionModel] with FMRegressorParams with MLWritable
Model produced by FMRegressor.
Model produced by FMRegressor.
- Annotations
- @Since("3.0.0")
- class FMRegressor extends Regressor[Vector, FMRegressor, FMRegressionModel] with FactorizationMachines with FMRegressorParams with DefaultParamsWritable with Logging
Factorization Machines learning algorithm for regression.
Factorization Machines learning algorithm for regression. It supports normal gradient descent and AdamW solver.
The implementation is based on: S. Rendle. "Factorization machines" 2010.
FM is able to estimate interactions even in problems with huge sparsity (like advertising and recommendation system). FM formula is:
$$ \begin{align} y = w_0 + \sum\limits^n_{i-1} w_i x_i + \sum\limits^n_{i=1} \sum\limits^n_{j=i+1} \langle v_i, v_j \rangle x_i x_j \end{align} $$
First two terms denote global bias and linear term (as same as linear regression), and last term denotes pairwise interactions term. v_i describes the i-th variable with k factors.FM regression model uses MSE loss which can be solved by gradient descent method, and regularization terms like L2 are usually added to the loss function to prevent overfitting.
- Annotations
- @Since("3.0.0")
- class GBTRegressionModel extends RegressionModel[Vector, GBTRegressionModel] with GBTRegressorParams with TreeEnsembleModel[DecisionTreeRegressionModel] with MLWritable with Serializable
Gradient-Boosted Trees (GBTs) model for regression.
Gradient-Boosted Trees (GBTs) model for regression. It supports both continuous and categorical features.
- Annotations
- @Since("1.4.0")
- class GBTRegressor extends Regressor[Vector, GBTRegressor, GBTRegressionModel] with GBTRegressorParams with DefaultParamsWritable with Logging
Gradient-Boosted Trees (GBTs) learning algorithm for regression.
Gradient-Boosted Trees (GBTs) learning algorithm for regression. It supports both continuous and categorical features.
The implementation is based upon: J.H. Friedman. "Stochastic Gradient Boosting." 1999.
Notes on Gradient Boosting vs. TreeBoost:
- This implementation is for Stochastic Gradient Boosting, not for TreeBoost.
- Both algorithms learn tree ensembles by minimizing loss functions.
- TreeBoost (Friedman, 1999) additionally modifies the outputs at tree leaf nodes
based on the loss function, whereas the original gradient boosting method does not.
- When the loss is SquaredError, these methods give the same result, but they could differ for other loss functions.
- We expect to implement TreeBoost in the future: [https://issues.apache.org/jira/browse/SPARK-4240]
- Annotations
- @Since("1.4.0")
- class GeneralizedLinearRegression extends Regressor[Vector, GeneralizedLinearRegression, GeneralizedLinearRegressionModel] with GeneralizedLinearRegressionBase with DefaultParamsWritable with Logging
Fit a Generalized Linear Model (see Generalized linear model (Wikipedia)) specified by giving a symbolic description of the linear predictor (link function) and a description of the error distribution (family).
Fit a Generalized Linear Model (see Generalized linear model (Wikipedia)) specified by giving a symbolic description of the linear predictor (link function) and a description of the error distribution (family). It supports "gaussian", "binomial", "poisson", "gamma" and "tweedie" as family. Valid link functions for each family is listed below. The first link function of each family is the default one.
- "gaussian" : "identity", "log", "inverse"
- "binomial" : "logit", "probit", "cloglog"
- "poisson" : "log", "identity", "sqrt"
- "gamma" : "inverse", "identity", "log"
- "tweedie" : power link function specified through "linkPower". The default link power in the tweedie family is 1 - variancePower.
- Annotations
- @Since("2.0.0")
- class GeneralizedLinearRegressionModel extends RegressionModel[Vector, GeneralizedLinearRegressionModel] with GeneralizedLinearRegressionBase with MLWritable with HasTrainingSummary[GeneralizedLinearRegressionTrainingSummary]
Model produced by GeneralizedLinearRegression.
Model produced by GeneralizedLinearRegression.
- Annotations
- @Since("2.0.0")
- class GeneralizedLinearRegressionSummary extends Serializable
Summary of GeneralizedLinearRegression model and predictions.
Summary of GeneralizedLinearRegression model and predictions.
- Annotations
- @Since("2.0.0")
- class GeneralizedLinearRegressionTrainingSummary extends GeneralizedLinearRegressionSummary with Serializable
Summary of GeneralizedLinearRegression fitting and model.
Summary of GeneralizedLinearRegression fitting and model.
- Annotations
- @Since("2.0.0")
- class IsotonicRegression extends Estimator[IsotonicRegressionModel] with IsotonicRegressionBase with DefaultParamsWritable
Isotonic regression.
Isotonic regression.
Currently implemented using parallelized pool adjacent violators algorithm. Only univariate (single feature) algorithm supported.
- Annotations
- @Since("1.5.0")
- class IsotonicRegressionModel extends Model[IsotonicRegressionModel] with IsotonicRegressionBase with MLWritable
Model fitted by IsotonicRegression.
Model fitted by IsotonicRegression. Predicts using a piecewise linear function.
For detailed rules see
org.apache.spark.mllib.regression.IsotonicRegressionModel.predict()
.- Annotations
- @Since("1.5.0")
- class LinearRegression extends Regressor[Vector, LinearRegression, LinearRegressionModel] with LinearRegressionParams with DefaultParamsWritable with Logging
Linear regression.
Linear regression.
The learning objective is to minimize the specified loss function, with regularization. This supports two kinds of loss:
- squaredError (a.k.a squared loss)
- huber (a hybrid of squared error for relatively small errors and absolute error for relatively large ones, and we estimate the scale parameter from training data)
This supports multiple types of regularization:
- none (a.k.a. ordinary least squares)
- L2 (ridge regression)
- L1 (Lasso)
- L2 + L1 (elastic net)
The squared error objective function is:
$$ \begin{align} \min_{w}\frac{1}{2n}{\sum_{i=1}^n(X_{i}w - y_{i})^{2} + \lambda\left[\frac{1-\alpha}{2}{||w||_{2}}^{2} + \alpha{||w||_{1}}\right]} \end{align} $$
The huber objective function is:
$$ \begin{align} \min_{w, \sigma}\frac{1}{2n}{\sum_{i=1}^n\left(\sigma + H_m\left(\frac{X_{i}w - y_{i}}{\sigma}\right)\sigma\right) + \frac{1}{2}\lambda {||w||_2}^2} \end{align} $$
where
$$ \begin{align} H_m(z) = \begin{cases} z^2, & \text {if } |z| < \epsilon, \\ 2\epsilon|z| - \epsilon^2, & \text{otherwise} \end{cases} \end{align} $$
Since 3.1.0, it supports stacking instances into blocks and using GEMV for better performance. The block size will be 1.0 MB, if param maxBlockSizeInMB is set 0.0 by default.
Note: Fitting with huber loss only supports none and L2 regularization.
- Annotations
- @Since("1.3.0")
- class LinearRegressionModel extends RegressionModel[Vector, LinearRegressionModel] with LinearRegressionParams with GeneralMLWritable with HasTrainingSummary[LinearRegressionTrainingSummary]
Model produced by LinearRegression.
Model produced by LinearRegression.
- Annotations
- @Since("1.3.0")
- class LinearRegressionSummary extends Serializable
Linear regression results evaluated on a dataset.
Linear regression results evaluated on a dataset.
- Annotations
- @Since("1.5.0")
- class LinearRegressionTrainingSummary extends LinearRegressionSummary
Linear regression training results.
Linear regression training results. Currently, the training summary ignores the training weights except for the objective trace.
- Annotations
- @Since("1.5.0")
- class RandomForestRegressionModel extends RegressionModel[Vector, RandomForestRegressionModel] with RandomForestRegressorParams with TreeEnsembleModel[DecisionTreeRegressionModel] with MLWritable with Serializable
Random Forest model for regression.
Random Forest model for regression. It supports both continuous and categorical features.
- Annotations
- @Since("1.4.0")
- class RandomForestRegressor extends Regressor[Vector, RandomForestRegressor, RandomForestRegressionModel] with RandomForestRegressorParams with DefaultParamsWritable
Random Forest learning algorithm for regression.
Random Forest learning algorithm for regression. It supports both continuous and categorical features.
- Annotations
- @Since("1.4.0")
- abstract class RegressionModel[FeaturesType, M <: RegressionModel[FeaturesType, M]] extends PredictionModel[FeaturesType, M] with PredictorParams
Model produced by a
Regressor
.Model produced by a
Regressor
.- FeaturesType
Type of input features. E.g., org.apache.spark.mllib.linalg.Vector
- M
Concrete Model type.
- abstract class Regressor[FeaturesType, Learner <: Regressor[FeaturesType, Learner, M], M <: RegressionModel[FeaturesType, M]] extends Predictor[FeaturesType, Learner, M] with PredictorParams
Single-label regression
Single-label regression
- FeaturesType
Type of input features. E.g., org.apache.spark.mllib.linalg.Vector
- Learner
Concrete Estimator type
- M
Concrete Model type
Value Members
- object AFTSurvivalRegression extends DefaultParamsReadable[AFTSurvivalRegression] with Serializable
- Annotations
- @Since("1.6.0")
- object AFTSurvivalRegressionModel extends MLReadable[AFTSurvivalRegressionModel] with Serializable
- Annotations
- @Since("1.6.0")
- object DecisionTreeRegressionModel extends MLReadable[DecisionTreeRegressionModel] with Serializable
- Annotations
- @Since("2.0.0")
- object DecisionTreeRegressor extends DefaultParamsReadable[DecisionTreeRegressor] with Serializable
- Annotations
- @Since("1.4.0")
- object FMRegressionModel extends MLReadable[FMRegressionModel] with Serializable
- Annotations
- @Since("3.0.0")
- object FMRegressor extends DefaultParamsReadable[FMRegressor] with Serializable
- Annotations
- @Since("3.0.0")
- object GBTRegressionModel extends MLReadable[GBTRegressionModel] with Serializable
- Annotations
- @Since("2.0.0")
- object GBTRegressor extends DefaultParamsReadable[GBTRegressor] with Serializable
- Annotations
- @Since("1.4.0")
- object GeneralizedLinearRegression extends DefaultParamsReadable[GeneralizedLinearRegression] with Serializable
- Annotations
- @Since("2.0.0")
- object GeneralizedLinearRegressionModel extends MLReadable[GeneralizedLinearRegressionModel] with Serializable
- Annotations
- @Since("2.0.0")
- object IsotonicRegression extends DefaultParamsReadable[IsotonicRegression] with Serializable
- Annotations
- @Since("1.6.0")
- object IsotonicRegressionModel extends MLReadable[IsotonicRegressionModel] with Serializable
- Annotations
- @Since("1.6.0")
- object LinearRegression extends DefaultParamsReadable[LinearRegression] with Serializable
- Annotations
- @Since("1.6.0")
- object LinearRegressionModel extends MLReadable[LinearRegressionModel] with Serializable
- Annotations
- @Since("1.6.0")
- object RandomForestRegressionModel extends MLReadable[RandomForestRegressionModel] with Serializable
- Annotations
- @Since("2.0.0")
- object RandomForestRegressor extends DefaultParamsReadable[RandomForestRegressor] with Serializable
- Annotations
- @Since("1.4.0")