import mlflow from mlflow.models import infer_signature #set tracking uri mlflow.set_tracking_uri(uri = "http://127.0.0.1:8080") #create a new MLflow Experiment mlflow.set_experiment("Logging Example") #start an MLflow run with mlflow.start_run(run_name = "salary_baseline_regression") as run: # Log the loss metric mlflow.log_metric("Adjusted R2", r2_score(y_test, y_pred)) #log the hyperparameters mlflow.log_params(params) #set a tag that we can use to remind ourselves what this run was for mlflow.set_tag("Model Type", "Baseline") #log the model model_info = mlflow.sklearn.log_model( sk_model = regr, artifact_path = 'model', signature = infer_signature(X_train, regr.predict(X_train)), input_example = X_train, registered_model_name = "salary_baseline_regression")