public abstract class Predictor<FeaturesType,Learner extends Predictor<FeaturesType,Learner,M>,M extends PredictionModel<FeaturesType,M>> extends Estimator<M>
| Constructor and Description |
|---|
Predictor() |
| Modifier and Type | Method and Description |
|---|---|
abstract Learner |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
protected RDD<LabeledPoint> |
extractLabeledPoints(DataFrame dataset)
Extract
labelCol and featuresCol from the given dataset,
and put it in an RDD with strong types. |
Param<java.lang.String> |
featuresCol()
Param for features column name.
|
M |
fit(DataFrame dataset)
Fits a model to the input data.
|
java.lang.String |
getFeaturesCol() |
java.lang.String |
getLabelCol() |
java.lang.String |
getPredictionCol() |
Param<java.lang.String> |
labelCol()
Param for label column name.
|
Param<java.lang.String> |
predictionCol()
Param for prediction column name.
|
Learner |
setFeaturesCol(java.lang.String value) |
Learner |
setLabelCol(java.lang.String value) |
Learner |
setPredictionCol(java.lang.String value) |
protected abstract M |
train(DataFrame dataset)
Train a model using the given dataset and parameters.
|
StructType |
transformSchema(StructType schema)
:: DeveloperApi ::
|
StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType)
Validates and transforms the input schema with the provided param map.
|
transformSchemaclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn, validateParamstoString, uidinitializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarningpublic Learner setLabelCol(java.lang.String value)
public Learner setFeaturesCol(java.lang.String value)
public Learner setPredictionCol(java.lang.String value)
public M fit(DataFrame dataset)
Estimatorfit in class Estimator<M extends PredictionModel<FeaturesType,M>>dataset - (undocumented)public abstract Learner copy(ParamMap extra)
Paramscopy in interface Paramscopy in class Estimator<M extends PredictionModel<FeaturesType,M>>extra - (undocumented)defaultCopy()protected abstract M train(DataFrame dataset)
fit() to avoid dealing with schema validation
and copying parameters into the model.
dataset - Training datasetpublic StructType transformSchema(StructType schema)
PipelineStageDerives the output schema from the input schema.
transformSchema in class PipelineStageschema - (undocumented)protected RDD<LabeledPoint> extractLabeledPoints(DataFrame dataset)
labelCol and featuresCol from the given dataset,
and put it in an RDD with strong types.dataset - (undocumented)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<java.lang.String> labelCol()
public java.lang.String getLabelCol()
public Param<java.lang.String> featuresCol()
public java.lang.String getFeaturesCol()
public Param<java.lang.String> predictionCol()
public java.lang.String getPredictionCol()