DEV Community

TildAlice
TildAlice

Posted on • Originally published at tildalice.io

MLflow Quickstart 2026: Track Your First Experiment in 10 Minutes

MLflow Tracking in 90 Seconds

Here's the entire workflow. Install MLflow, log a single training run, and view it in the UI:

# pip install mlflow==2.11.3
import mlflow
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score

X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

mlflow.set_experiment("iris-quickstart")

with mlflow.start_run():
    n_est = 100
    max_d = 5

    clf = RandomForestClassifier(n_estimators=n_est, max_depth=max_d, random_state=42)
    clf.fit(X_train, y_train)

    preds = clf.predict(X_test)
    acc = accuracy_score(y_test, preds)

    mlflow.log_param("n_estimators", n_est)
    mlflow.log_param("max_depth", max_d)
    mlflow.log_metric("accuracy", acc)
    mlflow.sklearn.log_model(clf, "model")

    print(f"Logged run with accuracy: {acc:.3f}")
Enter fullscreen mode Exit fullscreen mode

Run mlflow ui in your terminal, open http://localhost:5000, and you'll see your experiment with params, metrics, and the saved model artifact.

That's it. The entire MLflow tracking API distills down to three calls: log_param(), log_metric(), log_model(). Everything else is just organization.


Continue reading the full article on TildAlice

Top comments (0)