GeneralizedLinearRegression (GLM)
GeneralizedLinearRegression
is a regression algorithm. It supports the following error distribution families:
-
gaussian
-
binomial
-
poisson
-
gamma
GeneralizedLinearRegression
supports the following relationship between the linear predictor and the mean of the distribution function links:
-
identity
-
logit
-
log
-
inverse
-
probit
-
cloglog
-
sqrt
GeneralizedLinearRegression
supports 4096
features.
The label column has to be of DoubleType
type.
Note
|
GeneralizedLinearRegression belongs to org.apache.spark.ml.regression package.
|
1 2 3 4 5 6 7 8 9 10 11 |
import org.apache.spark.ml.regression._ val glm = new GeneralizedLinearRegression() import org.apache.spark.ml.linalg._ val features = Vectors.sparse(5, Seq((3,1.0))) val trainDF = Seq((0, features, 1)).toDF("id", "features", "label") val glmModel = glm.fit(trainDF) |
GeneralizedLinearRegression
is a Regressor with features of Vector type that can train a GeneralizedLinearRegressionModel.
Regressor
Regressor
is a custom Predictor.