# Track experiments (/docs/guides/developer-workspace/mlflow/track-experiments)



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.

<Callout type="info" title="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.
</Callout>

Experiment spaces [#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.

<Callout type="idea" title="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"`.
</Callout>

Log a run [#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:

```python
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:

```python
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 [#log-artifacts]

You can attach files to a run as artifacts. Artifacts are stored alongside
the run and are accessible from the MLflow UI.

```python
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:

```python
mlflow.log_artifacts("outputs/", artifact_path="training-outputs")
```

Use autologging [#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.

```python
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](https://mlflow.org/docs/latest/tracking/autolog.html)
for the full list.

Next steps [#next-steps]

* [Register a model](register-models) to the MLflow Model Registry.
* [Open the MLflow UI](open-mlflow-ui) to compare runs and review results.
