Every hand-written verb in the package on one page. + ! marks one with a raising twin of the same arity; an arity list like /2,3 means a trailing keyword list or an optional argument.

The generated surface is not here and never will be: 68 constructors and 623 accessors are a reference, not a cheatsheet, and the registry is already that page — Latu.ML.operators/1, Latu.ML.params/1 and Latu.ML.attributes/1 answer it without a server, and h on any of them prints Spark's own prose.

test/latu/cheatsheet_test.exs fails if a verb below stops existing or a new one is not here.

The verbs

Called qualified, the way Latu is.

Fitting and applying

Latu.ML.fit/2Fit an estimator, a pipeline or a search. An action. + !
Latu.ML.transform/2Apply a transformer or a fitted model. Lazy — a Latu.DataFrame.
Latu.ML.evaluate/2Score a frame with an evaluator, answering with one number. + !
Latu.ML.with_model/3Fit, use, delete in an after. The bracket. + !
Latu.ML.pipeline/1Build a pipeline from a list of stages.

Reading a model

Latu.ML.attribute/2,3One allowlisted attribute as a value. An action. + !
Latu.ML.attribute_frame/2,3One that answers with a DataFrame. Lazy.
Latu.ML.summary/1The training summary object. Lazy; raises for a class that has none.
Latu.ML.attributes/1What a model, summary or class may be asked for.

Prefer the generated accessor — Latu.ML.Regression.LinearRegressionModel.coefficients/1 — which carries the class, the wire name and Spark's docs, and checks the class before the round trip.

The cache

Latu.ML.delete/1Release one model, or a mixed list of them, in one Delete. + !
Latu.ML.model_size/1What one entry costs, in bytes. + !
Latu.ML.cache_info/1Every entry this session holds. + !
Latu.ML.clean_cache/1Empty it, answering with how many it freed. + !

Persistence

Latu.ML.save/2,3Write to a path on the server, in Spark's own format. + !
Latu.ML.load/3,4Read one back. Names the class rather than discovering it. + !

Tuning

Latu.ML.param_grid/1,2A grid as data; each entry carries the uid it sets.
Latu.ML.cross_validator/1K-fold search. Needs :estimator, :param_maps, :evaluator.
Latu.ML.train_validation_split/1The same with one split.
Latu.ML.best_index/1Which param map won.
Latu.ML.larger_better?/1Whether an evaluator's metric is an argmax. Pure.

The registry

Latu.ML.operators/0,1Every operator; filter on kind:, group:, status:.
Latu.ML.operator/1One by name; a miss lists the near spellings. + !
Latu.ML.params/1An operator's param table, with types and defaults.
Latu.ML.helpers/0Every ConnectHelper method the server exposes.

Errors

Latu.ML.error_kind/1A CONNECT_ML error class as an atom, or nil.
Latu.ML.hint/1That kind as a sentence naming the fix.

The helper object

Neither fitted nor applied: one method on the server's own helper, with every argument sent positionally.

Latu.ML.Stat.chi_square_test/3,4Pearson's independence test. Lazy.
Latu.ML.Stat.correlation/2,3A correlation matrix over a Vector column. Lazy.
Latu.ML.Stat.kolmogorov_smirnov_test/4One-sample two-sided KS test. Lazy.
Latu.ML.assign_clusters/2PowerIterationClustering's only verb. Lazy.
Latu.ML.find_frequent_sequential_patterns/2PrefixSpan's only verb. Lazy.
Latu.ML.Feature.load_default_stop_words/2Spark's stop-word list for a language. + !
Latu.ML.Feature.default_locale/1The server's default locale, StringIndexer's. + !
Latu.ML.helper/2,3The generic call underneath all of them. + !
Latu.ML.helper_frame/2The same where the answer is a frame.

Columns and tensors

Latu.ML.Functions.vector_to_array/1,2A Vector column as array<double>, server-side.
Latu.ML.Functions.array_to_vector/1The other way.
Latu.ML.Functions.dtypes/0The two dtypes vector_to_array takes.
Latu.ML.SparseVector.to_dense/1A sparse vector as an Nx.Tensor, when you say so.
Latu.ML.Linalg.from_udt/1A UDT literal as a tensor or a sparse vector. + !
Latu.ML.Linalg.to_literal/1A tensor or sparse vector as a UDT literal.

The shapes

What a verb returns

ShapeLooks likeReaches the server
Buildera struct — Latu.ML.Estimator, Latu.ML.Pipelineno
Relation buildera Latu.DataFrameno
Action{:ok, term} / {:error, %Latu.Error{}}yes

What a fetch answers with

returnsVerbValue
:valueLatu.ML.attribute/2a number, string, list, tensor or Latu.ML.SparseVector
:frameLatu.ML.attribute_frame/2a lazy Latu.DataFrame
:summaryLatu.ML.summary/1another cached object
:operatorsLatu.ML.attribute/2models — one cache entry each

Operators

The seven groups

ModuleWhat is in it
Latu.ML.Classification8 estimators, 8 model classes
Latu.ML.Regression8 estimators, 8 model classes
Latu.ML.Clustering4 estimators, 6 model classes, PowerIterationClustering
Latu.ML.Feature20 estimators, 19 model classes, 18 transformers
Latu.ML.Evaluation6 evaluators
Latu.ML.FPMFPGrowth and its model, PrefixSpan
Latu.ML.RecommendationALS and its model

Status, on every constructor's doc

:probedA live server ran it, and every allowlisted attribute answered.
:builtGenerated from PySpark's param table, not yet exercised.
:missingPySpark names it; the server does not load it.

Gotchas

A Vector column will not collect

Latu.collect/2 refuses it — Spark says "UDT" and declines to say what it serialises as. Use Latu.to_nx/2 for a tensor, Latu.ML.Functions.vector_to_array/2 for a frame, or select it away.

Nothing releases a model for you

The BEAM has no finalizer. Latu.ML.with_model/3, or Latu.ML.fit/2 and Latu.ML.delete/1. Latu.ML.load/4 and a trees accessor spend cache too.

Match error_class, not the message

CONNECT_ML.CACHE_INVALID's text describes the wrong object and blames the wrong cause. Latu.ML.error_kind/1 is the atom.

A search needs a seed

Folds are cut with rand(seed). Without seed: the draw differs between runs and the search is not repeatable.

A loaded model has no summary

It never saw the data, so there is nothing to rebuild one from. Latu.ML.hint/1 names both ways of arriving there.

Defaults are documented, never sent

A param you did not set and a param sent with its default are different requests. Kind is refused here; range is Spark's to refuse.