Latu.ML.Classification.LogisticRegressionModel (latu_ml v0.2.0)

Copy Markdown View Source

Attributes of a fitted LogisticRegressionModel.

Every accessor here is one name on the server's allowlist for org.apache.spark.ml.classification.LogisticRegressionModel — 11 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; evaluate answers with a training summary, which has no struct yet. 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.PredictionModel, org.apache.spark.ml.classification.ClassificationModel, org.apache.spark.ml.classification.LogisticRegressionModel, org.apache.spark.ml.classification.ProbabilisticClassificationModel, org.apache.spark.ml.util.HasTrainingSummary, org.apache.spark.ml.util.Identifiable.

Summary

Functions

The JVM class these accessors belong to.

Model coefficients.

Model coefficients of binomial logistic regression. An exception is thrown in the case of multinomial logistic regression.

Indicates whether a training summary exists for this model instance.

Model intercept of binomial logistic regression. An exception is thrown in the case of multinomial logistic regression.

Model intercept.

Number of classes (values which the label can take).

Returns the number of features the model was trained on. If unknown, returns -1.

Predict label for the given features.

Predict the probability of each class given the features.

Raw prediction for each possible label.

Gets summary of the model trained on the training set. An exception is thrown if no summary exists.

Functions

class()

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

The JVM class these accessors belong to.

coefficient_matrix(holder)

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

Model coefficients.

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.

coefficients(holder)

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

Model coefficients of binomial logistic regression. An exception is thrown in the case of multinomial logistic regression.

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.

has_summary(holder)

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

Indicates whether a training summary exists for this model instance.

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.

intercept(holder)

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

Model intercept of binomial logistic regression. An exception is thrown in the case of multinomial logistic regression.

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.

intercept_vector(holder)

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

Model intercept.

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_classes(holder)

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

Number of classes (values which the label can take).

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_features(holder)

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

Returns the number of features the model was trained on. If unknown, returns -1.

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.

predict(holder, value)

@spec predict(Latu.ML.Model.t(), Nx.Tensor.t() | Latu.ML.SparseVector.t()) ::
  {:ok, term()} | {:error, Latu.Error.t()}

Predict label for the given features.

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

predict_probability(holder, value)

@spec predict_probability(Latu.ML.Model.t(), Nx.Tensor.t() | Latu.ML.SparseVector.t()) ::
  {:ok, term()} | {:error, Latu.Error.t()}

Predict the probability of each class given the features.

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

predict_raw(holder, value)

@spec predict_raw(Latu.ML.Model.t(), Nx.Tensor.t() | Latu.ML.SparseVector.t()) ::
  {:ok, term()} | {:error, Latu.Error.t()}

Raw prediction for each possible label.

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

summary(model)

@spec summary(Latu.ML.Model.t()) :: Latu.ML.Summary.t()

Gets summary of the model trained on the training set. An exception is thrown if no summary exists.

A lazy builder: Spark reaches a summary through the model that owns it, so the reference is composed here and nothing is sent. Latu.ML.summary/1 is the same thing without the class check.