Question 1mediummultiple choice
Read the full Model Development explanation →Databricks-ML-Pro Model Development • Complete Question Bank
Complete Databricks-ML-Pro Model Development question bank — all 0 questions with answers and detailed explanations.
import mlflow.sklearn
with mlflow.start_run():
model = RandomForestClassifier()
model.fit(X_train, y_train)
mlflow.sklearn.log_model(model, 'my_model', registered_model_name='ProductionModel')MLflow Traceback: mlflow.exceptions.RestException: RESOURCE_DOES_NOT_EXIST: Model version with name 'DemandForecast' and version '5' not found.
MLflow error: 'Could not serialize model: Model contains references to local file system path /dbfs/mnt/data/model.pkl'
MLflow run: training_run_123, metrics: {accuracy: 0.85}, params: {n_estimators: 100}{
"run_id": "d3f4a1b2c3d4e5f6",
"artifact_path": "models/model.pkl",
"mlflow_version": "2.4.0",
"status": "FINISHED",
"tags": {
"mlflow.log-model.history": "..."
}
}MLflow.log_param('learning_rate', 0.01)
MLflow.log_metric('accuracy', 0.92)
MLflow.log_artifact('/dbfs/ml/models/weights.pt')
MLflow.log_model(model, 'model_artifact')MLflow.log_metric('rmse', 0.5)
MLflow.log_metric('rmse', 0.45)
MLflow.log_metric('rmse', 0.4){
"model_name": "fraud_detection_model",
"artifact_path": "model",
"run_id": "d1a2b3c4d5e6f7g8h9i0",
"signature": {
"inputs": [{"name": "amount", "type": "double"}, {"name": "user_age", "type": "integer"}],
"outputs": [{"name": "is_fraud", "type": "boolean"}]
}
}import mlflow
from sklearn.ensemble import RandomForestRegressor
# Configure model
model = RandomForestRegressor()
# Training logic
with mlflow.start_run():
mlflow.sklearn.log_model(model, "model")
# Further code...MLflow Run Output:
Run ID: 550e8400-e29b-41d4-a716-446655440000
Status: FINISHED
Parameters: {'learning_rate': '0.01', 'epochs': '50'}
Metrics: {'accuracy': '0.88', 'loss': '0.12'}
Tags: {'mlflow.user': 'databricks_user', 'mlflow.source.name': 'train_script.py'}JSON Configuration:
{
"model_name": "PropensityModel",
"model_version": "3",
"signature": {
"inputs": [{"name": "age", "type": "integer"}, {"name": "income", "type": "double"}],
"outputs": [{"name": "score", "type": "double"}]
},
"flavors": ["sklearn", "python_function"]
}MLflow config: mlflow.set_tracking_uri('databricks')
model_uri = 'models:/MyModel/1'
mlflow.pyfunc.load_model(model_uri){
"model_name": "revenue_forecast",
"framework": "sklearn",
"input_example": "[10, 50, 0.2]",
"signature": "input: [float, float, float], output: float",
"conda_env": "environment.yaml"
}