Skip to main content

Model declaration - model.yml

Layer is a declarative MLOps platform. It enables you to define your machine learning entities in a declarative manner. That's why we are going to use a 'YML' file to introduce our ML Model in a Layer project.

Layer discovers your ML Models within a reserved file called model.yml. This file contains all directives and definitions about your ML Model. Let's see what's in this file now.


Version of the model definition file

Model name and description#

Give your ML Model a unique name and a description. You will be referring to your model with this unique name whenever you want to use it. Also, it will be visible in the model catalog under this name.

Training definition#

This is the part you provide the training declarations of your ML Model. With the training key, you can:

  • Define where your ML Model's source code is
  • Pass the environment config
  • Tune your model

Training name and description#

Give your ML Model training a name and a description. It will help you to monitor your training job.

Source code#

You can pass the Python source code of your model with an entrypoint key like here. This file should be in the same directory as this model.yml file.

Environment config#

You may need extra Python libraries to develop your ML Model. You can pass those required libraries with a requirements.txt file so that Layer can install them to prepare the environment for the training job.

Hyperparameter tuning#

You might want to tune your parameters to find the best version of your model. You can define the tuning directives here and Layer will automatically execute the search. In the highlighted section on the right, we see a tuning declaration with the Bayesian Search algorithm. Visit Hyperparameter Tuning to learn more.

apiVersion: 1
name: "survival_model_bayesian_search"
description: "Titanic survival predictor"
name: survival_model_bayesian_search
description: "Titanic Survival Model Training With Bayesian Search"
environment: requirements.txt
strategy: "Bayesian"
max_jobs: 10
maximize: "accuracy"
type: "integer"
min: 4
max: 20
type: "integer"
min: 1
max: 5
type: "float"
min: 0.4
max: 0.9