Introduction to MLflow
Weston Bassler
Senior MLOps Engineer
Reproducible
Reusable
Portable
project/
MLproject
train_model.py
python_env.yaml
requirements.txt
name:
- Name of the Project
entry_points:
.py
and .sh
filespython_env:
python_env.yaml
name: salary_model
entry_points: main: command: "python train_model.py"
python_env: python_env.yaml
# Import libraries and modules import mlflow import mlflow.sklearn import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split
# Training Data df = pd.read_csv('Salary_predict.csv') X = df[["experience", "age", "interview_score"]] y = df[["Salary"]] X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.7,random_state=0)
# Set Auto logging for Scikit-learn flavor mlflow.sklearn.autolog()
# Train the model lr = LinearRegression() lr.fit(X_train, y_train)
python: 3.10.8
build_dependencies: - pip - setuptools - wheel
dependencies: - -r requirements.txt
mlflow
scikit-learn
Introduction to MLflow