public class LinearRegressionModel extends RegressionModel<Vector,LinearRegressionModel> implements LinearRegressionParams, GeneralMLWritable, HasTrainingSummary<LinearRegressionTrainingSummary>
LinearRegression
.Modifier and Type | Method and Description |
---|---|
IntParam |
aggregationDepth()
Param for suggested depth for treeAggregate (>= 2).
|
Vector |
coefficients() |
LinearRegressionModel |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
DoubleParam |
elasticNetParam()
Param for the ElasticNet mixing parameter, in range [0, 1].
|
DoubleParam |
epsilon()
The shape parameter to control the amount of robustness.
|
LinearRegressionSummary |
evaluate(Dataset<?> dataset)
Evaluates the model on a test dataset.
|
BooleanParam |
fitIntercept()
Param for whether to fit an intercept term.
|
double |
intercept() |
static LinearRegressionModel |
load(String path) |
Param<String> |
loss()
The loss function to be optimized.
|
DoubleParam |
maxBlockSizeInMB()
Param for Maximum memory in MB for stacking input data into blocks.
|
IntParam |
maxIter()
Param for maximum number of iterations (>= 0).
|
int |
numFeatures()
Returns the number of features the model was trained on.
|
double |
predict(Vector features)
Predict label for the given features.
|
static MLReader<LinearRegressionModel> |
read() |
DoubleParam |
regParam()
Param for regularization parameter (>= 0).
|
double |
scale() |
Param<String> |
solver()
The solver algorithm for optimization.
|
BooleanParam |
standardization()
Param for whether to standardize the training features before fitting the model.
|
LinearRegressionTrainingSummary |
summary()
Gets summary (e.g.
|
DoubleParam |
tol()
Param for the convergence tolerance for iterative algorithms (>= 0).
|
String |
toString() |
String |
uid()
An immutable unique ID for the object and its derivatives.
|
Param<String> |
weightCol()
Param for weight column name.
|
GeneralMLWriter |
write()
Returns a
GeneralMLWriter instance for this ML instance. |
featuresCol, labelCol, predictionCol, setFeaturesCol, setPredictionCol, transform, transformSchema
transform, transform, transform
params
getEpsilon, validateAndTransformSchema
extractInstances, extractInstances
getLabelCol, labelCol
featuresCol, getFeaturesCol
getPredictionCol, predictionCol
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
getRegParam
getElasticNetParam
getMaxIter
getFitIntercept
getStandardization
getWeightCol
getAggregationDepth
getMaxBlockSizeInMB
save
hasSummary, setSummary
$init$, initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, initLock, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning, org$apache$spark$internal$Logging$$log__$eq, org$apache$spark$internal$Logging$$log_, uninitialize
public static MLReader<LinearRegressionModel> read()
public static LinearRegressionModel load(String path)
public final Param<String> solver()
LinearRegressionParams
solver
in interface HasSolver
solver
in interface LinearRegressionParams
public final Param<String> loss()
LinearRegressionParams
loss
in interface HasLoss
loss
in interface LinearRegressionParams
public final DoubleParam epsilon()
LinearRegressionParams
epsilon
in interface LinearRegressionParams
public final DoubleParam maxBlockSizeInMB()
HasMaxBlockSizeInMB
maxBlockSizeInMB
in interface HasMaxBlockSizeInMB
public final IntParam aggregationDepth()
HasAggregationDepth
aggregationDepth
in interface HasAggregationDepth
public final Param<String> weightCol()
HasWeightCol
weightCol
in interface HasWeightCol
public final BooleanParam standardization()
HasStandardization
standardization
in interface HasStandardization
public final BooleanParam fitIntercept()
HasFitIntercept
fitIntercept
in interface HasFitIntercept
public final DoubleParam tol()
HasTol
public final IntParam maxIter()
HasMaxIter
maxIter
in interface HasMaxIter
public final DoubleParam elasticNetParam()
HasElasticNetParam
elasticNetParam
in interface HasElasticNetParam
public final DoubleParam regParam()
HasRegParam
regParam
in interface HasRegParam
public String uid()
Identifiable
uid
in interface Identifiable
public Vector coefficients()
public double intercept()
public double scale()
public int numFeatures()
PredictionModel
numFeatures
in class PredictionModel<Vector,LinearRegressionModel>
public LinearRegressionTrainingSummary summary()
hasSummary
is false.summary
in interface HasTrainingSummary<LinearRegressionTrainingSummary>
public LinearRegressionSummary evaluate(Dataset<?> dataset)
dataset
- Test dataset to evaluate model on.public double predict(Vector features)
PredictionModel
transform()
and output predictionCol
.predict
in class PredictionModel<Vector,LinearRegressionModel>
features
- (undocumented)public LinearRegressionModel copy(ParamMap extra)
Params
defaultCopy()
.copy
in interface Params
copy
in class Model<LinearRegressionModel>
extra
- (undocumented)public GeneralMLWriter write()
GeneralMLWriter
instance for this ML instance.
For LinearRegressionModel
, this does NOT currently save the training summary
.
An option to save summary
may be added in the future.
This also does not save the parent
currently.
write
in interface GeneralMLWritable
write
in interface MLWritable
public String toString()
toString
in interface Identifiable
toString
in class Object