{ "cells": [ { "metadata": {}, "cell_type": "markdown", "source": [ "# MLFlow\n", "\n", "Mlflow is an open source platform for monitoring machine learning experiments and managing experiments. MLFlow is a platform that allows you to track experiments, package code into reproducible runs, and share and deploy models. It is designed to work with any machine learning library and to be platform agnostic. It is also designed to be modular, so you can use only the parts you need." ], "id": "53569cdb454d84e0" }, { "metadata": {}, "cell_type": "code", "source": "!pip install mlflow", "id": "d1010a63-a9b3-4df1-a186-d0930b0d1753", "outputs": [], "execution_count": null }, { "cell_type": "code", "id": "780cfb34-f9c8-4f21-9600-378a5bc73e35", "metadata": {}, "source": [ "import mlflow\n", "import os\n", "\n", "print(os.environ[\"MLFLOW_TRACKING_URI\"])" ], "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "## Create an Experiment", "id": "357b31e15fd3a777" }, { "cell_type": "code", "id": "d9d030c4-3abf-456d-acf8-691783d34932", "metadata": {}, "source": "exp_id = mlflow.create_experiment(\"Demo\")", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "## Start a Run", "id": "6a63da070a4eacad" }, { "cell_type": "code", "id": "f6c1edd0-610c-46ac-b4dc-ea09117d37a8", "metadata": {}, "source": [ "with open(\"artifact.txt\", \"w\") as f:\n", " f.write(\"Hello world!\")\n", " \n", "with mlflow.start_run(experiment_id=exp_id):\n", " mlflow.log_param(\"param1\", 1)\n", " mlflow.log_metric(\"metric1\", 2)\n", " mlflow.log_artifact(\"artifact.txt\")" ], "outputs": [], "execution_count": null }, { "cell_type": "code", "id": "28e86632-26b2-44d0-a4e0-d40082a9af4c", "metadata": {}, "source": [], "outputs": [], "execution_count": null } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }