Automatically create machine learning models using Amazon SageMaker Autopilot - AWS
Key Takeaways
Amazon SageMaker Autopilot is used for automatic machine learning model creation, leveraging a simple drag-and-drop UI for data preparation and feature engineering with Data Wrangler, and allowing for full control and visibility over the process.
Full Transcript
[Music] hello everybody and welcome to today's webinar about amazon switchmaker autopilot am gaining in an aws senior solutions architect in switzerland and are responsible for enterprise accounts and specialize in machine learning and data analytics so first of all uh we we see and we learn how to leverage a very simple drag and drop ui to to do data preparation feature engineering called uh data wrangler and i explained later why data wrangler uh could be very important for you even if you use out ml from aws the second thing we're going to learn is how to use amazon autopilot to build machine learning pipelines for your table data and do it completely automatically and the third topic i i'm going to show you how to leverage sh maker api osage maker python sdk to programmatically implement all out ml steps in in your notebook or your machine learning pipeline everything what i'm shown today is available as public immersion day you can click on the link or go on qr code and this is very nice workshop contains a lot of code notebooks data sets you can use your own data sets you can experiment with notebooks and so on i encourage you to go there and and take a look in terms of time so what we're going to do today we spent next half an hour or so looking at low code no code capabilities within sagemaker set the scene then we understand what's hmaker autopilot how it works and how you prepare data formats on sage maker autopilot using data wrangler and we also look at use cases we are going to work today and use which data we're going to use for amazon's hashmaker autopilot and as a main part of of the workshop 45 minutes or so we look at full apps in the first lab we we train a multi-class classifier using a health care data set in the second lab we train a binary classifier using financial services data set in the third lab i think it's the most interesting lab for me at least we we process the data using data data wrangler we process the time series and prepare this data set for autopilot and then we use autopilot to predict data on on time series so you learn how to prepare data how to prepare time series and then train model using out email and eventually in the in the last lab we go through a notebook with sagemaker autopilot using python sdk so you can programmatically do everything what you see today on the screen and finally i'm going to to show you a couple of links for the makeup documentation and useful resources like blog posts workshops or scientific papers first let's look at a typical machine learning workflow in the first step we prepare data we do data preparation and feature engineering then we use this prepared data set for our model development we actually have to write some script and and use different approaches different model types then we train the model and do some tuning uh we we decide with which hyper parameters we restart and how we continue with hyper parameters to hyperparameter optimizations and we we repeat all these three steps uh again and again multiple times so this is highly interactive and also context human activity and at the end when we're happy with the model performance and approach we're chosen uh we use the model we deploy model and we we run offline online inference with this machine learning workflow of course uh some uh challenges common uh first of all probably the most uh most important and uh uh the most is a major blocker uh to implement this you need really deep experience experience and expertise and understanding the data understanding how model works understanding how different hyper parameters affect model performance uh training time and uh just the fact that you can train this all requires literally years of experience and experimentation is time consuming and it's sometimes highly manual you have to go write some code in the notebook go interactively through through the code and do the same and same thing same same thing again only changing some small small bits uh it could be also compute resource intensive based on the data set based on the use case for example nlp or computer vision uh you you potentially need an expensive computer resources with gpu a lot of memory or cluster of compute resources and another problem coming from resource human resource perspective data science teams are oversubscribed have a huge backlog and very difficult to get into this backlog so one of the remedy could be produce and provide set of tools to citizen data scientists people who are not necessarily very familiar with with the models and with having this experience how you uh train model prepare data to the future engineering the people who understand the data who works with data every day day to day and they also use some tools to to to get data inside so if you give proper tools and i'm talking about out ml here to these people you can increase productivity of of your machine learning workflows in in your company manifold and uh in amazon sage maker we have a concept of low code and no code machine learning tools that gives you a really this opportunity and options uh to do machine learning things from from workflow like a feature engineering or model training very fast and you see here a couple of quotes that you can build your feature engineering pipeline within days and not months you can automatically build train and tune automatically hundreds of models uh in parallel and do it not manually but automatically and get the best one and overall you can reduce your production time time to production for machine learning solution uh to couple of weeks instead of many months so first of all look at a low code no code machine learning offering from aws three of these capabilities are low code and available in amazon search maker studio and the fourth capability is no codes you literally have no option to write any code there but first look at data wranglers the first capability and it it provides a super easy visual interface with more than 400 pre-built data transformation you can drag and drop into flow and then you create your data exploration visualization data processing and feature engineering pipeline and you don't need to write any single line of code a good thing with a data wrangler if you don't see your transformations that you need within these 400 pre-built data transformations you can write implement your own transformation using python or pi spark or sql code so it's very flexible you're not only limited to to transformations that are provided for you but you can use this transformation in a very simple way they're all machine learning oriented for example how to handle your numeric features how to handle your categoric features how to handle uh data series missing data and and so on today we are going to dive a little bit deeper into the data wrong here we are going to use data wrangler to a process data set for autopilot so you'll see on your own the second capability is autopilot and this is topic of today just think about autopilot as an outermel capability end to end you provided a tabular data set and it automatically infers a machine learning type is it linear regression or multi-class classification or binary classification and so on it automatically creates data preparation pipelines feature engineering pipelines develops different machine learning models also does hyper parameter tuning of these models and eventually gives you back the most optimal combination of all this and you can also automatically deploy the best model into production so this is really end to end out ml the third low code capability is called jumpstart and it has more than 300 pre-trained state-of-the-art models for computer vision and natural language processing so you can use this model as is or you can very quickly tune this model using your own data so using transfer learning and do everything this from very simple ui uh just think uh about jumpstart uh as a set of advanced models like gpt2 bird different flavors of resnet and you can super quickly leverage this model of fine tune build your own and use it and do it really in matter of minutes and lastly no code machine learning capabilities canvas and canvas gives uh to business analyst and to end tool to low data set do exploration also visualization and and run out ml on this data set and end up with a model and you can run already prediction on on the model every single one single uh ui without a really deep understanding what machine learning is how you define metrics what is machine learning model performance and so on so it's really accessible and you can give this tool to business users and wrapped so if you're interested really to to have more insight into uh different low code no code capabilities like data wrangler jumpstart canvas just browse aws webinar library and you'll see there are also webinars in depth describing this offering as well let's look what we are going to see today three use cases in first use case we predict patient readmission in the hospital uh we we train multi-class classifier we prepare data using data wrangler and then run autopilot in the second use case we we deep we dive deep into a financial services data set we use loan defaults data set again we prepare data with a data wrangler and run out a pilot experiment we're using a tubular data set from london club and we we we do the binary classification meaning we define if this specific loan is going to be default or not and the last lap we work with time series time series data set from global historical climatology network data set we extensively use data wrangler to to do feature engineering on the data set and to prepare this time series data set for autopilot and then we run out a pilot experiment but our goal is to predict an average temperature for a specific day and as a bonus we also show today how we can use sagemaker python sdk programmatically as a notebook and we provide source code and you can see you can run everything programmatically in your pipeline or your specific workflow okay uh first of all uh let's look at amazon sagemaker data wrangler so but before i start with the data wrongly it's important to understand sagemaker autopilot is a standalone thing so you can generally take data set tabular data set and give it unprocessed to autopilot and this is also a beautiful autopilot so the pilot automatically infras use case what it is linear regression or or binary classification multi-class classification it automatically does feature engineering and data pre-processing uh processing your categorical features processing your numerical features scaling your features for example or are handling mixing data and so on and this is all done automatically based on your data but sometimes if you can pre-process your data and do some some feature engineering before you you you give data to our ma you can achieve even better results and for this you can use data wrangler completely visual tool so let's jump into the high level definition high level uh workflow of data wrangler so first of all your select data sets and you can select data sets from different data sources you can connect amazon athena directly and load data from uh tables uh through query you can of course tap into the data set which stored on amazon s3 you can also go to amazon red shift or you can also use snowflake access to to get your data so you load uh one data set or multiple data set into the data wranglers and you can do visualization with a set of predefined diagrams and visualization you can run your own visualization and then you you you do uh the set uh flow of some transformation feature engineering uh data cleansing enrichment and and so on at the end you produce a so-called flow file that in combination with your data creates an end-to-end workflow that you can use in your production environment your operational environment so you can take any data that applies this flow and produce a final data set data wrangler flow integrated uh with amazon's maker pipeline so you can run it directly from amazon sagemaker pipeline as a processing job uh you can also ingest data directly into a sagemaker feature store without intermediate steps process your features in data running js directly into the feature store uh very convenient or you can run data wrangler processing as a stand-alone processing job as a part of the bigger pipeline or just a part run from the notebook and process the data visually it looks uh as a following you first you you select data that you want to to import select source or add data connection you can import data in various file formats data language supports csv parket files database tables supports different set of delimiters you can define if file has a header or not so you have all these options on user interface you can implement as i said different visualization there are a set of pre-configured visualizations like histograms and scatter plots books whisker plots line plots different bars and so on if you don't have a suitable visualization you can implement your own use an altair frame set framework it's very flexible in terms of data analysis and transformation this is what data wrangler is all about you have over 400 built-in data transformations machine learning focused so you can manage your columns like renaming joining splitting dropping column uh you can do different things based on regex like finding and replacing you can handle missing values missing numeric or missing categorical values with different imputation strategies you can balance your data set if you have unbalanced data set using quite advanced strategies as well uh and you can implement also your own transformation and by spark sql or python pandas that's very broad range of tools that is available in in data wrangler another very interesting option in data wrangler you can run so-called quick model and quick model takes a subset of your data and run a random forest model on on on this data and gives you indication first of all what model performance can be achieved on this data uh in terms of different metrics like f1 and it also shows you the feature importance also how specific features in in your data set affects a target and you can use this quick models to estimate what is impact your data transformation on the data set can have for example you run click model you see its specific performance and then you go you implement a couple of new features so do some feature engineering for example do one hot encoding or scale your numeric feature you run again uh this quick model and you see how the model for example accuracy uh changes or you see how the feature important changes so it's very important interactive process that gives you immediate feedback on on your transformations and dataronder gives the possibility to visually create workflows you can combine different data sets using joints you can also split data sets by delimiter or by different rules so you can prepare your train test validation data sets and you can specify different destinations for your target data set and you can specify multiple destinations in parallel for example you can create a workflow that will uh do some data pre-processing uh then implements feature engineering feature are ingested into feature store directly and then for example you can store your data set in some location in s3 for further use okay we will look at data data wrangler today as i said we do some data pre-processing for autopilot but now let's jump to autopilot and uh before we go into the demo let's see how sagemaker autopilot works in the nutshell you provide data set you say what is target attribute or target column and then sagemaker autopilot does the rest so autopilot analyzes your data infers problem type is it linear regression or binary classification or multi-class classification it handles uh your features for example do something about your categorical numeric missing data implements and reputation strategies does feature engineering then selects couple of models and implements pipelines with these models including the model hyper parameter optimization and in the end you have a set of artifacts which include different metrics like a model matrix model itself so models itself all models are trained by by searchmaker autopilot you can specify how many models are trained and by default we train 250 models uh then set of notebooks with source code with the pipelines and data preparation data exploration so you can use it as is or you can use code snippets in your project in your pipelines and it also generates an explanability report so to see how a model results are explained by your data and if we go a little bit deeper and see how sage america implements this workflow we have different stages in the workflow sagemaker processes the data does all the data split into validation and training uh folds it also creates a search engineering pipeline depending on your on your data it also does some some transformation and use different model types for example it uses linear regression sagemaker autopilot uses deep learning multi-layer perceptron model and also diffuse round trees models for each of the models each maker autopilot builds a pipeline including feature engineering and hyper parameter optimization and autopilot runs these pipelines in parallel so you you train so autopilot trains 250 different models for you and then then you have this models ranked by your objective metric you you select all subject matter could be accuracy it could be f1 could be area under curve and you also have a possibility automatically deploy model introduction all these functionality is accessible through a simple user interface inside search maker studio literally you point to s3 bucket if you have your data set on the s3 you specify a couple of uh things like a target column uh of course it's integrated into security controls you can specify vpc as an attachment security groups encryption key for your s3 data for your module artifacts and so on uh you also specify if you want to run a complete experiment can take multiple hours or you can won't run only a short experiment you can limit time you can limit amount of jobs created by all models created by autopilot so you can you have full control of what is going on there and you also specify what model evaluation metric you would like to optimize and you have full visibility and progress autopilot shows you in user interface what what current stage autopilot is is working on what jobs are there you can go to each of these descriptions each job is also available uh to browse and to to get details uh in aws console sagemaker console or through api so this is completely white box out i made uh you can also anytime stop the whole process if you think it goes wrong direction or you're already happy with the performance and you also can browse the source code generated by autopilot for example model creation pipeline or explore hyper parameter ranges how it's exactly optimized and re-run it with your own settings or use it in in in your pipeline and you can override multiple things in in autopilot some of them you can provide your own evaluation metric objective metric to optimize you can provide your own hyper parameter ranges uh you can provide what uh compute instances sagemaker autopilot uses what algorithms are considered and so on so you have these sets of knobs to turn and to optimize autopilot okay it's time for a demo everything again repeat um i repeat here everything what you're going to see today is available publicly as aws machine learning low code immersion day just go there and and browse it you can follow the notebooks a as i showed you or you can do on your own pace you can go back you can experiment you can change code of course uh use your own data set so it's really rich experience and a lot of information there let's start with the first lap in this lab we're going to train multi-class classifier on a hospital readmission data set this data set has 10 years of data of clinical care contains 130 us hospitals and has some passion demographics some laboratory data 70 000 rows and 15 features uh first we're going to do some feature engineering data visualization using data wrangler and then we run this data set process data set as an autopilot experiment i'd like to to say here you don't need to pre-process a data set before start an autopilot experiment you can give your data to the autopilot as is autopilot is designed to do data processing future engineering handle different data types and different situations like missing data combinations of features and so on but sometimes you can achieve better results if you do data pre-processing and some initial feature engineering and then pass a data set uh to to an autopilot so you can implement the kind of pipelines first you process data with with data wrangler do feature engineering and then you run an autopilot experiment to train and do hyper parameter tuning and to produce a most optimal model let's go to the lab itself i'm running here a public aws machine learning law called inversion day so all notebooks all data sets and instructions uh tips and hints all available publicly uh you can look at your own pace come back here uh use this code experiment with this code and so on so it's it's really a great deal of resources in in this workshop prerequisite for running this lab if you want to to do a loan you must have your sage makers to the environment setup how to set up this environment everything describes here step by step what you have to do you go to your account and create a search maker domain you can use a quick start or you can create a domain in a specific vpc you create the am roll uh you configure your domain you you start your domain creation and then you start your stage maker studio so i assume you have this already and then jump directly to tape maker studio i'm starting with with this lab here a health care and life sciences lab and as i said we're going to predict hospital readmission to get the data and the notebooks the source code again follow this instructions so you have to open your sagemaker studio go to terminal and run this couple of code so creating directory follow code no code you install unzip then we get source code and data set and we unzip and we end up with this folder in studio with data set and a notebook so let's let me go to studio i assume you're familiar with studio interface if not it's very simple to open launcher you either can go to file and say new launcher or you click this button and your launcher will be started and launcher your central hub that allows you to start different things in in studio you can start new data wrangler flow we're going to use it today or you can work with a feature group uh you can you work with ml projects and so on autopilot experiment again go to to start it today if you want to start system terminal just click here and you're in system terminal don't forget to to run this code to get the data set and the source code okay i have already data set in the folder in search maker studio and i have a notebook you can open the notebook very simple notebook we load this data set we look at this data set as as said it has 15 features and one target column target call called readmitted and it represents basically after how many days a patient readmitted back to the hospital and so we have some values zero if passion has re was readmitted in less than 30 days over 30 days and know if there is no record to free admission and we have three classes here so this is multi-class problem and we want to predict this problem and then we have some information race and gender and age some demographics of how many times in the hospital we have some numeric data on amount of laboratory procedures procedures medications and so on diagnosis and uh we have some also categorical data as you see a lot of sources known you have full description of the data set in the notebook or in in the instructions i copied this data set to the s3 you just aws command line comment and i need this path to the s3 object because now i'm going to start data wrangler to pre-process the data so again to start data wrangler the easiest way you go to launcher and say a new data flow i'll start and we want to import new data set the data set on the s3 and i can specify exactly this file hit go strong packet name of course and hit again and we have this data set the data wrangler does a preview and you have different controls how can you load this data set into memory everything what we are going to do today uh and now on the screen with data wrongly this is in memory processing and data wrangler runs in my search maker studio if you go to the running terminals on camera and kernel you can see exactly what instance is data wrongly running and this is ml m5 forex large with the 16 virtual cpus and 64 gigabytes of memory so the controls that you have here you specify what is a file type and you see data wrangler can accept parquet json json lines org and we can also specify first row with header we can specify the delimiter and we can do the sampling which is very important for big data sets you can specify sample size if you don't want to load full data set in memory and you can specify how data wrangler samples the data from this data set so we can take first k or do the random or stratified let's say i i say i would like to have stratified and we know the data set is 70 000 k so let's let's let's do here take only 40 000 and now i need to column to do the certification and i take my target column which is readmitted and then i can import okay dataset is loaded now and first what we can do we can first browse the data we can see the data types here and data wrangler automatically infers the data types if some data type is incorrect you want to change you just do it here and this is captured as part of your transformation first of all would like to create a visualization so i'm going to analyze this step and select what type of visualization i would like to have here and say we would like to have the feature correlation we select feature correlation here we can apply a name and we select what correlation type we're interested in could be linear it could be non-linear so let's select linear and hit preview and data wrangler now calculates feature cross correlation it takes probably 30 40 seconds to calculate all this okay we have no analysis right now and um data wrangler estimated or calculated feature correlation so we have for each feature with each and we have correlation metrics so we we can infer some useful information here so we save this visualization like we can use it later and now let's create a new one and let's create a quick model so to see what kind of performance can be achieved on this data set i would call it quick and we need to select a label which is readmitted and we again click preview and it takes probably a minute for data wrangler to to create a quick model so what is what is happening uh behind the scene here uh data wrangler does some um data pre-processing and for example uh algorithm and codes categorical features to vector and does some encoding for for labels then it takes 70 percent of the data and trades a random forest algorithm and after a train trend for forest algorithm it calculates the performance and it's all it's actually everything written here how many observation we trained 10 trees and now we see that f1 score of the model is 0.48 on the test set and we also have feature importance here okay let's save it so you see it's very easy to do the visualization and exploratory analysis of the data with data rounder now let's do some feature engineering we go back to the data flow and we add transform here so we have two steps the first load and the second the second data types and let's add a new step and we for example would like to handle to manage our columns again i i do quite arbitrary data processing here and feature engineering depending on your specific use case and data set you can do what you think is important for this data set and look what is available in the in the toolbox and process your data so i would like to drop a couple of columns that i think it's not important again based on the analysis not important for for the model so let's let's let's drop these columns where we have a lot of missing data we drop this one you can select multiple column in one operation we drop this one we drop gender and number of procedures and number of outpatient every time you click preview these transformations are applied to your data and you have processed data set already on the screen and if you're happy with result of the transformation you hit add and this transformation added as a step to your flow let's add another step and let's handle categorical values now and for example i would like to do one hotend code with categorical column called trace you can also specify handling strategy so what to do with with the invalid value and i would like to keep it you can draw plus which is also normal practice and you specify what kind of output style you would like to have a vector i would like to have columns and then you again hit preview and you see that we have this one hot encoding at the end of the data set added we have these columns with the zeros and ones and original columns column is is removed so we implemented one hotend coding and we click add okay and so you can do additional transformations uh additional analysis is up to you what you think when it's enough to massage the data uh to do the feature engineering so at this point i would like already to export my data you have multiple options how you can export data from data wrangler this is the easiest way probably in this screen you can hit export data button and the data will be exported what we have now in the memory the data set is already processed here uh this data set you can export so-called in co2 to s3 to expert data you have to specify s3 location let's call it connection and action and you can specify file type you can select pocket delimiter compression and of course you can specify encryption key for for your data we click export data it takes probably 20 seconds to write data on s3 we have it already this is location we copy and just get file name run aws s3 list on this location and this is a file name so we need the pass to to the object the transform data set uh to provide it to the pilot experiment uh now we run a new autopilot experiment the easiest way to go to launcher and click new autopilot experiment and i have to specify here name let's call it passion transmission lab1 and we enter s3 bucket location and copy paste it from here and we need object itself this is named like this by datawrangler and we have to specify target now so you see the autopilot already read the data and we have our all columns here so you see we have only columns that in the data set so we dropped couple of columns in the transformation phase and this columns are not anymore here so this is transform data set and readmitted is our target we can how to deploy model at the end of the experiment by keeping this on i don't want to auto deploy models so i switch it off and now we're going to advance settings so we see what you can change here of course you can change machine learning problem type you can keep it on outer i can explicitly specify this is multi-class classification and objective metric i would like to have f1 macro here and how i would like to run my experiment if i want a complete experiment or only the pilot yes i would like to have a complete experiment with 250 candidates and you can specify the different uh limits here for example how long each trial can run how many candidates much shop run time for for for each candidate and so on you can specify the different security things like execution rule encryption vpc and so on attachment to a specific search maker project and text so from operational perspective it's quite elaborate settings so let's check in that i have everything here and we also have to specify where i would like to store all artifacts and we can use basically the same location just write out filed so i'm ready to run experiment if i click create experiment i redirected to experiment progress control control pane and i see the different stages of autopilot experiment so first we do the pre-processing then generate candidate definition pipelines we do the feature engineering model tuning explainability report and insights report the full experiment on on this data set will generate 250 models and it takes probably about two two and a half hours so you see it's already started as a preprocession and we we're going to see all uh jobs all uh trials started by autopilot here you can also go to our aws console stage maker console and you can browse all of the pilot jobs here for example go to processing drops and we see some some jobs in process and this is creating pipelines and this is our experiment as you see patient readmission lab one go back to studio at any point you can stop experiment if you for example want to change something or happy with the result we don't have any results here because it's still pre-processing as i said it probably takes about two hours as we are running a cooking show here i'm going to stop here and come back when the experiment is ready now our autopilot experiment is done and you can browse all experiments and trials and all the autopilot experiments in search maker resources pane you go to this pane by clicking on on this icon and you can select the different widgets you can access the projects for example for data wrangler features strobe pipelines and so on and to access sagemaker autopilot experiments you have to go experiments and trials and sagemaker experiment will be one of those jobs in this list so i click on our patient readmission prediction experiment and i click describe out ml drop and i see that the job is finished this is result so this is the best model with our objective metric which is 0 4 0 1 and this is our objective so our optimization of objective and we have some other metrics like recall accuracy precision balance accuracy f1 marker and linear algorithm you also have a full set of jobs that sagemaker run so the different models available here for example if we go to this model and click open model details we can see what is the status we see this is a multi-layer perceptron fully connected network algorithm problem type job name associated with this model model name and so on but let's go back and browse for the best model so these models are ranked based on our objective objective metric of course you can based rank based on accuracy or other metrics and let's go to the best model and look into the details open model details and see this is the best the winning algorithm was a deep learning fully connected fat forward network we also have some explanability report so for each of their label under 30 days over 30 days no data no no readmission we have information how each feature is important for prediction of the specific label we have all the full set of metrics here and we have set of winning hyper parameters for this model and so what we can infer here for example we see the activation function [Music] we see some regular regularization parameters like a dropout and embedding size we see layers so three layers with a 200 150 neurons learning rate for example patch size and and so on if we're happy with this model we can also deploy modules directly from this screen so we click here deploy model we can select parameters for real-time endpoint of sagemaker i'm going to deploy right now or you can take this model artifact and create a batch transform batch in france for example so it is it's up to you what you are going to do with this modern artifact if we go back to the description screen to experiment screen we have two buttons here one for candidate generation notebook and one for the data expiration notebook so if you open it this notebook is generated specifically for this project and you can import so instantiate this notebook in in your local directory and then we see here that you have full source code for example creating candidate pipelines and so what we see here that sagemaker generated nine machine learning pipelines and using three algorithm and you can see here this is one pipeline uh using each boost algorithm this is also used in exit boost which just has different settings i have also boost this is linear learner so for linear regression exe boost again each boost and somewhere we go to here this is mlp so this is pipeline with our convenient algorithm and you can go to date expiration book again so you have uh some uh analysis on on your on your target label so how you distribute it if you have balance data set or unbalanced data set with the data sampling finding duplicate rows uh cross column statistics and so on again you can instantiate it and use it in this project or you can use copies code snippets from uh from this in in your other projects so this is fully transparent what is going on behind the scene okay i think we done with this lab you can go to the workshop and run the same notebooks the same experiment with this data set you can apply different data pre-processing using data wrangler or you can use this data set directly without any pre-processing to run out a pilot experiment let's move to the second lab now in the second lab we also take a tabular dataset and run an autopilot experiment with dataset we try to train a binary classifier it's a little bit different use case we use the data from a lending cloud and it contains complete loan data for all loans and we try to predict which loan is going to default and which is not to run the lab you have to copy first source code and the data exactly as a lab 1 it's all publicly available in aws workshop so you have to copy paste these comments into terminal in studio and data will be downloaded into your local directory and extract it here after that i am going to run this notebook the notebook exactly we follow the same procedure in lab number one we look at the data set some features are numeric some features are categorical and loan status is our target column we upload data set from efs to to look to to s3 and interesting we have here two parts of the data set part one and part two we are going to join this two data set in data wrangler and produce in one data set and then we do some processing and resultant data set we we're going to [Music] give to sagemaker autopilot so let's start with data wrangler flow again go to launcher and start a new data flow go to import our data set specify s3 and i need a pause and this one it's part one so we click import and we go to import again and we import the second data set hit import so now you see we have two data sets and now we're going to join so we select write data set and then go to select left and right and configure we want to have enough join on id and you have preview as you see here we say we have some reference data about a loan taker like um employee title homeowner shape annual income and so on and this data set is about loan itself so we hit preview and this is our join data set and we click add and this is our data set it's already in flow okay let's do some feature engineering and data transformation so first of all i would like to drop the column that we don't need go to banish columns and drop call id 0 and id1 always click preview because this transformation applied in memory and then you see it on the screen and if you satisfied with the result you can click add and this step is added in your flow so we remove two columns you can always review what you did here let's add some analysis here and let's implement table summary and table summary gives you descriptive statistics for each of the column so you have your data table here and then for each of the column you have statistics like a count of all values mean standard deviation mean and marks so it could be useful for further analysis so we click preview and then save and let's do also some visualization we can use a histogram and for example we would like to to take purpose of the loan you can select color and faucets and here we take clone status so we compare our target with a specific feature called purpose here and we have different histograms for each of the labels okay let's let's do some feature transformations for feature engineering so one of the most common used transformation is scaling of numeric data so we can go to them process numeric and we can apply scale value and we can select scalar here i use standard scale and let's select column for example clearly normally you have to scale all numeric columns but for this example i'm going to scale only let's say loan amount and we preview and add this transformation so you can continue with with this engineering for example to handle categorical columns we'll also go to the categorical we implement one hotend code and we take one of them categorical columns here for example purpose of the loan specify handling strategy and output style for example i would like to have it in columns preview and add and and so on for example for this specific example what you can do you see the employee title is a text column here you can recognize this text again very simple you add a transformation and see what is available for for text so featurizing text and we can for example do the vectorization and we can apply takenizer we can specify some some some parameters here and we select column of course employee title and output format let's say vector and preview and if you look at the result you see we have a new column employee title featurized and this is vector of employee title so we edit so you can go on and on add your own transformation but we stop here and now we would like to export data in this lab we going to use another option how we can export data from data wrangler so we're going to add a destination here s3 and here i just specified a data set name and i have to specify csv location again i take one of the string and i can add destination now as soon as i have a destination i can create a processing drop i select this destination node you can also specify encryption key you can name your job and specify what compute instances you need to run your job and run your job the job is run outside of stage maker studio so if you go to aws shmaker console you're going to see this processing job here which is just started this is our job here so you see we have two inputs because we have two parts and data wrangler going to process it and then processing output it's going to put it into this location and s3 this job normally takes say five minutes to complete let's wait till it finished okay the datum ranger processing drop is done it's completed took six minutes now we have to take the file file path and the file is copied on the s3 by data wrangler processing drop just list okay and this is our file let's start sagemaker experiment again go to launcher and click new autopilot experiment and we call it low bonds and now we have to specify this key of course in your automated pipeline you don't need to copy paste all this but i do so we have to specify the target remember autopilot don't know doesn't know what what target is and target is loan status here and you also can select if you want to auto deploy the best model after the experiment is finished so i select off because i want to deploy my own and we can keep machine learning problem time at autumn and i run the full experiment and basically that's it you can specify your production environment can specify encryption key and ebs volume encryption key for processing instances again if you do it everything in your pipelines through api you use just parameter and parameters to specify all this so i think we ready to run experiment we just have to say we're all artifacts are going to be saved select this and we can start experiment again we redirected to progress screen with steps what autopilot is doing here pre-processing generating different candidate definition pipelines with different models and different pre-processing feature engineering then the selected models are going through model tuning and autopilot generally explainability report and inside support and at the end of of the search maker experiment you are going to see 250 model tuning jobs each module tuning jobs is registered at switchmaker experiment so you can browse and see details for each detail for each of their of the model tuning jobs again the full experiment takes on this data set probably about two hours so i'm going to stop here and come back when experiment is ready how the pilot experiment is ready and we have a winner the best model again the model models are ranked here based on the objective and objective if f1 in this case you can specify your own objective in the best model you can go immediately to the best model and few model details exactly as in demo one we see importance of the features for each of the labels we see different metrics of the model and we see the best combination of hyper parameters in this case the winning algorithm is exposed not deep learning so you you cannot predict really what algorithm will be the best here but we see that exit boost is the best in this case you can also deploy this model we didn't select automated deployment so you can take this model and deploy on your own if we had selected automated deployment we would have in endpoints a new endpoint deployed by autopilot and this endpoint can serve already a real time request and real time inference okay i think this is concludes the second lab and now we are going to the source one we move now to the left number three number number three and in this demo we try to handle time series prediction autopilot can tackle regression classification tags tasks on time series data or sequence data in general autopilot uses a special library ks feature extract to extract additional features on time series and autopilot uses additional features on time series to to run to create the model and run the training and do the prediction let's look at list of this feature just to features just to understand what's going on behind the scene so autopilot uses this library and we have a lot of features that can be extracted from the time series for example abs energy and fault correlation all these features can be extracted and used as additional features on the data set and autopilot can run the regression classification tasks using these features so let's try to do this and of course as with two previous labs i'm using publicly available workshop i'm using this cross industry lab and to get the date and source code again you have to copy paste this set of commands into your studio terminal it will copy the zip file and extract and you have data set and a notebook so let's go to search maker studio and this is a notebook i do usual thing i take the data set from efs from stage maker studio and copy it to sv to be able to use it in data wrangler i'm also starting data wrangler and uh load in this data set into the flow i have already created the data flow and applied some transformation and some visualization just be conscious of time i just go now quickly through the list of transformations that are applied you see we have already 18 different transformations to prepare this time series data for autopilot let's start with the source data the source data we have different features like id and and here which is string by the way and not date time we have some other columns we have some categorical columns and we have numerical columns and the column that provides some data for us is maximum temperature for this particular date and minimum temperature for this particular date and temperature is in celsius so we have to divide by 10 and then you get the temperature in celsius the second step as you see we change the data type so we change the data type for timestamp from string to datetime and it's correctly recognized by datawrangler next step we have been missing data on time series and we provide timestamp column and we can select the strategy this is forward field in this case then we handle missing uh for the temperature minimum then we create a new column called average temperature and we use a python from the script here just create a new additional feature it's very simple we just take a name of two these two columns then we drop multiple columns that we don't need for further processing and again as i go through these steps you see how the data set transformed so this is our data set before column drop and this is drop code select and i have this data set so on the screen i have always data set represented how it is in memory then we have additional custom step and i take only data points so i'm using by spark sql here i take in only data points after 1995 year 1995 because we have some missing values before so i do resemble again resampling is one of the transformation from time series specifically for time series and i resample based on the calendar day and i take a mean between different numeric values so the sampling voltage sampling does in this case if you have multiple numeric values for a particular day the algorithm average these values and write one value for a particular day so this is our data set the next step is also specific for time series i extract year months and day as a separate columns you see from timestamp you can extract to any part of the timestamp then i drop columns that i don't need again so i drop so i don't need this concept i drop them i do resampling again on this one and this case on the weak frequency again i average all values for the week and have only one value for a week here so we see it here in the data in the data set then again i have custom step i do rounding up to the next two decimals i drop columns t max and t minimums that i don't need because i'm only interested in average temperature i apply some validation you can have also validation transform so i validate that my year date timestamp is always correct then i do the imputation of missing values on the numeric column and again using mean strategy you have a selection of different strategies can i do approximate median or mean and the next two steps i do legend the first i lack a year because i have weekly frequency and i take 52 weeks so it's exactly a year so this this column additional it's a year lag and next step i do again lag but one week so this additional column is uh one week lag and again i drop columns that i don't need time stamp and my final data set is exactly average temperature lag year and lag one week when we go back to data flow i added here destination which is s3 meaning i can always create a job and specify this destination and if i run a job data wrangler create processing job search maker processing job transform the data set based on the on the steps and saves the output data set to the specified s3 location okay now we have a file exported file from datawrangler with transform dataset and we can start as sagemaker autopilot experiment so click create a multiplot experiment and copy paste the path to the file you can preview the dataset and you see it's exactly this transform data set with the average temperature average temperature like one year and average temperature will collect one week so we name it and prediction and i'm going to leave everything on outer so i don't want auto deploy and advanced settings keep machine learning problem type and outer and run the full experiment as always uh nothing you hear of course you can adjust the number of candidates but leave it at 250 and we just specify as always allocation for experiment artifacts click create experiment of course i have to select the target which is temperature and then create an experiment now we have to wait until experiment finished okay our experiment is finished now and we have the best model let's look at job profile we see that autopilot detected this problem type as a regression with a correct which is correct and we have of course our settings here input data [Music] model and if we go back to the trials so we see the best model we can browse the best model details winning algorithm algorithm is mlp and of course we have again full data here on the performance so for example we see the mean absolute error is 32 is 3.2 grams celsius it's not so bad and we have a normal metrics common metrics for for regression we have also links to all artifacts input data training and validation split transform training validations plates feature engineering code model itself and explainability artifact and of course you can always deploy model as an endpoint real-time endpoint for the sagemakers so we've seen that autopilot is also able to handle time series with additional feature extraction time series feature extraction and can be also very useful to handle this specific type of problems this also concludes the lab number three in the last lab we are going to look how you can access all functionality of stage maker autopilot from api or python sdk it's quite simple three steps and first step you create out ml job uh using for example uh both three sdk uh you have to set up input data config output data config user specific execution role and assign a job name and then you run autopilot experiment after all the pilot experiment is ready you can get detailed information on all model candidates again i'm using botox 3 sdk here hdi and you can browse all candidates and then you can deploy the best model candidate here for example we we create model uh using the best candidate insurance containers create search maker endpoint for real time inference and then you can use endpoint this notebook example is available under this link you can click or scan with your mobile phone and now go briefly to the notebook and again i'm using one of the data sets here tabular data sets and run in multi-class classifier so what we're doing here we're preparing the data and now we start using autopilot api so i'm configure how the pilot you can specify all parameters that we were using on user interface specify whether my input data is coming from where all artifacts should be saved and launching autopilot experiment i can also track the experiment in progress via api and browse the results for example list all candidates and here have access to the best candidate so it's very simple to integrate autopilot api into your pipeline into your workflow and use from your notebook now we at the end of our webinar so what's next first of all we'll take a look at available resources and documentation you can run the same demos that we just run here just click on the on the link one qr code and reach out to us with any additional questions and this email address for the first steps with autopilot and datawrangler i suggest to start with search maker documentation some links are on this page for more details you can look into these blog posts and on automl paper with a lot of additional information how our tml works and for those who would like to be hands-on this page presents a collection of workshops and examples this concludes our workshop thank you for your attention and have fun with sagemaker autopilot
Original Description
Amazon SageMaker Autopilot automatically builds, trains, and tunes the best machine learning models based on your data, while allowing you to maintain full control and visibility. Amazon SageMaker Autopilot eliminates the heavy lifting of building ML models, and helps you automatically build, train, and tune the best ML model based on your data. In this hands on virtual workshop, you'll learn how you can use SageMaker Autopilot to automatically create machine learning models with full visibility.
Learning Objectives:
* Objective 1: Learn how to create a training experiment.
* Objective 2: Learn how to identify and deploy the best performing model from the training experiment.
* Objective 3: Learn how to deploy the model to production with just one click.
***To learn more about the services featured in this talk, please visit: https://aws.amazon.com/sagemaker Subscribe to AWS Online Tech Talks On AWS:
https://www.youtube.com/@AWSOnlineTechTalks?sub_confirmation=1
Follow Amazon Web Services:
Official Website: https://aws.amazon.com/what-is-aws
Twitch: https://twitch.tv/aws
Twitter: https://twitter.com/awsdevelopers
Facebook: https://facebook.com/amazonwebservices
Instagram: https://instagram.com/amazonwebservices
☁️ AWS Online Tech Talks cover a wide range of topics and expertise levels through technical deep dives, demos, customer examples, and live Q&A with AWS experts. Builders can choose from bite-sized 15-minute sessions, insightful fireside chats, immersive virtual workshops, interactive office hours, or watch on-demand tech talks at your own pace. Join us to fuel your learning journey with AWS.
#AWS
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from AWS Developers · AWS Developers · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Using Microsoft Active Directory across On-premises and Cloud Workloads
AWS Developers
What is Cloud Computing with AWS? | Hebrew Webinar
AWS Developers
Best Practices for Getting Started with AWS | Hebrew Webinar
AWS Developers
Best Practices for Using AWS Identity and Access Management (IAM) Roles
AWS Developers
Building Scalable Web Apps | Hebrew Webinar
AWS Developers
Dev & Test on the AWS Cloud | Hebrew Webinar
AWS Developers
Storage & Backup on AWS | Hebrew webinar
AWS Developers
Disaster Recovery on AWS | Hebrew Webinar
AWS Developers
AWS Israel News | Episode 1
AWS Developers
Security Best Practices on AWS | Hebrew Webinar
AWS Developers
Ready: Introduction to AI on AWS | Hebrew Webinar
AWS Developers
Set: What is ML for developers? | Hebrew Webinar
AWS Developers
Go!: Building your own ChatBot with Amazon Lex | Hebrew Webinar
AWS Developers
And Beyond: Amazon Sagemaker | Hebrew Webinar
AWS Developers
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech Talks
AWS Developers
Understanding AWS Secrets Manager - AWS Online Tech Talks
AWS Developers
Best Practices for Building Enterprise Grade APIs with Amazon API Gateway - AWS Online Tech Talks
AWS Developers
Build, Train and Deploy Machine Learning Models on AWS with Amazon SageMaker - AWS Online Tech Talks
AWS Developers
AWS Israel News | Episode 2 | re:Invent
AWS Developers
AWS Floor28 News - January
AWS Developers
AWS Floor28 News - February - Hebrew
AWS Developers
AWS Floor28 News - March - Hebrew
AWS Developers
AWS Floor28 News - April - Hebrew
AWS Developers
AWS Floor28 News - May - Hebrew
AWS Developers
Authentication for Your Applications: Getting Started with Amazon Cognito - AWS Online Tech Talks
AWS Developers
AWS Floor28 News - June - Hebrew
AWS Developers
AWS Floor28 News - July - Hebrew
AWS Developers
Enriching your app with Image Recognition and AWS AI Services - AWS Webinar - Hebrew
AWS Developers
Personalize, Forcast, and Textract - AWS Webinar - Hebrew
AWS Developers
Managing Your ML Development Lifecycle with Amazon SageMaker - AWS Webinar - Hebrew
AWS Developers
Running your ML code in Amazon Sagemaker - AWS Webinar - Hebrew
AWS Developers
Get Started in Minutes with Amazon Connect in Your Contact Center - AWS Online Tech Talks
AWS Developers
AWS Floor28 News - August - Hebrew
AWS Developers
AWS Floor28 News - September - Hebrew
AWS Developers
Deep Dive on Amazon EventBridge - AWS Online Tech Talks
AWS Developers
Advanced Serverless Orchestration with AWS Step Functions - AWS Online Tech Talks
AWS Developers
Living on the Edge - an Introduction to Amazon CloudFront and Lambda@Edge - Hebrew Webinar
AWS Developers
AWS Floor28 News - October - Hebrew - YouTube
AWS Developers
What's New with AWS Storage - AWS Online Tech Talks
AWS Developers
How to Build a Compelling Migration Business Case Using TSO Logic - AWS Online Tech Talks
AWS Developers
Configuring and Managing Amazon S3 Replication - AWS Online Tech Talks
AWS Developers
AWS Floor28 News - November - Hebrew
AWS Developers
Using Relational Databases with AWS Lambda - Easy Connection Pooling - AWS Online Tech Talks
AWS Developers
AWS Floor28 News - December 2019 - Hebrew
AWS Developers
AWS Floor28 News - January 2020 - Hebrew
AWS Developers
Top 10 Data Migration Best Practices - AWS Online Tech Talks
AWS Developers
How to Use Azure Active Directory with AWS SSO - AWS Online Tech Talks
AWS Developers
AWS Tips & Tricks - Amazon Redshift Advisor - Hebrew
AWS Developers
AWS Tips & Tricks - Amazon Redshift Elastic Resize - Hebrew
AWS Developers
AWS Tips & Tricks - Amazon Redshift Spectrum - Hebrew
AWS Developers
AWS Tips & Tricks - Savings Plans & Cost Explorer - Hebrew
AWS Developers
AWS Tips & Tricks - Amazon Redshift Concurrency Scaling - Hebrew
AWS Developers
AWS Tips & Tricks - Training Models with Amazon SageMaker - Hebrew
AWS Developers
AWS Tips & Tricks - Auto Model Tuning with Amazon SageMaker - Hebrew
AWS Developers
AWS Tips & Tricks - Amazon Comprehend - Hebrew
AWS Developers
Understanding High Availability and Disaster Recovery Features for Amazon RDS for Oracle
AWS Developers
Amazon Forecast – Forecasting - From Months to Days (Hebrew)
AWS Developers
Visualize your data with Amazon QuickSight (Hebrew)
AWS Developers
Amazon Kendra (Hebrew)
AWS Developers
AWS Floor28 News - AI/ML Special Edition
AWS Developers
More on: ML Pipelines
View skill →Related Reads
📰
📰
📰
📰
How to Undo git reset — hard and Recover Lost Commits
Medium · DevOps
️ Init Containers Explained: Preparing Applications Before Startup
Medium · DevOps
Stop Writing Terraform Like It’s a Script: Build It Like a Software Project
Medium · DevOps
Our Docker Bridge Ran Out of IPs. New Containers Couldn’t Connect for 4 Hours.
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI