mojolearn.set_numeric_mode#

mojolearn.set_numeric_mode(mode)#

Set the process-wide default numeric mode.

Estimators created without an explicit numeric_mode= use this mode. The starting default is the MOJOLEARN_NUMERIC_MODE environment variable, or "identical" when it is unset. The mode’s binaries are loaded immediately, so a mode that cannot be used fails here rather than at a later fit.

  • "identical" (default): the same bits on NVIDIA and AMD GPUs.

  • "deterministic": reproducible results run to run.

  • "fast": the fastest arithmetic, for Apple GPUs; no bitwise promise.

Not every family offers every mode: "deterministic" is offered by the tree ensembles (gradient boosting, random forest, extra trees) only. Using a family under a mode it does not ship raises ImportError.

Parameters:

mode ({“identical”, “deterministic”, “fast”} or None) – The new default; None keeps the current one.

Returns:

str – The previous default.

Examples

>>> import mojolearn
>>> previous = mojolearn.set_numeric_mode("identical")