private static Action <LatentDirichletAllocationTransformer.LdaSummary> Wrap(LatentDirichletAllocationFitResult.OnFit onFit) { if (onFit == null) { return(null); } return(ldaTopicSummary => onFit(new LatentDirichletAllocationFitResult(ldaTopicSummary))); }
/// <include file='../Microsoft.ML.Transforms/Text/doc.xml' path='doc/members/member[@name="LightLDA"]/*' /> /// <param name="input">A vector of floats representing the document.</param> /// <param name="numberOfTopics">The number of topics.</param> /// <param name="alphaSum">Dirichlet prior on document-topic vectors.</param> /// <param name="beta">Dirichlet prior on vocab-topic vectors.</param> /// <param name="samplingStepCount">Number of Metropolis Hasting step.</param> /// <param name="maximumNumberOfIterations">Number of iterations.</param> /// <param name="likelihoodInterval">Compute log likelihood over local dataset on this iteration interval.</param> /// <param name="numberOfThreads">The number of training threads. Default value depends on number of logical processors.</param> /// <param name="maximumTokenCountPerDocument">The threshold of maximum count of tokens per doc.</param> /// <param name="numberOfSummaryTermsPerTopic">The number of words to summarize the topic.</param> /// <param name="numberOfBurninIterations">The number of burn-in iterations.</param> /// <param name="resetRandomGenerator">Reset the random number generator for each document.</param> /// <param name="onFit">Called upon fitting with the learnt enumeration on the dataset.</param> public static Vector <float> LatentDirichletAllocation(this Vector <float> input, int numberOfTopics = LatentDirichletAllocationEstimator.Defaults.NumberOfTopics, Single alphaSum = LatentDirichletAllocationEstimator.Defaults.AlphaSum, Single beta = LatentDirichletAllocationEstimator.Defaults.Beta, int samplingStepCount = LatentDirichletAllocationEstimator.Defaults.SamplingStepCount, int maximumNumberOfIterations = LatentDirichletAllocationEstimator.Defaults.MaximumNumberOfIterations, int likelihoodInterval = LatentDirichletAllocationEstimator.Defaults.LikelihoodInterval, int numberOfThreads = LatentDirichletAllocationEstimator.Defaults.NumberOfThreads, int maximumTokenCountPerDocument = LatentDirichletAllocationEstimator.Defaults.MaximumTokenCountPerDocument, int numberOfSummaryTermsPerTopic = LatentDirichletAllocationEstimator.Defaults.NumberOfSummaryTermsPerTopic, int numberOfBurninIterations = LatentDirichletAllocationEstimator.Defaults.NumberOfBurninIterations, bool resetRandomGenerator = LatentDirichletAllocationEstimator.Defaults.ResetRandomGenerator, LatentDirichletAllocationFitResult.OnFit onFit = null) { Contracts.CheckValue(input, nameof(input)); return(new ImplVector(input, new Config(numberOfTopics, alphaSum, beta, samplingStepCount, maximumNumberOfIterations, likelihoodInterval, numberOfThreads, maximumTokenCountPerDocument, numberOfSummaryTermsPerTopic, numberOfBurninIterations, resetRandomGenerator, Wrap(onFit)))); }