Skip to content

Commit 5055489

Browse files
committed
turn next actions into bullet points
1 parent e774ab4 commit 5055489

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

articles/machine-learning/tutorial-convert-ml-experiment-to-production.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,34 @@ from sklearn.linear_model import Ridge
3737
from sklearn.metrics import mean_squared_error
3838
from sklearn.model_selection import train_test_split
3939
import joblib
40+
import pandas as pd
41+
42+
sample_data = load_diabetes()
4043

41-
X, y = load_diabetes(return_X_y=True)
44+
df = pd.DataFrame(
45+
data=sample_data.data,
46+
columns=sample_data.feature_names)
47+
df['Y'] = sample_data.target
48+
49+
X = df.drop('Y', axis=1).values
50+
y = df['Y'].values
4251

4352
X_train, X_test, y_train, y_test = train_test_split(
44-
X, y, test_size=0.2, random_state=0)
53+
X, y, test_size=0.2, random_state=0)
4554
data = {"train": {"X": X_train, "y": y_train},
4655
"test": {"X": X_test, "y": y_test}}
4756

48-
alpha = 0.5
57+
args = {
58+
"alpha": 0.5
59+
}
4960

50-
reg = Ridge(alpha=alpha)
61+
reg_model = Ridge(**args)
5162
reg.fit(data["train"]["X"], data["train"]["y"])
5263

53-
preds = reg.predict(data["test"]["X"])
54-
print("mse", mean_squared_error(preds, data["test"]["y"]))
64+
preds = reg_model.predict(data["test"]["X"])
65+
mse = mean_squared_error(preds, y_test)
66+
metrics = {"mse": mse}
67+
print(metrics)
5568

5669
model_name = "sklearn_regression_model.pkl"
5770
joblib.dump(value=reg, filename=model_name)
@@ -505,7 +518,6 @@ def test_train_model():
505518

506519
Now that you understand how to convert from an experiment to production code, see the following links for more information and next steps:
507520

508-
> [!div class="nextstepaction"]
509-
> [MLOpsPython](https://github.com/microsoft/MLOpsPython/blob/master/docs/custom_model.md): Build a CI/CD pipeline to train, evaluate and deploy your model using Azure Pipelines and Azure Machine Learning
510-
> [Monitor Azure ML experiment runs and metrics](https://docs.microsoft.com/azure/machine-learning/how-to-track-experiments)
511-
> [Monitor and collect data from ML web service endpoints](https://docs.microsoft.com/azure/machine-learning/how-to-enable-app-insights)
521+
+ [MLOpsPython](https://github.com/microsoft/MLOpsPython/blob/master/docs/custom_model.md): Build a CI/CD pipeline to train, evaluate and deploy your own model using Azure Pipelines and Azure Machine Learning
522+
+ [Monitor Azure ML experiment runs and metrics](https://docs.microsoft.com/azure/machine-learning/how-to-track-experiments)
523+
+ [Monitor and collect data from ML web service endpoints](https://docs.microsoft.com/azure/machine-learning/how-to-enable-app-insights)

0 commit comments

Comments
 (0)