org.apache.spark.ml.tuning
Class CrossValidator

Object
  extended by org.apache.spark.ml.PipelineStage
      extended by org.apache.spark.ml.Estimator<CrossValidatorModel>
          extended by org.apache.spark.ml.tuning.CrossValidator
All Implemented Interfaces:
java.io.Serializable, Logging, Params

public class CrossValidator
extends Estimator<CrossValidatorModel>
implements Logging

:: Experimental :: K-fold cross validation.

See Also:
Serialized Form

Constructor Summary
CrossValidator()
           
CrossValidator(String uid)
           
 
Method Summary
 CrossValidator copy(ParamMap extra)
          Creates a copy of this instance with the same UID and some extra params.
 Param<Estimator<?>> estimator()
          param for the estimator to be cross-validated
 Param<ParamMap[]> estimatorParamMaps()
          param for estimator param maps
 Param<Evaluator> evaluator()
          param for the evaluator used to select hyper-parameters that maximize the cross-validated metric
 CrossValidatorModel fit(DataFrame dataset)
          Fits a model to the input data.
 Estimator<?> getEstimator()
           
 ParamMap[] getEstimatorParamMaps()
           
 Evaluator getEvaluator()
           
 int getNumFolds()
           
 IntParam numFolds()
          Param for number of folds for cross validation.
 CrossValidator setEstimator(Estimator<?> value)
           
 CrossValidator setEstimatorParamMaps(ParamMap[] value)
           
 CrossValidator setEvaluator(Evaluator value)
           
 CrossValidator setNumFolds(int value)
           
 StructType transformSchema(StructType schema)
          :: DeveloperApi ::
 String uid()
           
 void validateParams()
          Validates parameter values stored internally.
 
Methods inherited from class org.apache.spark.ml.Estimator
fit, fit, fit, fit
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.spark.ml.param.Params
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, setDefault, shouldOwn
 
Methods inherited from interface org.apache.spark.Logging
initializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
 

Constructor Detail

CrossValidator

public CrossValidator(String uid)

CrossValidator

public CrossValidator()
Method Detail

uid

public String uid()

setEstimator

public CrossValidator setEstimator(Estimator<?> value)

setEstimatorParamMaps

public CrossValidator setEstimatorParamMaps(ParamMap[] value)

setEvaluator

public CrossValidator setEvaluator(Evaluator value)

setNumFolds

public CrossValidator setNumFolds(int value)

fit

public CrossValidatorModel fit(DataFrame dataset)
Description copied from class: Estimator
Fits a model to the input data.

Specified by:
fit in class Estimator<CrossValidatorModel>
Parameters:
dataset - (undocumented)
Returns:
(undocumented)

transformSchema

public StructType transformSchema(StructType schema)
Description copied from class: PipelineStage
:: DeveloperApi ::

Derives the output schema from the input schema.

Specified by:
transformSchema in class PipelineStage
Parameters:
schema - (undocumented)
Returns:
(undocumented)

validateParams

public void validateParams()
Description copied from interface: Params
Validates parameter values stored internally. Raise an exception if any parameter value is invalid.

This only needs to check for interactions between parameters. Parameter value checks which do not depend on other parameters are handled by Param.validate(). This method does not handle input/output column parameters; those are checked during schema validation.

Specified by:
validateParams in interface Params

copy

public CrossValidator copy(ParamMap extra)
Description copied from interface: Params
Creates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly.

Specified by:
copy in interface Params
Specified by:
copy in class Estimator<CrossValidatorModel>
Parameters:
extra - (undocumented)
Returns:
(undocumented)
See Also:
defaultCopy()

estimator

public Param<Estimator<?>> estimator()
param for the estimator to be cross-validated

Returns:
(undocumented)

getEstimator

public Estimator<?> getEstimator()

estimatorParamMaps

public Param<ParamMap[]> estimatorParamMaps()
param for estimator param maps

Returns:
(undocumented)

getEstimatorParamMaps

public ParamMap[] getEstimatorParamMaps()

evaluator

public Param<Evaluator> evaluator()
param for the evaluator used to select hyper-parameters that maximize the cross-validated metric

Returns:
(undocumented)

getEvaluator

public Evaluator getEvaluator()

numFolds

public IntParam numFolds()
Param for number of folds for cross validation. Must be >= 2. Default: 3

Returns:
(undocumented)

getNumFolds

public int getNumFolds()