Interface LDAParams
- All Superinterfaces:
- HasCheckpointInterval,- HasFeaturesCol,- HasMaxIter,- HasSeed,- Identifiable,- Params,- Serializable
- All Known Implementing Classes:
- DistributedLDAModel,- LDA,- LDAModel,- LocalLDAModel
- 
Method SummaryModifier and TypeMethodDescriptionConcentration parameter (commonly named "alpha") for the prior placed on documents' distributions over topics ("theta").double[]intgetK()booleandoubledoubleGet docConcentration used by spark.mllib LDAdoubleGet topicConcentration used by spark.mllib LDAbooleandoubledoublek()Param for the number of topics (clusters) to infer.For EM optimizer only:optimizer()= "em".For Online optimizer only:optimizer()= "online".For Online optimizer only:optimizer()= "online".For Online optimizer only (currently):optimizer()= "online".Optimizer or inference algorithm used to estimate the LDA model.For Online optimizer only:optimizer()= "online".String[]Supported values for Paramoptimizer().Concentration parameter (commonly named "beta" or "eta") for the prior placed on topics' distributions over terms.Output column with estimates of the topic mixture distribution for each document (often called "theta" in the literature).validateAndTransformSchema(StructType schema) Validates and transforms the input schema.Methods inherited from interface org.apache.spark.ml.param.shared.HasCheckpointIntervalcheckpointInterval, getCheckpointIntervalMethods inherited from interface org.apache.spark.ml.param.shared.HasFeaturesColfeaturesCol, getFeaturesColMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxItergetMaxIter, maxIterMethods inherited from interface org.apache.spark.ml.util.IdentifiabletoString, uidMethods inherited from interface org.apache.spark.ml.param.Paramsclear, copy, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
- 
Method Details- 
kIntParam k()Param for the number of topics (clusters) to infer. Must be > 1. Default: 10.- Returns:
- (undocumented)
 
- 
getKint getK()
- 
docConcentrationDoubleArrayParam docConcentration()Concentration parameter (commonly named "alpha") for the prior placed on documents' distributions over topics ("theta").This is the parameter to a Dirichlet distribution, where larger values mean more smoothing (more regularization). If not set by the user, then docConcentration is set automatically. If set to singleton vector [alpha], then alpha is replicated to a vector of length k in fitting. Otherwise, the docConcentration()vector must be length k. (default = automatic)Optimizer-specific parameter settings: - EM - Currently only supports symmetric distributions, so all values in the vector should be the same. - Values should be greater than 1.0 - default = uniformly (50 / k) + 1, where 50/k is common in LDA libraries and +1 follows from Asuncion et al. (2009), who recommend a +1 adjustment for EM. - Online - Values should be greater than or equal to 0 - default = uniformly (1.0 / k), following the implementation from here. - Returns:
- (undocumented)
 
- 
getDocConcentrationdouble[] getDocConcentration()
- 
getOldDocConcentrationVector getOldDocConcentration()Get docConcentration used by spark.mllib LDA
- 
topicConcentrationDoubleParam topicConcentration()Concentration parameter (commonly named "beta" or "eta") for the prior placed on topics' distributions over terms.This is the parameter to a symmetric Dirichlet distribution. Note: The topics' distributions over terms are called "beta" in the original LDA paper by Blei et al., but are called "phi" in many later papers such as Asuncion et al., 2009. If not set by the user, then topicConcentration is set automatically. (default = automatic) Optimizer-specific parameter settings: - EM - Value should be greater than 1.0 - default = 0.1 + 1, where 0.1 gives a small amount of smoothing and +1 follows Asuncion et al. (2009), who recommend a +1 adjustment for EM. - Online - Value should be greater than or equal to 0 - default = (1.0 / k), following the implementation from here. - Returns:
- (undocumented)
 
- 
getTopicConcentrationdouble getTopicConcentration()
- 
getOldTopicConcentrationdouble getOldTopicConcentration()Get topicConcentration used by spark.mllib LDA
- 
supportedOptimizersString[] supportedOptimizers()Supported values for Paramoptimizer().
- 
optimizerOptimizer or inference algorithm used to estimate the LDA model. Currently supported (case-insensitive): - "online": Online Variational Bayes (default) - "em": Expectation-MaximizationFor details, see the following papers: - Online LDA: Hoffman, Blei and Bach. "Online Learning for Latent Dirichlet Allocation." Neural Information Processing Systems, 2010. See here - EM: Asuncion et al. "On Smoothing and Inference for Topic Models." Uncertainty in Artificial Intelligence, 2009. See here - Returns:
- (undocumented)
 
- 
getOptimizerString getOptimizer()
- 
topicDistributionColOutput column with estimates of the topic mixture distribution for each document (often called "theta" in the literature). Returns a vector of zeros for an empty document.This uses a variational approximation following Hoffman et al. (2010), where the approximate distribution is called "gamma." Technically, this method returns this approximation "gamma" for each document. - Returns:
- (undocumented)
 
- 
getTopicDistributionColString getTopicDistributionCol()
- 
learningOffsetDoubleParam learningOffset()For Online optimizer only:optimizer()= "online".A (positive) learning parameter that downweights early iterations. Larger values make early iterations count less. This is called "tau0" in the Online LDA paper (Hoffman et al., 2010) Default: 1024, following Hoffman et al. - Returns:
- (undocumented)
 
- 
getLearningOffsetdouble getLearningOffset()
- 
learningDecayDoubleParam learningDecay()For Online optimizer only:optimizer()= "online".Learning rate, set as an exponential decay rate. This should be between (0.5, 1.0] to guarantee asymptotic convergence. This is called "kappa" in the Online LDA paper (Hoffman et al., 2010). Default: 0.51, based on Hoffman et al. - Returns:
- (undocumented)
 
- 
getLearningDecaydouble getLearningDecay()
- 
subsamplingRateDoubleParam subsamplingRate()For Online optimizer only:optimizer()= "online".Fraction of the corpus to be sampled and used in each iteration of mini-batch gradient descent, in range (0, 1]. Note that this should be adjusted in synch with LDA.maxIterso the entire corpus is used. Specifically, set both so that maxIterations * miniBatchFraction greater than or equal to 1.Note: This is the same as the miniBatchFractionparameter inOnlineLDAOptimizer.Default: 0.05, i.e., 5% of total documents. - Returns:
- (undocumented)
 
- 
getSubsamplingRatedouble getSubsamplingRate()
- 
optimizeDocConcentrationBooleanParam optimizeDocConcentration()For Online optimizer only (currently):optimizer()= "online".Indicates whether the docConcentration (Dirichlet parameter for document-topic distribution) will be optimized during training. Setting this to true will make the model more expressive and fit the training data better. Default: false - Returns:
- (undocumented)
 
- 
getOptimizeDocConcentrationboolean getOptimizeDocConcentration()
- 
keepLastCheckpointBooleanParam keepLastCheckpoint()For EM optimizer only:optimizer()= "em".If using checkpointing, this indicates whether to keep the last checkpoint. If false, then the checkpoint will be deleted. Deleting the checkpoint can cause failures if a data partition is lost, so set this bit with care. Note that checkpoints will be cleaned up via reference counting, regardless. See DistributedLDAModel.getCheckpointFilesfor getting remaining checkpoints andDistributedLDAModel.deleteCheckpointFilesfor removing remaining checkpoints.Default: true - Returns:
- (undocumented)
 
- 
getKeepLastCheckpointboolean getKeepLastCheckpoint()
- 
validateAndTransformSchemaValidates and transforms the input schema.- Parameters:
- schema- input schema
- Returns:
- output schema
 
- 
getOldOptimizerLDAOptimizer getOldOptimizer()
 
-