# `Latu.ML.Clustering.GaussianMixtureModel`
[🔗](https://github.com/zero-one-group/latu_ml/blob/v0.4.2/lib/latu/ml/clustering.ex#L0)

Attributes of a fitted `GaussianMixtureModel`.

Every accessor here is one name on the server's allowlist for
`org.apache.spark.ml.clustering.GaussianMixtureModel` — 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.GaussianMixtureModel`,
`org.apache.spark.ml.util.HasTrainingSummary`, `org.apache.spark.ml.util.Identifiable`.

# `class`

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

The JVM class these accessors belong to.

# `gaussians_df`

```elixir
@spec gaussians_df(Latu.ML.Model.t()) :: Latu.DataFrame.t()
```

Retrieve Gaussian distributions as a DataFrame. Each row represents a Gaussian Distribution.
The DataFrame has two columns: mean (Vector) and cov (Matrix).

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

# `has_summary`

```elixir
@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.

# `num_features`

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

Number of features, i.e., length of Vectors which this transforms.

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`

```elixir
@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

  * `value` — a Spark `Vector`: an `Nx.Tensor` or a `Latu.ML.SparseVector`

# `predict_probability`

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

Predict probability 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

  * `value` — a Spark `Vector`: an `Nx.Tensor` or a `Latu.ML.SparseVector`

# `summary`

```elixir
@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.

# `weights`

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

Weight for each Gaussian distribution in the mixture. This is a multinomial probability
distribution over the k Gaussians, where weights[i] is the weight for Gaussian i, and
weights sum to 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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
