# Adding an mlflow model to the model registry
from random import random, randint
from sklearn.ensemble import RandomForestRegressor

import mlflow
import mlflow.sklearn

with mlflow.start_run(run_name="YOUR_RUN_NAME") as run:
	params = {"n_estimators": 5, "random_state": 42}
	sk_learn_rfr = RandomForestRegressor(**params)


	# Log parameters and metrics using the MLflow APIs
	mlflow.log_params(params)
	mlflow.log_param("param_1", randint(0, 100))
	mlflow.log_metrics({"metric_1": random(), "metric_2": random()})

	# log the sklearn model and register as version 1
	mlflow.sklearn.log_model(
		sk_model=sk_learn_rfr,
		artifact_path="sklearn-model",
		registered_model_name="sk-learn-forest-reg-model"
	)





















