A place for non-native implementations of the MLJ model API
Author alan-turing-institute
46 Stars
Updated Last
1 Year Ago
Started In
January 2019


Build Status

Repository of selected models for use in the MLJ MLJ machine learning framework, without the need to import third party packages; and the home of the MLJ model registry.

For instructions on integrating a new model with MLJ visit here


Who is this repo for?

General users of the MLJ machine learning platform should refer to MLJ home page for usage and installation instructions. MLJModels is a dependency of MLJ that the general user can ignore.

This repository is for developers wishing to register new MLJ model interfaces, whether they be:

It also a place for developers to add models (mostly transformers) such as OneHotEncoder, that are exported for "built-in" use in MLJ. (In the future these models may live in a separate package.)

To list all model interfaces currently registered, do using MLJ or using MLJModels and run:

  • localmodels() to list built-in models (updated when external models are loaded with @load)

  • models() to list all registered models, or see this list.

Recall that an interface is loaded from within MLJ, together with the package providing the underlying algorithm, using the syntax @load RidgeRegressor pkg=GLM, where the pkg keyword is only necessary in ambiguous cases.

What is provided here?

MLJModels contains:

  • transformers to be pre-loaded into MLJ, located at /src/builtins, such as OneHotEncoder and ConstantClassifier.

  • the MLJ model registry, listing all models that can be called from MLJ using @load. Package developers can register new models by implementing the MLJ interface in their package and following these instructions.

Instructions for updating the MLJ model registry

Generally model registration is performed by administrators. If you have an interface you would like registered, open an issue here.

Administrator instructions. To register all the models in GreatNewPackage with MLJ:

  • In the dev branch of a clone of the dev branch of MLJModels, change to the /src/registry/ directory and, in the latest version of julia, activate the environment specified by the Project.toml there, after checking the [compat] conditions there are up to date. Do not use Revise.

  • Add GreatNewPackage to the environment.

  • In some environment to which your MLJModels clone has been added (using execute using MLJModels; MLJModels.@update. This updates src/registry/Metadata.toml and src/registry/Models.toml (the latter is generated for convenience and not used by MLJ).

  • Quit your REPL session and make a trivial commit to your MLJModels branch to force pre-compilation in a new julia session when you run using MLJModels. (For technical reasons the registry is not loaded in __init__()`, so without pre-compiliation the registry is not available.)

  • Test that the interfaces load properly with MLJModels.check_registry(). (CI will now fail on dev -> master if this test fails.)

  • Push your changes to an appropriate branch of MLJModels to make the updated metadata available to users of the next MLJModels tagged release.