public class RFormulaModel extends Model<RFormulaModel> implements RFormulaBase, MLWritable
RFormula. Fitting is required to determine the factor levels of
formula terms.
param: resolvedFormula the fitted R formula. param: pipelineModel the fitted feature model, including factor to index mappings.
| Modifier and Type | Method and Description |
|---|---|
RFormulaModel |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
Param<String> |
featuresCol()
Param for features column name.
|
BooleanParam |
forceIndexLabel()
Force to index label whether it is numeric or string type.
|
Param<String> |
formula()
R formula parameter.
|
Param<String> |
handleInvalid()
Param for how to handle invalid data (unseen or NULL values) in features and label column
of string type.
|
Param<String> |
labelCol()
Param for label column name.
|
static RFormulaModel |
load(String path) |
static MLReader<RFormulaModel> |
read() |
Param<String> |
stringIndexerOrderType()
Param for how to order categories of a string FEATURE column used by
StringIndexer. |
String |
toString() |
Dataset<Row> |
transform(Dataset<?> dataset)
Transforms the input dataset.
|
StructType |
transformSchema(StructType schema)
Check transform validity and derive the output schema from the input schema.
|
String |
uid()
An immutable unique ID for the object and its derivatives.
|
MLWriter |
write()
Returns an
MLWriter instance for this ML instance. |
transform, transform, transformparamsgetForceIndexLabel, getFormula, getStringIndexerOrderType, hasLabelColgetFeaturesColgetLabelColgetHandleInvalidclear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwnsave$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<RFormulaModel> read()
public static RFormulaModel load(String path)
public Param<String> formula()
RFormulaBaseformula in interface RFormulaBasepublic BooleanParam forceIndexLabel()
RFormulaBaseforceIndexLabel in interface RFormulaBasepublic Param<String> handleInvalid()
RFormulaBasehandleInvalid in interface RFormulaBasehandleInvalid in interface HasHandleInvalidpublic final Param<String> stringIndexerOrderType()
RFormulaBaseStringIndexer.
The last category after ordering is dropped when encoding strings.
Supported options: 'frequencyDesc', 'frequencyAsc', 'alphabetDesc', 'alphabetAsc'.
The default value is 'frequencyDesc'. When the ordering is set to 'alphabetDesc', RFormula
drops the same category as R when encoding strings.
The options are explained using an example 'b', 'a', 'b', 'a', 'c', 'b':
+-----------------+---------------------------------------+----------------------------------+
| Option | Category mapped to 0 by StringIndexer | Category dropped by RFormula |
+-----------------+---------------------------------------+----------------------------------+
| 'frequencyDesc' | most frequent category ('b') | least frequent category ('c') |
| 'frequencyAsc' | least frequent category ('c') | most frequent category ('b') |
| 'alphabetDesc' | last alphabetical category ('c') | first alphabetical category ('a')|
| 'alphabetAsc' | first alphabetical category ('a') | last alphabetical category ('c') |
+-----------------+---------------------------------------+----------------------------------+
Note that this ordering option is NOT used for the label column. When the label column is
indexed, it uses the default descending frequency ordering in StringIndexer.
stringIndexerOrderType in interface RFormulaBasepublic final Param<String> labelCol()
HasLabelCollabelCol in interface HasLabelColpublic final Param<String> featuresCol()
HasFeaturesColfeaturesCol in interface HasFeaturesColpublic String uid()
Identifiableuid in interface Identifiablepublic Dataset<Row> transform(Dataset<?> dataset)
Transformertransform in class Transformerdataset - (undocumented)public StructType transformSchema(StructType schema)
PipelineStage
We check validity for interactions between parameters during transformSchema and
raise an exception if any parameter value is invalid. Parameter value checks which
do not depend on other parameters are handled by Param.validate().
Typical implementation should first conduct verification on schema change and parameter validity, including complex parameter interaction checks.
transformSchema in class PipelineStageschema - (undocumented)public RFormulaModel copy(ParamMap extra)
ParamsdefaultCopy().copy in interface Paramscopy in class Model<RFormulaModel>extra - (undocumented)public String toString()
toString in interface IdentifiabletoString in class Objectpublic MLWriter write()
MLWritableMLWriter instance for this ML instance.write in interface MLWritable