Latu.ML.Feature.StringIndexerModel (latu_ml v0.2.0)

Copy Markdown View Source

Attributes of a fitted StringIndexerModel.

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

This model does not have to be fitted: from_labels/3, from_arrays_of_labels/3 builds one on the server out of what you pass, through its own helper method. That is a cache entry like a fit's, and yours to give back.

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

Summary

Functions

The JVM class these accessors belong to.

Construct the model directly from an array of array of label strings, requires an active SparkContext. The server builds it and registers it, so what comes back is a cache reference like a fit's and is yours to Latu.ML.delete/1. The uid is generated here and sent with the call. opts are params set on the model afterwards, checked against its own table. Built by stringIndexerModelFromLabelsArray on the server's helper object, from StringIndexerModel.from_arrays_of_labels.

Construct the model directly from an array of label strings, requires an active SparkContext. The server builds it and registers it, so what comes back is a cache reference like a fit's and is yours to Latu.ML.delete/1. The uid is generated here and sent with the call. opts are params set on the model afterwards, checked against its own table. Built by stringIndexerModelFromLabels on the server's helper object, from StringIndexerModel.from_labels.

Ordered list of labels, corresponding to indices to be assigned.

Array of ordered list of labels, corresponding to indices to be assigned for each input column.

Functions

class()

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

The JVM class these accessors belong to.

from_arrays_of_labels(session, array_of_labels, opts \\ [])

@spec from_arrays_of_labels(Latu.Session.t(), [[String.t() | atom()]], keyword()) ::
  {:ok, Latu.ML.Model.t()} | {:error, Latu.Error.t()}

Construct the model directly from an array of array of label strings, requires an active SparkContext. The server builds it and registers it, so what comes back is a cache reference like a fit's and is yours to Latu.ML.delete/1. The uid is generated here and sent with the call. opts are params set on the model afterwards, checked against its own table. Built by stringIndexerModelFromLabelsArray on the server's helper object, from StringIndexerModel.from_arrays_of_labels.

from_labels(session, labels, opts \\ [])

@spec from_labels(Latu.Session.t(), [String.t() | atom()], keyword()) ::
  {:ok, Latu.ML.Model.t()} | {:error, Latu.Error.t()}

Construct the model directly from an array of label strings, requires an active SparkContext. The server builds it and registers it, so what comes back is a cache reference like a fit's and is yours to Latu.ML.delete/1. The uid is generated here and sent with the call. opts are params set on the model afterwards, checked against its own table. Built by stringIndexerModelFromLabels on the server's helper object, from StringIndexerModel.from_labels.

labels(holder)

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

Ordered list of labels, corresponding to indices to be assigned.

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.

labels_array(holder)

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

Array of ordered list of labels, corresponding to indices to be assigned for each input column.

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.