python
13 lines · 1 tab
Dr. Elena Vasquez
Apr 2026
1 tab
import mlflow
import mlflow.sklearn
from sklearn.metrics import roc_auc_score
mlflow.set_experiment('customer-churn')
with mlflow.start_run(run_name='hist_gbm_v3'):
mlflow.log_params({'learning_rate': 0.05, 'max_depth': 6, 'features_version': '2026_04_07'})
model.fit(X_train, y_train)
probabilities = model.predict_proba(X_valid)[:, 1]
auc = roc_auc_score(y_valid, probabilities)
mlflow.log_metric('roc_auc', auc)
mlflow.sklearn.log_model(model, artifact_path='model', registered_model_name='customer_churn_model')
1 file · python
Explain with highlit
If experiments matter, they should be searchable after the notebook is closed. MLflow gives me parameter tracking, metric history, artifact storage, and a lightweight model registry without much ceremony. It is one of the fastest ways to make a small ML team more disciplined.
Related snips
python
import joblib
import pandas as pd
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI(title='Churn Prediction API')
Serving scikit-learn models behind a FastAPI prediction API
fastapi
scikit-learn
model-serving
by Dr. Elena Vasquez
1 tab
python
import joblib
from skl2onnx import to_onnx
from skl2onnx.common.data_types import FloatTensorType
joblib.dump(model, 'artifacts/model.joblib')
Serializing models with joblib, pickle, and ONNX tradeoffs
model-serialization
joblib
onnx
by Dr. Elena Vasquez
1 tab
python
import great_expectations as gx
context = gx.get_context()
data_source = context.data_sources.add_pandas(name='training_data')
asset = data_source.add_dataframe_asset(name='churn_asset')
batch_definition = asset.add_batch_definition_whole_dataframe('full_dataframe')
Great Expectations checks for dataset health before retraining
great-expectations
data-quality
mlops
by Dr. Elena Vasquez
1 tab
Share this code
Here's the card — post it anywhere.