Track experiments
Log runs, metrics, parameters, and artifacts to MLflow from a BullSequana AI dev environment.
BullSequana AI injects the MLflow tracking server URL and your credentials into every dev environment automatically. You don't need to set any environment variables or configure the client manually. Open a dev environment and start logging right away.
Example notebook
An example notebook that demonstrates experiment logging and model registration end-to-end is available in your dev environment. Run it top-to-bottom to validate your setup.
Experiment spaces
Every MLflow run belongs to an experiment. BullSequana AI provides two experiment spaces:
- Personal space (
users/<your-username>/): runs logged here are private to you. Use this space for exploratory or in-progress work. - Shared space (
shared): runs logged here are visible to all users on the platform. Use this space to share results with your team.
You choose the space when you set the experiment name in your dev environment.
Naming your experiment
Pass the full path as the experiment name to mlflow.set_experiment().
For your personal space, use "users/your-username/experiment-name".
For the shared space, use "shared/experiment-name".
Log a run
To log a run, set the experiment name and start a run using the standard
mlflow SDK. The client automatically sends data to the BullSequana AI
tracking server.
Log a run to the shared experiment space:
import mlflow
mlflow.set_experiment("shared/my-experiment")
with mlflow.start_run():
mlflow.log_param("learning_rate", 0.01)
mlflow.log_param("epochs", 10)
# ... your training code here ...
mlflow.log_metric("accuracy", 0.95)
mlflow.log_metric("loss", 0.12)Log a run to your personal experiment space:
import mlflow
mlflow.set_experiment("users/your-username/my-experiment")
with mlflow.start_run():
mlflow.log_param("learning_rate", 0.01)
mlflow.log_metric("accuracy", 0.95)Log artifacts
You can attach files to a run as artifacts. Artifacts are stored alongside the run and are accessible from the MLflow UI.
import mlflow
with mlflow.start_run():
# Save a file and log it as an artifact
with open("results.txt", "w") as f:
f.write("Training complete.")
mlflow.log_artifact("results.txt")To log an entire directory:
mlflow.log_artifacts("outputs/", artifact_path="training-outputs")Use autologging
MLflow supports autologging for common ML frameworks. When enabled, it
captures parameters, metrics, and model artifacts automatically without
explicit log_param or log_metric calls.
import mlflow
import mlflow.sklearn
mlflow.sklearn.autolog()
# Train your model; MLflow logs everything automatically
from sklearn.linear_model import LogisticRegression
model = LogisticRegression()
model.fit(X_train, y_train)MLflow supports autologging for scikit-learn, TensorFlow, Keras, PyTorch, XGBoost, LightGBM, and other popular frameworks. See the MLflow autologging documentation for the full list.
Next steps
- Register a model to the MLflow Model Registry.
- Open the MLflow UI to compare runs and review results.