Latu.ML.Clustering.LocalLDAModel (latu_ml v0.2.0)

Copy Markdown View Source

Attributes of a fitted LocalLDAModel.

Every accessor here is one name on the server's allowlist for org.apache.spark.ml.clustering.LocalLDAModel — 7 of them — so tab completion is that allowlist. The server refuses anything else with CONNECT_ML.ATTRIBUTE_NOT_ALLOWED; these refuse a model of the wrong class before it gets that far, and name the module that would have taken it.

Allowed by the server but not here: toString is Identifiable's, and tells you less than the model's own uid. Latu.ML.attribute/2 and Latu.ML.attribute/3 will send any of these names; it is what comes back that has nowhere to go.

The allowlist is inherited rather than per class: this one is the union of org.apache.spark.ml.clustering.LDAModel, org.apache.spark.ml.util.Identifiable.

Summary

Functions

The JVM class these accessors belong to.

Return the topics described by their top-weighted terms.

Value for LDA.docConcentration estimated from data. If Online LDA was used and LDA.optimizeDocConcentration was set to false, then this returns the fixed (given) value for the LDA.docConcentration parameter.

Indicates whether this instance is of type DistributedLDAModel.

Calculates a lower bound on the log likelihood of the entire corpus. See Equation (16) in the Online LDA paper (Hoffman et al., 2010).

Calculate an upper bound on perplexity. (Lower is better.) See Equation (16) in the Online LDA paper (Hoffman et al., 2010).

Inferred topics, where each topic is represented by a distribution over terms. This is a matrix of size vocabSize x k, where each column is a topic. No guarantees are given about the ordering of the topics.

Vocabulary size (number of terms or words in the vocabulary)

Functions

class()

@spec class() :: String.t()

The JVM class these accessors belong to.

describe_topics(holder, max_terms_per_topic)

@spec describe_topics(Latu.ML.Model.t(), integer()) :: Latu.DataFrame.t()

Return the topics described by their top-weighted terms.

A lazy builder: the Fetch rides a relation, so this hands back a Latu.DataFrame and nothing has run until you collect it.

Arguments

  • max_terms_per_topic — an integer

estimated_doc_concentration(holder)

@spec estimated_doc_concentration(Latu.ML.Model.t()) ::
  {:ok, term()} | {:error, Latu.Error.t()}

Value for LDA.docConcentration estimated from data. If Online LDA was used and LDA.optimizeDocConcentration was set to false, then this returns the fixed (given) value for the LDA.docConcentration parameter.

An action: it reaches the server. A Vector or Matrix comes back as an Nx.Tensor, or a Latu.ML.SparseVector where densifying would be this package's decision rather than yours.

is_distributed(holder)

@spec is_distributed(Latu.ML.Model.t()) :: {:ok, term()} | {:error, Latu.Error.t()}

Indicates whether this instance is of type DistributedLDAModel.

An action: it reaches the server. A Vector or Matrix comes back as an Nx.Tensor, or a Latu.ML.SparseVector where densifying would be this package's decision rather than yours.

log_likelihood(holder, dataset)

@spec log_likelihood(Latu.ML.Model.t(), Latu.DataFrame.t()) ::
  {:ok, term()} | {:error, Latu.Error.t()}

Calculates a lower bound on the log likelihood of the entire corpus. See Equation (16) in the Online LDA paper (Hoffman et al., 2010).

An action: it reaches the server. A Vector or Matrix comes back as an Nx.Tensor, or a Latu.ML.SparseVector where densifying would be this package's decision rather than yours.

Arguments

  • dataset — a Latu.DataFrame, sent as a relation rather than a literal

log_perplexity(holder, dataset)

@spec log_perplexity(Latu.ML.Model.t(), Latu.DataFrame.t()) ::
  {:ok, term()} | {:error, Latu.Error.t()}

Calculate an upper bound on perplexity. (Lower is better.) See Equation (16) in the Online LDA paper (Hoffman et al., 2010).

An action: it reaches the server. A Vector or Matrix comes back as an Nx.Tensor, or a Latu.ML.SparseVector where densifying would be this package's decision rather than yours.

Arguments

  • dataset — a Latu.DataFrame, sent as a relation rather than a literal

topics_matrix(holder)

@spec topics_matrix(Latu.ML.Model.t()) :: {:ok, term()} | {:error, Latu.Error.t()}

Inferred topics, where each topic is represented by a distribution over terms. This is a matrix of size vocabSize x k, where each column is a topic. No guarantees are given about the ordering of the topics.

An action: it reaches the server. A Vector or Matrix comes back as an Nx.Tensor, or a Latu.ML.SparseVector where densifying would be this package's decision rather than yours.

vocab_size(holder)

@spec vocab_size(Latu.ML.Model.t()) :: {:ok, term()} | {:error, Latu.Error.t()}

Vocabulary size (number of terms or words in the vocabulary)

An action: it reaches the server. A Vector or Matrix comes back as an Nx.Tensor, or a Latu.ML.SparseVector where densifying would be this package's decision rather than yours.