public class LinearRegressionModel extends RegressionModel<Vector,LinearRegressionModel> implements GeneralMLWritable
LinearRegression
.Modifier and Type | Method and Description |
---|---|
static IntParam |
aggregationDepth() |
static Params |
clear(Param<?> param) |
Vector |
coefficients() |
LinearRegressionModel |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
static DoubleParam |
elasticNetParam() |
static DoubleParam |
epsilon() |
DoubleParam |
epsilon()
The shape parameter to control the amount of robustness.
|
LinearRegressionSummary |
evaluate(Dataset<?> dataset)
Evaluates the model on a test dataset.
|
static String |
explainParam(Param<?> param) |
static String |
explainParams() |
static ParamMap |
extractParamMap() |
static ParamMap |
extractParamMap(ParamMap extra) |
static Param<String> |
featuresCol() |
static BooleanParam |
fitIntercept() |
static <T> scala.Option<T> |
get(Param<T> param) |
static int |
getAggregationDepth() |
static <T> scala.Option<T> |
getDefault(Param<T> param) |
static double |
getElasticNetParam() |
static double |
getEpsilon() |
double |
getEpsilon() |
static String |
getFeaturesCol() |
static boolean |
getFitIntercept() |
static String |
getLabelCol() |
static String |
getLoss() |
static int |
getMaxIter() |
static <T> T |
getOrDefault(Param<T> param) |
static Param<Object> |
getParam(String paramName) |
static String |
getPredictionCol() |
static double |
getRegParam() |
static String |
getSolver() |
static boolean |
getStandardization() |
static double |
getTol() |
static String |
getWeightCol() |
static <T> boolean |
hasDefault(Param<T> param) |
static boolean |
hasParam(String paramName) |
static boolean |
hasParent() |
boolean |
hasSummary()
Indicates whether a training summary exists for this model instance.
|
double |
intercept() |
static boolean |
isDefined(Param<?> param) |
static boolean |
isSet(Param<?> param) |
static Param<String> |
labelCol() |
static LinearRegressionModel |
load(String path) |
static Param<String> |
loss() |
Param<String> |
loss()
The loss function to be optimized.
|
static IntParam |
maxIter() |
int |
numFeatures()
Returns the number of features the model was trained on.
|
static Param<?>[] |
params() |
static void |
parent_$eq(Estimator<M> x$1) |
static Estimator<M> |
parent() |
double |
predict(Vector features)
Predict label for the given features.
|
static Param<String> |
predictionCol() |
static MLReader<LinearRegressionModel> |
read() |
static DoubleParam |
regParam() |
static void |
save(String path) |
double |
scale() |
static <T> Params |
set(Param<T> param,
T value) |
static M |
setFeaturesCol(String value) |
static M |
setParent(Estimator<M> parent) |
static M |
setPredictionCol(String value) |
static Param<String> |
solver() |
Param<String> |
solver()
The solver algorithm for optimization.
|
static BooleanParam |
standardization() |
LinearRegressionTrainingSummary |
summary()
Gets summary (e.g.
|
static DoubleParam |
tol() |
static String |
toString() |
static Dataset<Row> |
transform(Dataset<?> dataset) |
static Dataset<Row> |
transform(Dataset<?> dataset,
ParamMap paramMap) |
static Dataset<Row> |
transform(Dataset<?> dataset,
ParamPair<?> firstParamPair,
ParamPair<?>... otherParamPairs) |
static Dataset<Row> |
transform(Dataset<?> dataset,
ParamPair<?> firstParamPair,
scala.collection.Seq<ParamPair<?>> otherParamPairs) |
static StructType |
transformSchema(StructType schema) |
String |
uid()
An immutable unique ID for the object and its derivatives.
|
StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType) |
StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType)
Validates and transforms the input schema with the provided param map.
|
static Param<String> |
weightCol() |
GeneralMLWriter |
write()
Returns a
GeneralMLWriter instance for this ML instance. |
setFeaturesCol, setPredictionCol, transform, transformSchema
transform, transform, transform
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRegParam, regParam
elasticNetParam, getElasticNetParam
getMaxIter, maxIter
fitIntercept, getFitIntercept
getStandardization, standardization
getWeightCol, weightCol
aggregationDepth, getAggregationDepth
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
toString
save
getLabelCol, labelCol
featuresCol, getFeaturesCol
getPredictionCol, predictionCol
initializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public static MLReader<LinearRegressionModel> read()
public static LinearRegressionModel load(String path)
public static String toString()
public static Param<?>[] params()
public static String explainParam(Param<?> param)
public static String explainParams()
public static final boolean isSet(Param<?> param)
public static final boolean isDefined(Param<?> param)
public static boolean hasParam(String paramName)
public static Param<Object> getParam(String paramName)
public static final <T> scala.Option<T> get(Param<T> param)
public static final <T> T getOrDefault(Param<T> param)
public static final <T> scala.Option<T> getDefault(Param<T> param)
public static final <T> boolean hasDefault(Param<T> param)
public static final ParamMap extractParamMap()
public static Dataset<Row> transform(Dataset<?> dataset, ParamPair<?> firstParamPair, scala.collection.Seq<ParamPair<?>> otherParamPairs)
public static Dataset<Row> transform(Dataset<?> dataset, ParamPair<?> firstParamPair, ParamPair<?>... otherParamPairs)
public static Estimator<M> parent()
public static void parent_$eq(Estimator<M> x$1)
public static M setParent(Estimator<M> parent)
public static boolean hasParent()
public static final Param<String> labelCol()
public static final String getLabelCol()
public static final Param<String> featuresCol()
public static final String getFeaturesCol()
public static final Param<String> predictionCol()
public static final String getPredictionCol()
public static M setFeaturesCol(String value)
public static M setPredictionCol(String value)
public static StructType transformSchema(StructType schema)
public static final DoubleParam regParam()
public static final double getRegParam()
public static final DoubleParam elasticNetParam()
public static final double getElasticNetParam()
public static final IntParam maxIter()
public static final int getMaxIter()
public static final DoubleParam tol()
public static final double getTol()
public static final BooleanParam fitIntercept()
public static final boolean getFitIntercept()
public static final BooleanParam standardization()
public static final boolean getStandardization()
public static final Param<String> weightCol()
public static final String getWeightCol()
public static final String getSolver()
public static final IntParam aggregationDepth()
public static final int getAggregationDepth()
public static final String getLoss()
public static final Param<String> solver()
public static final Param<String> loss()
public static final DoubleParam epsilon()
public static double getEpsilon()
public static void save(String path) throws java.io.IOException
java.io.IOException
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()
trainingSummary == None
.public boolean hasSummary()
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 DoubleParam epsilon()
public double getEpsilon()
public Param<String> loss()
public Param<String> solver()
public StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
public StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
schema
- input schemafitting
- whether this is in fittingfeaturesDataType
- SQL DataType for FeaturesType.
E.g., VectorUDT
for vector features.