training better models using automated machine learning · import pandas as pd from...
TRANSCRIPT
![Page 1: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/1.jpg)
Training better models usingAutomated Machine Learning
Vlad Iliescu
![Page 2: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/2.jpg)
Tools of the trade
![Page 3: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/3.jpg)
Google’s AUTOML
![Page 4: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/4.jpg)
Auto-keras
![Page 5: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/5.jpg)
Auto-SKLearn Microsoft’s automated ML
![Page 6: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/6.jpg)
Kaggle
![Page 7: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/7.jpg)
![Page 8: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/8.jpg)
![Page 9: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/9.jpg)
Features
• PassengerId
• Survived
• Pclass
• Sex
• Age
• Sibsp
• Parch
• Ticket
• Fare
• Cabin
• Embarked
![Page 10: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/10.jpg)
import pandas as pdfrom azureml.core.experiment import Experimentfrom azureml.core.workspace import Workspacefrom azureml.train.automl import AutoMLConfig
![Page 11: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/11.jpg)
# Load training datadf = pd.read_csv('./data/train.csv')
X = df.drop(['Survived', 'PassengerId'], axis=1)y = df['Survived']
![Page 12: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/12.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=5,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
![Page 13: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/13.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=10,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
• Classification
• Regression
• Forecasting
![Page 14: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/14.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=5,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
• AUC_Macro
• AUC_Micro
• AUC_Weighted
• accuracy
• average_precision_score_macro
• average_precision_score_micro
• average_precision_score_weighted
• balanced_accuracy
• f1_score_macro
• f1_score_micro
• f1_score_weighted
• log_loss
• norm_macro_recall
• precision_score_macro
• precision_score_micro
• precision_score_weighted
• recall_score_macro
• recall_score_micro
• recall_score_weighted
• weighted_accuracy
![Page 15: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/15.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=5,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
![Page 16: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/16.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=5,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
![Page 17: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/17.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=5,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
![Page 18: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/18.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=5,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
![Page 19: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/19.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=5,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=False
)
• StandardScaleWrapper
• MinMaxScalar
• MaxAbsScaler
• RobustScalar
• PCA
• TruncatedSVDWrapper
• SparseNormalizer
![Page 20: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/20.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric=AUC_weighted',iterations=5,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
• StandardScaleWrapper
• MinMaxScalar
• MaxAbsScaler
• RobustScalar
• PCA
• TruncatedSVDWrapper
• SparseNormalizer
• Drop high cardinality or no
variance features
• Impute missing values
• Generate additional features
• Transform and encode
• Word embeddings
• Target encodings
• Text target encoding
• Weight of Evidence (WoE)
• Cluster Distance
![Page 21: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/21.jpg)
# Run the Automated ML experiment
ws = Workspace.from_config()experiment = Experiment(ws, 'NDR2019')
local_run = experiment.submit(config, show_output=True)
![Page 22: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/22.jpg)
# Run the Automated ML experiment
ws = Workspace.from_config()experiment = Experiment(ws, 'NDR2019')
local_run = experiment.submit(config, show_output=True)
![Page 23: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/23.jpg)
![Page 24: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/24.jpg)
![Page 25: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/25.jpg)
![Page 26: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/26.jpg)
![Page 27: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/27.jpg)
# Run the best model on the test datasetbest_run, fitted_model = local_run.get_output()
df_test = pd.read_csv('./data/test.csv')df_test_X = df_test.drop(['PassengerId'], axis=1)pred_y = fitted_model.predict(df_test_X)
![Page 28: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/28.jpg)
# Generate the submission fileoutput = pd.DataFrame({
'PassengerId': df_test['PassengerId’], 'Survived': pred_y})
output.to_csv('./output.csv', index=False)
![Page 29: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/29.jpg)
![Page 30: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/30.jpg)
Top 19%
![Page 31: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/31.jpg)
Turning it up to 11
![Page 32: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/32.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric='AUC_weighted',iterations=50,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
![Page 33: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/33.jpg)
![Page 34: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/34.jpg)
![Page 35: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/35.jpg)
# Configure the experiment
config = AutoMLConfig(task='classification',primary_metric='accuracy',iterations=10,X=X,y=y.values.flatten(),n_cross_validations=5,preprocess=True
)
![Page 36: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/36.jpg)
![Page 37: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/37.jpg)
Top 6,3%
![Page 38: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/38.jpg)
What just happened?
![Page 39: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/39.jpg)
Questions?
![Page 40: Training better models using Automated Machine Learning · import pandas as pd from azureml.core.experiment import Experiment from azureml.core.workspace import Workspace from azureml.train.automl](https://reader033.vdocuments.site/reader033/viewer/2022042921/5f68a752d6ee5d758930fb78/html5/thumbnails/40.jpg)
The END
Vlad Iliescu