mlflow模型生命周期
Developing a machine learning model is an iterative process consisting of multiple steps such as — model selections, model training, hyperparameter tuning, and deploying model into production. Tracking the model through these stages in an organized way helps in tracking various issues like —small changes in data, code, or hyperparameters that affect the overall model performance. But model tracking can be a non-trivial task that may get messy at times. MLflow is an open source platform to manage the ML lifecycle, including experimentation, reproducibility, deployment, and a central model registry.
开发机器学习模型是一个迭代过程,包括多个步骤,例如模型选择,模型训练,超参数调整以及将模型部署到生产中。 以有组织的方式在这些阶段中跟踪模型有助于跟踪各种问题,例如影响整个模型性能的数据,代码或超参数的微小变化。 但是模型跟踪可能是一项不平凡的任务,有时可能会变得凌乱。 MLflow是一个开放源代码平台,用于管理ML生命周期,包括实验,可重复性,部署和中央模型注册表。
![Image for post](https://miro.medium.com/max/9999/1*j4axa8_lMRapIFr9LA87Rw.png)
Although tensorflow has it’s own model tracking tool — tensorboard, mlflow provides a simpler interface for tracking the experiments, while also making it easier to push the trained model into production.
尽管tensorflow拥有自己的模型跟踪工具-tensorboard,但mlflow提供了一个更简单的界面来跟踪实验,同时还使将经过训练的模型投入生产变得更加容易。
Here, I will demonstrate how mlflow can be used to track tensorflow models using a remote tracking store. MLflow supports various tracking backend store. I will be using a MySQL database to store the experiments and model artifacts.
在这里,我将演示如何使用mlflow使用远程跟踪存储来跟踪张量流模型。 MLflow支持各种跟踪后端存储 。 我将使用MySQL数据库存储实验和模型工件。
设置MySQL服务器 (Setting Up MySQL server)
First we need to set up a mysql server. I will be using a Docker container to start the server on my local machine. You can pull the mysql-server docker image by running the following command:
首先,我们需要设置一个mysql服务器。 我将使用Docker容器在本地计算机上启动服务器。 您可以通过运行以下命令来提取mysql-server docker映像:
shell> docker pull mysql/mysql-server:latest
Once the docker image is pulled, we can create a docker container from this image:
提取docker映像后,我们可以从该映像创建docker容器:
shell>
We map the ports 3306 and 33060 to the docker container so that we can access the database outside of the docker container. MySQL by default uses the port 3306 for access. We c