Package org.apache.spark.ml.param
Interface Params
- All Superinterfaces:
Identifiable
,Serializable
- All Known Subinterfaces:
AFTSurvivalRegressionParams
,ALSModelParams
,ALSParams
,BisectingKMeansParams
,BucketedRandomProjectionLSHParams
,ClassifierParams
,CountVectorizerParams
,CrossValidatorParams
,DecisionTreeClassifierParams
,DecisionTreeParams
,DecisionTreeRegressorParams
,FactorizationMachines
,FactorizationMachinesParams
,FMClassifierParams
,FMRegressorParams
,FPGrowthParams
,GaussianMixtureParams
,GBTClassifierParams
,GBTParams
,GBTRegressorParams
,GeneralizedLinearRegressionBase
,HasAggregationDepth
,HasBlockSize
,HasCheckpointInterval
,HasCollectSubModels
,HasDistanceMeasure
,HasElasticNetParam
,HasFeaturesCol
,HasFitIntercept
,HasHandleInvalid
,HasInputCol
,HasInputCols
,HasLabelCol
,HasLoss
,HasMaxBlockSizeInMB
,HasMaxIter
,HasNumFeatures
,HasOutputCol
,HasOutputCols
,HasParallelism
,HasPredictionCol
,HasProbabilityCol
,HasRawPredictionCol
,HasRegParam
,HasRelativeError
,HasSeed
,HasSolver
,HasStandardization
,HasStepSize
,HasThreshold
,HasThresholds
,HasTol
,HasValidationIndicatorCol
,HasVarianceCol
,HasVarianceImpurity
,HasWeightCol
,IDFBase
,ImputerParams
,IsotonicRegressionBase
,KMeansParams
,LDAParams
,LinearRegressionParams
,LinearSVCParams
,LogisticRegressionParams
,LSHParams
,MaxAbsScalerParams
,MinMaxScalerParams
,MultilayerPerceptronParams
,NaiveBayesParams
,OneHotEncoderBase
,OneVsRestParams
,PCAParams
,PowerIterationClusteringParams
,PredictorParams
,ProbabilisticClassifierParams
,QuantileDiscretizerBase
,RandomForestClassifierParams
,RandomForestParams
,RandomForestRegressorParams
,RFormulaBase
,RobustScalerParams
,SelectorParams
,StandardScalerParams
,StringIndexerBase
,TrainValidationSplitParams
,TreeClassifierParams
,TreeEnsembleClassifierParams
,TreeEnsembleParams
,TreeEnsembleRegressorParams
,TreeRegressorParams
,UnivariateFeatureSelectorParams
,ValidatorParams
,VarianceThresholdSelectorParams
,VectorIndexerParams
,Word2VecBase
- All Known Implementing Classes:
AFTSurvivalRegression
,AFTSurvivalRegressionModel
,ALS
,ALSModel
,Binarizer
,BinaryClassificationEvaluator
,BisectingKMeans
,BisectingKMeansModel
,BucketedRandomProjectionLSH
,BucketedRandomProjectionLSHModel
,Bucketizer
,ChiSqSelector
,ChiSqSelectorModel
,ClassificationModel
,Classifier
,ClusteringEvaluator
,ColumnPruner
,CountVectorizer
,CountVectorizerModel
,CrossValidator
,CrossValidatorModel
,DCT
,DecisionTreeClassificationModel
,DecisionTreeClassifier
,DecisionTreeRegressionModel
,DecisionTreeRegressor
,DistributedLDAModel
,ElementwiseProduct
,Estimator
,Evaluator
,FeatureHasher
,FMClassificationModel
,FMClassifier
,FMRegressionModel
,FMRegressor
,FPGrowth
,FPGrowthModel
,GaussianMixture
,GaussianMixtureModel
,GBTClassificationModel
,GBTClassifier
,GBTRegressionModel
,GBTRegressor
,GeneralizedLinearRegression
,GeneralizedLinearRegressionModel
,HashingTF
,IDF
,IDFModel
,Imputer
,ImputerModel
,IndexToString
,Interaction
,IsotonicRegression
,IsotonicRegressionModel
,JavaParams
,KMeans
,KMeansModel
,LDA
,LDAModel
,LinearRegression
,LinearRegressionModel
,LinearSVC
,LinearSVCModel
,LocalLDAModel
,LogisticRegression
,LogisticRegressionModel
,MaxAbsScaler
,MaxAbsScalerModel
,MinHashLSH
,MinHashLSHModel
,MinMaxScaler
,MinMaxScalerModel
,Model
,MulticlassClassificationEvaluator
,MultilabelClassificationEvaluator
,MultilayerPerceptronClassificationModel
,MultilayerPerceptronClassifier
,NaiveBayes
,NaiveBayesModel
,NGram
,Normalizer
,OneHotEncoder
,OneHotEncoderModel
,OneVsRest
,OneVsRestModel
,PCA
,PCAModel
,Pipeline
,PipelineModel
,PipelineStage
,PolynomialExpansion
,PowerIterationClustering
,PredictionModel
,Predictor
,PrefixSpan
,ProbabilisticClassificationModel
,ProbabilisticClassifier
,QuantileDiscretizer
,RandomForestClassificationModel
,RandomForestClassifier
,RandomForestRegressionModel
,RandomForestRegressor
,RankingEvaluator
,RegexTokenizer
,RegressionEvaluator
,RegressionModel
,Regressor
,RFormula
,RFormulaModel
,RobustScaler
,RobustScalerModel
,SQLTransformer
,StandardScaler
,StandardScalerModel
,StopWordsRemover
,StringIndexer
,StringIndexerModel
,Tokenizer
,TrainValidationSplit
,TrainValidationSplitModel
,Transformer
,UnaryTransformer
,UnivariateFeatureSelector
,UnivariateFeatureSelectorModel
,VarianceThresholdSelector
,VarianceThresholdSelectorModel
,VectorAssembler
,VectorAttributeRewriter
,VectorIndexer
,VectorIndexerModel
,VectorSizeHint
,VectorSlicer
,Word2Vec
,Word2VecModel
Trait for components that take parameters. This also provides an internal param map to store
parameter values attached to the instance.
-
Method Summary
Modifier and TypeMethodDescriptionClears the user-supplied value for the input param.Creates a copy of this instance with the same UID and some extra params.<T extends Params>
TcopyValues
(T to, ParamMap extra) Copies param values from this instance to another instance for params shared by them.<T extends Params>
TdefaultCopy
(ParamMap extra) Default implementation of copy with extra params.Internal param map for default values.explainParam
(Param<?> param) Explains a param.Explains all params of this instance.extractParamMap
with no extra values.extractParamMap
(ParamMap extra) Extracts the embedded default param values and user-supplied values, and then merges them with extra values from input into a flat param map, where the latter value is used if there exist conflicts, i.e., with ordering: default param values less than user-supplied values less than extra.<T> scala.Option<T>
Optionally returns the user-supplied value of a param.<T> scala.Option<T>
getDefault
(Param<T> param) Gets the default value of a parameter.<T> T
getOrDefault
(Param<T> param) Gets the value of a param in the embedded param map or its default value.Gets a param by its name.<T> boolean
hasDefault
(Param<T> param) Tests whether the input param has a default value set.boolean
Tests whether this instance contains a param with a given name.boolean
Checks whether a param is explicitly set or has a default value.boolean
Checks whether a param is explicitly set.void
onParamChange
(Param<?> param) paramMap()
Internal param map for user-supplied values.Param<?>[]
params()
Returns all params sorted by their names.Sets a parameter (by name) in the embedded param map.<T> Params
Sets a parameter in the embedded param map.Sets a parameter in the embedded param map.<T> Params
setDefault
(Param<T> param, T value) Sets a default value for a param.setDefault
(scala.collection.immutable.Seq<ParamPair<?>> paramPairs) Sets default values for a list of params.void
Validates that the input param belongs to this instance.Methods inherited from interface org.apache.spark.ml.util.Identifiable
toString, uid
-
Method Details
-
clear
Clears the user-supplied value for the input param.- Parameters:
param
- (undocumented)- Returns:
- (undocumented)
-
copy
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. SeedefaultCopy()
.- Parameters:
extra
- (undocumented)- Returns:
- (undocumented)
-
copyValues
Copies param values from this instance to another instance for params shared by them.This handles default Params and explicitly set Params separately. Default Params are copied from and to
defaultParamMap
, and explicitly set Params are copied from and toparamMap
. Warning: This implicitly assumes that thisParams
instance and the target instance share the same set of default Params.- Parameters:
to
- the target instance, which should work with the same set of default Params as this source instanceextra
- extra params to be copied to the target'sparamMap
- Returns:
- the target instance with param values copied
-
defaultCopy
Default implementation of copy with extra params. It tries to create a new instance with the same UID. Then it copies the embedded and extra parameters over and returns the new instance.- Parameters:
extra
- (undocumented)- Returns:
- (undocumented)
-
defaultParamMap
ParamMap defaultParamMap()Internal param map for default values. -
explainParam
Explains a param.- Parameters:
param
- input param, must belong to this instance.- Returns:
- a string that contains the input param name, doc, and optionally its default value and the user-supplied value
-
explainParams
String explainParams()Explains all params of this instance. SeeexplainParam()
.- Returns:
- (undocumented)
-
extractParamMap
Extracts the embedded default param values and user-supplied values, and then merges them with extra values from input into a flat param map, where the latter value is used if there exist conflicts, i.e., with ordering: default param values less than user-supplied values less than extra.- Parameters:
extra
- (undocumented)- Returns:
- (undocumented)
-
extractParamMap
ParamMap extractParamMap()extractParamMap
with no extra values.- Returns:
- (undocumented)
-
get
Optionally returns the user-supplied value of a param.- Parameters:
param
- (undocumented)- Returns:
- (undocumented)
-
getDefault
Gets the default value of a parameter.- Parameters:
param
- (undocumented)- Returns:
- (undocumented)
-
getOrDefault
Gets the value of a param in the embedded param map or its default value. Throws an exception if neither is set.- Parameters:
param
- (undocumented)- Returns:
- (undocumented)
-
getParam
Gets a param by its name. -
hasDefault
Tests whether the input param has a default value set.- Parameters:
param
- (undocumented)- Returns:
- (undocumented)
-
hasParam
Tests whether this instance contains a param with a given name. -
isDefined
Checks whether a param is explicitly set or has a default value. -
isSet
Checks whether a param is explicitly set. -
onParamChange
-
paramMap
ParamMap paramMap()Internal param map for user-supplied values. -
params
Param<?>[] params()Returns all params sorted by their names. The default implementation uses Java reflection to list all public methods that have no arguments and returnParam
.- Returns:
- (undocumented)
- Note:
- Developer should not use this method in constructor because we cannot guarantee that this variable gets initialized before other params.
-
set
Sets a parameter in the embedded param map.- Parameters:
param
- (undocumented)value
- (undocumented)- Returns:
- (undocumented)
-
set
Sets a parameter (by name) in the embedded param map.- Parameters:
param
- (undocumented)value
- (undocumented)- Returns:
- (undocumented)
-
set
Sets a parameter in the embedded param map.- Parameters:
paramPair
- (undocumented)- Returns:
- (undocumented)
-
setDefault
Sets a default value for a param.- Parameters:
param
- param to set the default value. Make sure that this param is initialized before this method gets called.value
- the default value- Returns:
- (undocumented)
-
setDefault
Sets default values for a list of params.Note: Java developers should use the single-parameter
setDefault
. Annotating this with varargs can cause compilation failures due to a Scala compiler bug. See SPARK-9268.- Parameters:
paramPairs
- a list of param pairs that specify params and their default values to set respectively. Make sure that the params are initialized before this method gets called.- Returns:
- (undocumented)
-
shouldOwn
Validates that the input param belongs to this instance.
-