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

Attributes of a fitted `Word2VecModel`.

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

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

# `class`

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

The JVM class these accessors belong to.

# `find_synonyms`

```elixir
@spec find_synonyms(
  Latu.ML.Model.t(),
  (String.t() | atom()) | Nx.Tensor.t() | Latu.ML.SparseVector.t(),
  integer()
) :: Latu.DataFrame.t()
```

Find "num" number of words closest in similarity to "word". word can be a string or vector
representation. Returns a dataframe with two fields word and similarity (which gives the
cosine similarity).

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

## Arguments

  * `word` — either a string or a Spark `Vector` — the value decides which
  * `num` — an integer

# `get_vectors`

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

Returns the vector representation of the words as a dataframe with two fields, word and
vector.

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

---

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