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, transformSchematransform, transform, transformparamsgetEpsilon, validateAndTransformSchemagetLabelCol, labelColfeaturesCol, getFeaturesColgetPredictionCol, predictionColclear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwngetRegParamgetElasticNetParamgetMaxItergetFitInterceptgetStandardizationgetWeightColgetAggregationDepthgetMaxBlockSizeInMBsavehasSummary, 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_, uninitializepublic static MLReader<LinearRegressionModel> read()
public static LinearRegressionModel load(String path)
public final Param<String> solver()
LinearRegressionParamssolver in interface HasSolversolver in interface LinearRegressionParamspublic final Param<String> loss()
LinearRegressionParamsloss in interface HasLossloss in interface LinearRegressionParamspublic final DoubleParam epsilon()
LinearRegressionParamsepsilon in interface LinearRegressionParamspublic final DoubleParam maxBlockSizeInMB()
HasMaxBlockSizeInMBmaxBlockSizeInMB in interface HasMaxBlockSizeInMBpublic final IntParam aggregationDepth()
HasAggregationDepthaggregationDepth in interface HasAggregationDepthpublic final Param<String> weightCol()
HasWeightColweightCol in interface HasWeightColpublic final BooleanParam standardization()
HasStandardizationstandardization in interface HasStandardizationpublic final BooleanParam fitIntercept()
HasFitInterceptfitIntercept in interface HasFitInterceptpublic final DoubleParam tol()
HasTolpublic final IntParam maxIter()
HasMaxItermaxIter in interface HasMaxIterpublic final DoubleParam elasticNetParam()
HasElasticNetParamelasticNetParam in interface HasElasticNetParampublic final DoubleParam regParam()
HasRegParamregParam in interface HasRegParampublic String uid()
Identifiableuid in interface Identifiablepublic Vector coefficients()
public double intercept()
public double scale()
public int numFeatures()
PredictionModelnumFeatures 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)
PredictionModeltransform() and output predictionCol.predict in class PredictionModel<Vector,LinearRegressionModel>features - (undocumented)public LinearRegressionModel copy(ParamMap extra)
ParamsdefaultCopy().copy in interface Paramscopy 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 GeneralMLWritablewrite in interface MLWritablepublic String toString()
toString in interface IdentifiabletoString in class Object