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

Copy Markdown View Source

Attributes of a KMeansSummary — what an estimator recorded while it fitted. Latu.ML.summary/1 is what hands you one.

Every accessor here is one name on the server's allowlist for org.apache.spark.ml.clustering.KMeansSummary — 8 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.

Every allowlisted attribute of this class has a function here.

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

Summary

Functions

The JVM class these accessors belong to.

DataFrame of predicted cluster centers for each training data point.

Size of (number of data points in) each cluster.

Name for column of features in predictions.

The number of clusters the model was trained with.

Number of iterations.

Name for column of predicted clusters in predictions.

DataFrame produced by the model's transform method.

K-means cost (sum of squared distances to the nearest centroid for all points in the training dataset). This is equivalent to sklearn's inertia.

Functions

class()

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

The JVM class these accessors belong to.

cluster(holder)

@spec cluster(Latu.ML.Summary.t()) :: Latu.DataFrame.t()

DataFrame of predicted cluster centers for each training data point.

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

cluster_sizes(holder)

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

Size of (number of data points in) each cluster.

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.

features_col(holder)

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

Name for column of features in predictions.

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.

k(holder)

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

The number of clusters the model was trained with.

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.

num_iter(holder)

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

Number of iterations.

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.

prediction_col(holder)

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

Name for column of predicted clusters in predictions.

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.

predictions(holder)

@spec predictions(Latu.ML.Summary.t()) :: Latu.DataFrame.t()

DataFrame produced by the model's transform method.

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

training_cost(holder)

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

K-means cost (sum of squared distances to the nearest centroid for all points in the training dataset). This is equivalent to sklearn's inertia.

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.