public class GeneralizedLinearRegressionModel extends RegressionModel<Vector,GeneralizedLinearRegressionModel> implements MLWritable
GeneralizedLinearRegression
.Modifier and Type | Method and Description |
---|---|
static Params |
clear(Param<?> param) |
Vector |
coefficients() |
GeneralizedLinearRegressionModel |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
GeneralizedLinearRegressionSummary |
evaluate(Dataset<?> dataset)
Evaluate the model on the given dataset, returning a summary of the results.
|
static String |
explainParam(Param<?> param) |
static String |
explainParams() |
static ParamMap |
extractParamMap() |
static ParamMap |
extractParamMap(ParamMap extra) |
static Param<String> |
family() |
Param<String> |
family()
Param for the name of family which is a description of the error distribution
to be used in the model.
|
static Param<String> |
featuresCol() |
Param<String> |
featuresCol()
Param for features column name.
|
static BooleanParam |
fitIntercept() |
static <T> scala.Option<T> |
get(Param<T> param) |
static <T> scala.Option<T> |
getDefault(Param<T> param) |
static String |
getFamily() |
String |
getFamily() |
static String |
getFeaturesCol() |
String |
getFeaturesCol() |
static boolean |
getFitIntercept() |
static String |
getLabelCol() |
String |
getLabelCol() |
static String |
getLink() |
String |
getLink() |
static double |
getLinkPower() |
double |
getLinkPower() |
static String |
getLinkPredictionCol() |
String |
getLinkPredictionCol() |
static int |
getMaxIter() |
static <T> T |
getOrDefault(Param<T> param) |
static Param<Object> |
getParam(String paramName) |
static String |
getPredictionCol() |
String |
getPredictionCol() |
static double |
getRegParam() |
static String |
getSolver() |
static double |
getTol() |
static double |
getVariancePower() |
double |
getVariancePower() |
static String |
getWeightCol() |
static <T> boolean |
hasDefault(Param<T> param) |
boolean |
hasLinkPredictionCol()
Checks whether we should output link prediction.
|
static boolean |
hasParam(String paramName) |
static boolean |
hasParent() |
boolean |
hasSummary()
Indicates if
summary is available. |
double |
intercept() |
static boolean |
isDefined(Param<?> param) |
static boolean |
isSet(Param<?> param) |
static Param<String> |
labelCol() |
Param<String> |
labelCol()
Param for label column name.
|
static Param<String> |
link() |
Param<String> |
link()
Param for the name of link function which provides the relationship
between the linear predictor and the mean of the distribution function.
|
static DoubleParam |
linkPower() |
DoubleParam |
linkPower()
Param for the index in the power link function.
|
static Param<String> |
linkPredictionCol() |
Param<String> |
linkPredictionCol()
Param for link prediction (linear predictor) column name.
|
static GeneralizedLinearRegressionModel |
load(String path) |
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() |
static Param<String> |
predictionCol() |
Param<String> |
predictionCol()
Param for prediction column name.
|
static MLReader<GeneralizedLinearRegressionModel> |
read() |
static DoubleParam |
regParam() |
static void |
save(String path) |
static <T> Params |
set(Param<T> param,
T value) |
static M |
setFeaturesCol(String value) |
GeneralizedLinearRegressionModel |
setLinkPredictionCol(String value)
Sets the link prediction (linear predictor) column name.
|
static M |
setParent(Estimator<M> parent) |
static M |
setPredictionCol(String value) |
static Param<String> |
solver() |
GeneralizedLinearRegressionTrainingSummary |
summary()
Gets R-like summary of model on training set.
|
static DoubleParam |
tol() |
static String |
toString() |
Dataset<Row> |
transform(Dataset<?> dataset)
Transforms dataset by reading from
featuresCol , calling predict , and storing
the predictions as a new column predictionCol . |
static StructType |
transformSchema(StructType schema) |
String |
uid()
An immutable unique ID for the object and its derivatives.
|
static StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType) |
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 DoubleParam |
variancePower() |
DoubleParam |
variancePower()
Param for the power in the variance function of the Tweedie distribution which provides
the relationship between the variance and mean of the distribution.
|
static Param<String> |
weightCol() |
MLWriter |
write()
Returns a
MLWriter instance for this ML instance. |
setFeaturesCol, setPredictionCol, transformSchema
transform, transform, transform
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeLogging, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
save
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
public static MLReader<GeneralizedLinearRegressionModel> read()
public static GeneralizedLinearRegressionModel 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 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 BooleanParam fitIntercept()
public static final boolean getFitIntercept()
public static final IntParam maxIter()
public static final int getMaxIter()
public static final DoubleParam tol()
public static final double getTol()
public static final DoubleParam regParam()
public static final double getRegParam()
public static final Param<String> weightCol()
public static final String getWeightCol()
public static final Param<String> solver()
public static final String getSolver()
public static final Param<String> family()
public static String getFamily()
public static final DoubleParam variancePower()
public static double getVariancePower()
public static final Param<String> link()
public static String getLink()
public static final DoubleParam linkPower()
public static double getLinkPower()
public static final Param<String> linkPredictionCol()
public static String getLinkPredictionCol()
public static StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
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 GeneralizedLinearRegressionModel setLinkPredictionCol(String value)
value
- (undocumented)public Dataset<Row> transform(Dataset<?> dataset)
PredictionModel
featuresCol
, calling predict
, and storing
the predictions as a new column predictionCol
.
transform
in class PredictionModel<Vector,GeneralizedLinearRegressionModel>
dataset
- input datasetpredictionCol
of type Double
public GeneralizedLinearRegressionTrainingSummary summary()
public boolean hasSummary()
summary
is available.public GeneralizedLinearRegressionSummary evaluate(Dataset<?> dataset)
dataset
- (undocumented)public GeneralizedLinearRegressionModel copy(ParamMap extra)
Params
defaultCopy()
.copy
in interface Params
copy
in class Model<GeneralizedLinearRegressionModel>
extra
- (undocumented)public MLWriter write()
MLWriter
instance for this ML instance.
For GeneralizedLinearRegressionModel
, this does NOT currently save the
training summary
. An option to save summary
may be added in the future.
write
in interface MLWritable
public int numFeatures()
PredictionModel
numFeatures
in class PredictionModel<Vector,GeneralizedLinearRegressionModel>
public Param<String> family()
public String getFamily()
public DoubleParam variancePower()
public double getVariancePower()
public Param<String> link()
linkPower
.
public String getLink()
public DoubleParam linkPower()
variancePower
, which matches the R "statmod"
package.
public double getLinkPower()
public Param<String> linkPredictionCol()
public String getLinkPredictionCol()
public boolean hasLinkPredictionCol()
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.public Param<String> labelCol()
public String getLabelCol()
public Param<String> featuresCol()
public String getFeaturesCol()
public Param<String> predictionCol()
public String getPredictionCol()