面向生产环境的机器学习模型开发
Sinan Ozdemir
Data Scientist and Author
一个用于跟踪与管理机器学习实验的开源平台。MLflow 可用于:

# standard scikit-learn imports
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
# new imports from MLflow
import mlflow
import mlflow.sklearn
with mlflow.start_run(): # Start an MLflow run assuming we have data prepared
# Build and train model
rf = RandomForestClassifier()
rf.fit(X_train, y_train)
# Log parameters and model information
mlflow.log_param("n_estimators", rf.n_estimators)
mlflow.sklearn.log_model(rf, "model")
y_pred = rf.predict(X_test) # Evaluate model
accuracy = accuracy_score(y_test, y_pred)
mlflow.log_metric("accuracy", accuracy) # log the test accuracy metric


面向生产环境的机器学习模型开发