diff --git a/classical/aml-cli-v2/data-science/src/evaluate.py b/classical/aml-cli-v2/data-science/src/evaluate.py index af772fd..e979f1a 100644 --- a/classical/aml-cli-v2/data-science/src/evaluate.py +++ b/classical/aml-cli-v2/data-science/src/evaluate.py @@ -205,18 +205,17 @@ def main(): # -------------------- Explainability ------------------- # - tree_explainer = TabularExplainer(model.steps[-1][1], + tabular_explainer = TabularExplainer(model, initialization_examples=X_train, - features=X_train.columns, - transformations=model.steps[0][1]) + features=X_train.columns) # save explainer - #joblib.dump(tree_explainer, os.path.join(tree_explainer, "explainer")) + #joblib.dump(tabular_explainer, os.path.join(tabular_explainer, "explainer")) # find global explanations for feature importance # you can use the training data or the test data here, # but test data would allow you to use Explanation Exploration - global_explanation = tree_explainer.explain_global(X_test) + global_explanation = tabular_explainer.explain_global(X_test) # sorted feature importance values and feature names sorted_global_importance_values = global_explanation.get_ranked_global_values() diff --git a/classical/aml-cli-v2/data-science/src/train.py b/classical/aml-cli-v2/data-science/src/train.py index ee82304..391517a 100644 --- a/classical/aml-cli-v2/data-science/src/train.py +++ b/classical/aml-cli-v2/data-science/src/train.py @@ -131,15 +131,25 @@ def main(): # append regressor to preprocessing pipeline. # now we have a full prediction pipeline. - pipeline = Pipeline(steps=[('preprocessor', preprocessor), - ('regressor', RandomForestRegressor( - n_estimators = args.regressor__n_estimators, - bootstrap = args.regressor__bootstrap, - max_depth = args.regressor__max_depth, - max_features = args.regressor__max_features, - min_samples_leaf = args.regressor__min_samples_leaf, - min_samples_split = args.regressor__min_samples_split, - random_state=0))]) + + #model = Pipeline(steps=[('preprocessor', preprocessor), + # ('regressor', RandomForestRegressor( + # n_estimators = args.regressor__n_estimators, + # bootstrap = args.regressor__bootstrap, + # max_depth = args.regressor__max_depth, + # max_features = args.regressor__max_features, + # min_samples_leaf = args.regressor__min_samples_leaf, + # min_samples_split = args.regressor__min_samples_split, + # random_state=0))]) + + + model = RandomForestRegressor(n_estimators = args.regressor__n_estimators, + bootstrap = args.regressor__bootstrap, + max_depth = args.regressor__max_depth, + max_features = args.regressor__max_features, + min_samples_leaf = args.regressor__min_samples_leaf, + min_samples_split = args.regressor__min_samples_split, + random_state=0) mlflow.log_param("model", "RandomForestRegressor") mlflow.log_param("n_estimators", args.regressor__n_estimators) @@ -149,10 +159,10 @@ def main(): mlflow.log_param("min_samples_leaf", args.regressor__min_samples_leaf) mlflow.log_param("min_samples_split", args.regressor__min_samples_split) - pipeline.fit(X_train, y_train) + model.fit(X_train, y_train) # Predict using the Regression Model - yhat_train = pipeline.predict(X_train) + yhat_train = model.predict(X_train) # Evaluate Regression performance with the train set r2 = r2_score(y_train, yhat_train) @@ -174,7 +184,7 @@ def main(): mlflow.log_artifact("regression_results.png") # Save the model - pickle.dump(pipeline, open((Path(args.model_output) / "model.pkl"), "wb")) + pickle.dump(model, open((Path(args.model_output) / "model.pkl"), "wb")) if __name__ == "__main__": main() diff --git a/classical/aml-cli-v2/mlops/devops-pipelines/deploy-batch-endpoint-pipeline.yml b/classical/aml-cli-v2/mlops/devops-pipelines/deploy-batch-endpoint-pipeline.yml index 915f559..1869e6e 100644 --- a/classical/aml-cli-v2/mlops/devops-pipelines/deploy-batch-endpoint-pipeline.yml +++ b/classical/aml-cli-v2/mlops/devops-pipelines/deploy-batch-endpoint-pipeline.yml @@ -45,8 +45,10 @@ stages: - template: templates/${{ variables.version }}/create-compute.yml@mlops-templates parameters: cluster_name: batch-cluster # name must match cluster name in deployment file below + size: STANDARD_DS3_V2 min_instances: 0 max_instances: 5 + cluster_tier: dedicated - template: templates/${{ variables.version }}/create-endpoint.yml@mlops-templates parameters: endpoint_file: mlops/azureml/deploy/batch/batch-endpoint.yml diff --git a/documentation/architecturepattern/AzureML_CML_Architecture.png b/documentation/architecturepattern/AzureML_CML_Architecture.png new file mode 100644 index 0000000..4dc722f Binary files /dev/null and b/documentation/architecturepattern/AzureML_CML_Architecture.png differ diff --git a/documentation/architecturepattern/AzureML_CML_Architecture.vsdx b/documentation/architecturepattern/AzureML_CML_Architecture.vsdx new file mode 100644 index 0000000..4349a91 Binary files /dev/null and b/documentation/architecturepattern/AzureML_CML_Architecture.vsdx differ diff --git a/documentation/architecturepattern/AzureML_CML_Architecture_v0.7.jpg b/documentation/architecturepattern/AzureML_CML_Architecture_v0.7.jpg deleted file mode 100644 index 6a55b33..0000000 Binary files a/documentation/architecturepattern/AzureML_CML_Architecture_v0.7.jpg and /dev/null differ diff --git a/documentation/architecturepattern/AzureML_NLP_Classification_Architecture.png b/documentation/architecturepattern/AzureML_NLP_Classification_Architecture.png new file mode 100644 index 0000000..383217b Binary files /dev/null and b/documentation/architecturepattern/AzureML_NLP_Classification_Architecture.png differ diff --git a/documentation/architecturepattern/AzureML_NLP_Classification_Architecture.vsdx b/documentation/architecturepattern/AzureML_NLP_Classification_Architecture.vsdx new file mode 100644 index 0000000..1de9582 Binary files /dev/null and b/documentation/architecturepattern/AzureML_NLP_Classification_Architecture.vsdx differ diff --git a/documentation/architecturepattern/AzureML_SupervisedCV_Architecture.png b/documentation/architecturepattern/AzureML_SupervisedCV_Architecture.png new file mode 100644 index 0000000..ee84457 Binary files /dev/null and b/documentation/architecturepattern/AzureML_SupervisedCV_Architecture.png differ diff --git a/documentation/architecturepattern/AzureML_SupervisedCV_Architecture.vsdx b/documentation/architecturepattern/AzureML_SupervisedCV_Architecture.vsdx new file mode 100644 index 0000000..72847a0 Binary files /dev/null and b/documentation/architecturepattern/AzureML_SupervisedCV_Architecture.vsdx differ diff --git a/documentation/architecturepattern/AzureML_SupervisedCV_Architecture_v0.5.jpg b/documentation/architecturepattern/AzureML_SupervisedCV_Architecture_v0.5.jpg deleted file mode 100644 index f7664fd..0000000 Binary files a/documentation/architecturepattern/AzureML_SupervisedCV_Architecture_v0.5.jpg and /dev/null differ