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

Attributes of a fitted `GBTClassificationModel`.

Every accessor here is one name on the server's allowlist for
`org.apache.spark.ml.classification.GBTClassificationModel` — 13 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.PredictionModel`,
`org.apache.spark.ml.classification.ClassificationModel`,
`org.apache.spark.ml.classification.GBTClassificationModel`,
`org.apache.spark.ml.classification.ProbabilisticClassificationModel`,
`org.apache.spark.ml.tree.TreeEnsembleModel`, `org.apache.spark.ml.util.Identifiable`.

# `class`

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

The JVM class these accessors belong to.

# `evaluate_each_iteration`

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

Method to compute error or loss for every iteration of gradient boosting.

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

# `feature_importances`

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

Estimate of the importance of each feature.

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.

# `get_num_trees`

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

Number of trees in ensemble.

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`

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

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

```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_leaf`

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

Predict the indices of the leaves corresponding to the feature vector.

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

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

# `predict_raw`

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

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

# `to_debug_string`

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

Full description of model.

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.

# `total_num_nodes`

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

Total number of nodes, summed over all trees in the ensemble.

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.

# `tree_weights`

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

Return the weights for each tree.

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.

# `trees`

```elixir
@spec trees(Latu.ML.Model.t()) ::
  {:ok, [Latu.ML.Model.t()]} | {:error, Latu.Error.t()}
```

Trees in this ensemble. Warning: These have null parent Estimators.

An action, and it **spends cache**: the server registers every sub-model on its way out, so
this answers with a list of `Latu.ML.Model` — one `DecisionTreeRegressionModel` and one
cache entry per tree — and they are yours to give back. `Latu.ML.delete/1` takes the whole
list in one call.

---

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