No-Code ML using AWS SageMaker Canvas
AI is now transforming just about any business today and now it is even more accessible with No-Code solutions. No-code platforms rely entirely on visual tools such as drag-and-drop components for code generation. AWS provides one such No-code ML service called AWS SageMaker Canvas, it empowers anyone to build, train and test a machine learning model without writing a single line of code. In this article, I will take you through the process of using AWS SageMaker Canvas with a sample project. You can use this aws service for 750 hours per month free for the first 2 months with the AWS Free Tier. You can read more about the pricing here.
I will be using a sample ML project to showcase a demo of how to use Canvas, the idea here is to understand how we can leverage the No-code service provided by AWS. The data I will be using in this demo is the university admission where our target would be to predict the chance of admission based on the CGPA and different exam scores. This will be a regression task but you can perform any type of ML task in Canvas.
Go ahead and log into your AWS account, if you don’t have one, you can set up a free tier account here. Below is the step-by-step setup of AWS SageMaker Canvas including the images and gifs.
Step-1: First let’s setup Canvas, go to the services option on the top left corner and search for SageMaker and open the service. On the left sidebar, you can find Canvas click on it and you will be taken to a homepage where you can find ‘Create a SageMaker Domain’ Click on it. You will be shown two options to choose from ‘Quick Setup’ which is easy or ‘Standard Setup’ which has more privacy settings, you can choose what you want depending on your use case, I will be choosing ‘Quick Setup’ for the demo purpose. Give any name you prefer to the domain and Create a new IAM role by clicking on the dropdown and then scroll to the bottom to hit submit. It might take a few minutes to get the service running, after that, you will see a launch dropdown button on the right side, go there and select Canvas. After a few minutes, you will see the Canvas user interface. The whole process of setting up Canvas can also be seen in the gif below.
Canvas service provides some datasets by default for you to get started. As soon as you start the Canvas service it will automatically create an S3 bucket for you where all the default datasets are loaded for you. You can use these datasets to get started or explore Canvas if you want. In my case, I will be creating a separate S3 bucket and uploading a sample dataset to use in Canvas to build the model.
Step-2: To create an S3 bucket and upload your data simply go to S3 service by searching in the services tab and clicking on Create a bucket option give a custom name to your bucket and leave the other settings as default and click on ‘Create bucket’. After your bucket is created go inside the bucket and upload the data. The default buckets created by Canvas and the process to create your own bucket are shown in the below gif.
Canvas service also provides the interface to explore and perform data analysis or any data manipulation that is required before you create your model. Everything is provided to you on click and drag and drop. There are different functions to choose from. Any data modification can be done like removing rows on a custom condition, replacing values, etc. With all this included there is also a tab provided to perform custom data visualization. You can see these things in the gif below.
Step-3: Go back to Canvas UI, now let’s import our dataset, explore data analysis and visualization options provided, create a model, and generate predictions. Go to datasets from the left sidebar and see you can import your data from a wide variety of sources, in our case it will be Amazon S3. I will select the file which I uploaded to my S3 bucket. After that go to My Models from the left sidebar and click on ‘New Model’ give the model a custom name and select from the three options ‘Predictive, Image or text Analysis’. In my case it is predictive. Go ahead and select the data which we imported in Canvas. After you do so, you will see an interface on the left top to select your target variable from the dropdown. As soon as you do so, you will see the distribution of the target variable, and the other options are enabled to perform data analysis and visualizations. In the center just above the data which is available in preview mode, you will find many options like Extract, Remove Rows, Replace, Functions, and Data Visualizer. In the data visualizer on the analytics tab, you can see the correlation matrix for all features. Also, you can create a preview model which will be made on a subset of data to give you an idea of how your model will perform so that if need be you can change data or make modifications before building a full model. You can go and explore these options. A glimpse of each option can be seen in the gif below. After you are done exploring you can close the data visualizer and click on ‘Quick Build’ It will create a model for you, and it might take a few minutes but it will sacrifice accuracy for speed. If you found the dropdown of quick build you might have also seen another option called ‘Standard Build’. It will take longer to build a model but will create a more accurate one but will sacrifice speed. You can go with your preference. I will be using ‘Quick Build’ since this is a demo. After the model is built you can see the Model status and below you can see the basic summary, in the bottom right corner you can see the impact of each feature on the prediction. Now switch to the Scoring tab just below the Model Status. You can see the predicted vs actual graph where you can find the residual for each prediction. You can also see the advanced metrics towards the right side in the same tab. It would look something like this, you can hover over it to find more details. You can even download the metrics.
Now let’s use the model to predict. Canvas provides both ‘Batch Prediction’ and ‘Single Prediction’ Click on the Predict and you can choose which prediction you want to do. I will be showing a single prediction. Change the input of the features and click update the model will return the prediction. I covered a lot in this step you can see the whole process in the below gif.
From the left sidebar if you go to My Models you can see the model card will be created for you. You can also share your model with your colleagues who are using SageMaker.
Apart from creating your custom models, AWS SageMaker Canvas provides Ready-to-use-Models. I will show you how you can use these models for sentiment analysis and Named Entity Recognition (NER). Just go to ready to use models tab from the left sidebar and select the model which you want to use. You can see the process in the below gif.
One important thing you need to do is Log out from Canvas and delete the domain if you don’t want to incur any charges unintentionally. You can simply delete the model in the My Models tab and log out from the console. See the gif below.
That’s it, this should give you a good understanding of the power of AWS SageMaker Canvas and how you can leverage it in your own use case.
This concludes the article. If you found this helpful follow for more such content. You can also connect with me on LinkedIn to discuss more on Data Science and MLOPs.