Create a Run¶
In the context of MLflow, a "run" refers to a specific instance of an experiment. You can think of a "run" as a unique execution of an experiment, where specific configurations are applied, a model is trained with particular data, and results are recorded.
Following the example of the house price prediction model, a "run" would be a concrete execution of an experiment. Every time you perform a test, adjust parameters, or use a specific dataset within your MLflow experiment, you are creating a new "run" within that experiment. Each "run" keeps a detailed record of how parameters were configured, which data was used, and what results were obtained in that particular execution.
The ability to track and compare multiple "runs" within the same experiment is valuable because it allows you to explore different approaches and settings, record the details of each attempt, and determine which one is the most effective based on performance metrics and results. In summary, a "run" in MLflow is an individual instance of an experiment that helps you keep an accurate track of your tests and progress in your machine learning project.
import mlflow
EXPERIMENT_NAME = "mlflow-demo" # โ make sure this experiment exists
RUN_NAME = "run-empty"
# Get the experiment ID
experiment_id = mlflow.get_experiment_by_name(EXPERIMENT_NAME).experiment_id
# Start a run
with mlflow.start_run(
experiment_id=experiment_id,
run_name=RUN_NAME,
) as run:
# Print the run ID
print(f"๐ Run ID: {run.info.run_id}")
๐ Run ID: 15eabef1162a403fa63ceb568f6f6ec7