Machine learning models are akin to mathematical functions. They take a request in the form of input data, make a prediction on that input data, and then serve a response. Layer takes a declarative approach to streamline the ML Model development process.
ML Models are first-class entities in Layer. They are integral to and built within a Layer Project. They are versioned and stored in the Layer Model Catalog.
All models can be defined in a directory, with a
model.yml file at the root linked to one or more Python files. Models have the following basic layout:
Models are configured in a
model.yml file, which looks like this:
Model training is done via Python files referred to from the
This python code uses the Layer SDK to define a
train_model function that takes a
train argument as well as a series of featureset arguments. You can train your model any way you'd like within this function. While training, you can use
train.log_metric to save parameters and metrics of your training runs that will then be viewable in the Layer Model Catalog UI. You can also use
train.register_output to define the model signature, which can then be used for determining the data lineage of this model.
Here's an example model training code outline:
Now that you defined your model, you can then go ahead and run your project!