Deploy and retrain a model (10–15%) Flashcards
What things does MLflow track?
Everything, divided into parameters, metrics, and artifacts
If I want mlflow on azure what package should I install?
pip install mlflow azureml-mlflow
How to use mlflow on a local device?
Use the MLflow tracking URI from the overview of the workspace, then do mlflow.set_tracking_uri = “MLFLOW-TRACKING-URI”
How to start a run in mlflow?
It acts like a wrapper, so import it then do
mlflow.set_experiment(experiment_name=<experiment>)</experiment>
How to use autolog in MLflow?
from xgboost import XGBClassifier
with mlflow.start_run():
mlflow.xgboost.autolog()
model = XGBClassifier(use_label_encoder=False, eval_metric="logloss") model.fit(X_train, y_train, eval_set=[(X_test, y_test)], verbose=False)
What are some common function for custom logging in mlflow?
log_param(): single key-value parameter, log_metric(): single key-value metric, log_artifact(): logs a file, like an image, log_model(): logs a model as an MLflow model
How to use custom logging in MLflow?
from xgboost import XGBClassifier
from sklearn.metrics import accuracy_score
with mlflow.start_run():
model = XGBClassifier(use_label_encoder=False, eval_metric=”logloss”)
model.fit(X_train, y_train, eval_set=[(X_test, y_test)], verbose=False)
y_pred = model.predict(X_test)
accuracy = accuracy_score(y_test, y_pred) mlflow.log_metric("accuracy", accuracy)
What is an endpoint?
An HTTPS endpoint to which you can send data and which will return a response
What are the two types of online endpoints within Azure Machine learning?
There are managed online endpoints and Kubernetes online endpoints
What are managed online endpoints?
Azure Machine Learning manages all the underlying infrastructure
What are kubernetes online endpoints?
Users manage the kubernetes cluster which provides the necessary infrastructure
What four things do you need to deploy a model to a managed online endpoint?
Model assets, scoring script, environment, compute configuration
What is automatically generated when you deploy MLFlow models to an online endpoint?
The scoring script and environment are automatically generated
What is blue/green deployment?
It’s just a/b testing. Set 90% of the traffic for the proven endpoint and 10% for the new one and see how it performs.
What do you use to create an online endpoint?
You use ManagedOnlineEndpoint with the name and auth_mode parameters