Section 2: MLflow Tracking
Simple ML model -
We have implemented a simple ML model to showcase the experiment tracking concept used in MLflow-
Source code
simple_ML_model.py
- Source repository - Click here
Concept of Runs
MLflow Tracking is based on runs. Runs are executions of some piece of data science code. A Run can record the following :
- Code Version
- Start & End Time
- Source
- Parameters
- Metrics
- Artifacts
Logging our simple ML model using
In this lecture it has been shown that how we can log our model for every execution or experiment-
Source code
simple_ML_model_2.py
Exploring UI of MLflow
runs.py
Info
Refer video lecture for this in oneNeuron platform for UI exploration
Packaging a project MLflow way
-
Create a
conda.yaml
file as shown below: -
or run the following command to create conda.yaml file
Note
make sure you are in the same environment while running the command whose conda.yaml file you wish to create
-
after above step create the an
MLproject
file in the root of the project as shown below - -
Now run the following command to execte the project
- without using a fresh conda environment by using the existing environment-
- with a fresh conda environment -
- if you wish to pass command line argument then use the below command-
-
source code for the above demo - source code
MLflow tracking server
-
make the changes in the code base to be ready for tracking server -
code
-
run mlflow sqlite server to store parameters and metrics in an sqlite local database and create artifact directory to store files