<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Olalekan Fuad Elesin</title>
    <description>The latest articles on DEV Community by Olalekan Fuad Elesin (@oelesin).</description>
    <link>https://dev.to/oelesin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F352098%2F96b4200d-9625-4be9-b2dd-5b990890d1c0.jpeg</url>
      <title>DEV Community: Olalekan Fuad Elesin</title>
      <link>https://dev.to/oelesin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oelesin"/>
    <language>en</language>
    <item>
      <title>AutoML Just Got a Lot More Automated with CD4AutoML and AWS Cloudformation Registry and CLI —…</title>
      <dc:creator>Olalekan Fuad Elesin</dc:creator>
      <pubDate>Sun, 21 Jun 2020 10:20:38 +0000</pubDate>
      <link>https://dev.to/oelesin/automl-just-got-a-lot-more-automated-with-cd4automl-and-aws-cloudformation-registry-and-cli-10h3</link>
      <guid>https://dev.to/oelesin/automl-just-got-a-lot-more-automated-with-cd4automl-and-aws-cloudformation-registry-and-cli-10h3</guid>
      <description>&lt;h3&gt;
  
  
  AutoML Just Got a Lot More Automated with CD4AutoML and AWS Cloudformation Registry and CLI — Developer Preview
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--noHWMzyE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ApUPlJAu2jeSVze7zzbwkkw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--noHWMzyE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ApUPlJAu2jeSVze7zzbwkkw.png" alt="CD4AutoML Cloudfromation Registry and CLI — Developer Preview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Last month I published a tutorial on &lt;a href="https://dev.to/oelesin/automate-the-end-to-end-automl-lifecycle-with-amazon-sagemaker-autopilot-and-amazon-step-functions-42di-temp-slug-901228"&gt;automating end-to-end AutoML lifecycle with Amazon SageMaker Autopilot and Amazon Step Functions&lt;/a&gt; including &lt;a href="https://github.com/OElesin/sagemaker-autopilot-step-functions"&gt;code sample on GitHub&lt;/a&gt; and &lt;a href="https://miro.medium.com/max/1400/1*1RBNjcCy0_D7xApSL6fx_A.jpeg"&gt;the architecture&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  CD4AutoML with Amazon Cloudformation
&lt;/h4&gt;

&lt;p&gt;Today, I would like to introduce you to my newest project, &lt;a href="https://github.com/OElesin/cd4automl-cloudformtion-resource"&gt;CD4AutoML via Amazon Cloudformation&lt;/a&gt;for deploying managed end-to-end automated workflows for AutoML. CD4AutoML Cloudformation third-party resource type is now available in public beta — developer preview.&lt;/p&gt;

&lt;h4&gt;
  
  
  CD4AutoML, AWS Cloudformation and IaC
&lt;/h4&gt;

&lt;p&gt;According to Gartner’s Magic Quadrant for Cloud AI Developer Services report&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By 2023, 40% of development teams will be using automated machine learning services to build models that add AI capabilities to their applications, up from 2% in 2019.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This means that development teams will look to leverage DevOps principles to automate processes surrounding the development and deployment of automated machine learning models. Training automated machine learning models is one piece of the entire machine learning landscape. &lt;a href="https://papers.nips.cc/paper/5656-hidden-technical-debt-in-machine-learning-systems.pdf"&gt;Deploying, monitoring, and maintaining these models&lt;/a&gt; make up larger parts of the landscape which might turn out to be overhead for development teams. The question then is, how might we enable development teams to use automated machine learning, remove the burden of maintaining the machine learning systems whilst embracing existing DevOps culture? Enter CD4AutoML via Amazon Cloudformation.&lt;/p&gt;

&lt;p&gt;CD4AutoML allows you to train, deploy, and manage end-to-end automated machine workflows on managed cloud infrastructure.&lt;/p&gt;

&lt;p&gt;Amazon Cloudformation allows you to define the desired AWS resources along with their configurations and connections in blueprint files called AWS Cloudformation templates. These templates then run within the Amazon Cloudformation console to provision the defined infrastructure.&lt;/p&gt;

&lt;p&gt;Using CD4AutoML support for AWS Cloudformation Registry and CLI, you can, with not more than 6 lines of configuration parameters, provision an entire end-to-end AutoML system. This comes with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fully managed AutoML training infrastructure with retraining capabilities&lt;/li&gt;
&lt;li&gt;Fully managed model serving infrastructure over REST API.&lt;/li&gt;
&lt;li&gt;Model monitoring for model drift detection.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This means that we can now benefit from DevOps practices, deploying AutoML workflow Infrastructure as Code, IaC, when using AWS stack.&lt;/p&gt;

&lt;h4&gt;
  
  
  Integrate CD4AutoML with your AWS Account
&lt;/h4&gt;

&lt;p&gt;As previously mentioned, deploying CD4AutoML workflow in your AWS Account is as simple as 6 configuration parameters in your AWS Cloudformation template. You are also required to have your training data in Amazon S3, CSV format and grant CD4AutoML AWS Account ID read access to your training data. Once all these are set, you are only aws cloudformation deploy command away from your managed AutoML system with CD4AutoML.&lt;/p&gt;

&lt;h4&gt;
  
  
  A Real Life Use Case
&lt;/h4&gt;

&lt;p&gt;Let’s walk through the process so you see how easy it really is.&lt;/p&gt;

&lt;h4&gt;
  
  
  Grant Access to Training
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Version": "2008-10-17",
  "Id": "Policy15237839393",
  "Statement": [
    {
      "Sid": "AllowCD4AutoML",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::&amp;lt;CD4AutoML-AWS-AccountID&amp;gt;:role/CD4AutoMLWorkflow"
      },
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::my-training-data-bucket/data-path/\*"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Setting up your workflow
&lt;/h4&gt;

&lt;p&gt;Now that you have granted to your Amazon S3 Bucket containing your training data, you can deploy your CD4AutoML workflow as AWS Cloudformation resource. Your AWS Cloudformation template would look similar to the template below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**Resources** :
**MyDirectMarketingPredictionWorkflow** :
**Type** : CD4AutoML::Workflow::Deploy
**Properties** :
**S3TrainingDataPath** : 's3://my-training-data-bucket/examples/direct-marketing/bank-additional-full.csv'
**TargetColumnName** : 'y'
**NotificationEmail** : 'test@example.com'
**WorkflowName** : 'workflow-v1'
**Schedule** : 14


**Outputs** :
**MyDirectMarketingPredictionWorkflowApi** :
**Value** : !Ref MyDirectMarketingPredictionWorkflow
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The resource parameters for CD4AutoML::Workflow::Deploy resource can be found &lt;a href="https://github.com/OElesin/cd4automl-cloudformtion-resource"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Create Stack
&lt;/h4&gt;

&lt;p&gt;Finally, once we have our templates defined, we can upload them to the AWS CloudFormation console, and hit ‘Create Stack’ and see all our required resources come to life for us. You can also run the AWS Cloudformation command using the AWS CLI command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws cloudformation deploy --stack-name &amp;lt;Your\_stack\_name&amp;gt; --template-file &amp;lt;path-to-template&amp;gt;.yaml 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y3qPxY2a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AjJgv8zdOesz8oAR5xpJxoA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y3qPxY2a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AjJgv8zdOesz8oAR5xpJxoA.png" alt="CD4AutoML Deploye dCloudfromation resource in customer account"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources deployed and managed in CD4AutoML AWS Account&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zJS5J8Sl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Am1O26YHqnLjSK9LckRvQ5Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zJS5J8Sl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Am1O26YHqnLjSK9LckRvQ5Q.png" alt="Some deployed resources in CD4AutoML AWS Account"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  The Future with CD4AutoML and Cloudformation Registry and CLI
&lt;/h4&gt;

&lt;p&gt;Using AWS Cloudformation templates with CD4AutoML to deploy end-to-end automated machine learning workflows help you save time, reduce errors, cut back on repetitive work, and removes complexity managing ML systems. As AutoML evolves, adopting IaC will become an integral component to enable development teams continually deploy AutoML models to production with minimal management overhead.&lt;/p&gt;

&lt;p&gt;CD4AutoML is in active development and will continue to build features that focus on business outcomes and developer productivity with Automated Machine Learning.&lt;/p&gt;

&lt;p&gt;To request access for CD4AutoML Developer Preview, please visit the &lt;a href="https://github.com/OElesin/cd4automl-cloudformtion-resource/issues"&gt;CD4AutoML Cloudformation resource GitHub project&lt;/a&gt; and create an issue.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>cloudcomputing</category>
      <category>aws</category>
      <category>cd4automl</category>
    </item>
    <item>
      <title>Automate the end-to-end AutoML lifecycle with Amazon SageMaker Autopilot and Amazon Step Functions…</title>
      <dc:creator>Olalekan Fuad Elesin</dc:creator>
      <pubDate>Sun, 24 May 2020 13:34:48 +0000</pubDate>
      <link>https://dev.to/oelesin/automate-the-end-to-end-automl-lifecycle-with-amazon-sagemaker-autopilot-and-amazon-step-functions-g7o</link>
      <guid>https://dev.to/oelesin/automate-the-end-to-end-automl-lifecycle-with-amazon-sagemaker-autopilot-and-amazon-step-functions-g7o</guid>
      <description>&lt;h3&gt;
  
  
  Automate the end-to-end AutoML lifecycle with Amazon SageMaker Autopilot and Amazon Step Functions — CD4AutoML
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y-07rdeG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AMHfdrKCO_gz9r8KYzXbXcg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y-07rdeG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AMHfdrKCO_gz9r8KYzXbXcg.png" alt=""&gt;&lt;/a&gt;CD4AutoML with Amazon SageMaker Autopilot — Olalekan Elesin&lt;/p&gt;

&lt;p&gt;In my previous posts (linked below), I wrote about automating machine learning workflows on Amazon Web Services (AWS) with Amazon SageMaker and Amazon Step Functions. In those posts, I only provided GitHub Gists and minor code snippets but no fully working solutions. This left a lot of readers asking a lot of questions on the technical solutions either privately or via comments. I kinda solved a problem, but created more problems. This led to me ask myself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How might I help my readers better achieve the job they wanted done anytime they employed my technical blog posts&lt;/strong&gt;?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Answer is what you’re now reading. In this, I provide a working project on deploy &lt;a href="https://github.com/OElesin/sagemaker-autopilot-step-functions"&gt;automate an end-to-end AutoML lifecycle with Amazon SageMaker Autopilot and Amazon Step Functions&lt;/a&gt;, which I now call &lt;strong&gt;CD4AutoML&lt;/strong&gt;. With end-to-end, I am not referring to calling the Amazon SageMaker Endpoint from a notebook. I am talking about having a publicly available serverless REST API (Amazon API Gateway) connected to your Amazon SageMaker Endpoint in a fully automated way. This means that you can serve predictions in your applications with a fully automated workflow requiring no developer input apart from committing code to GitHub.&lt;/p&gt;

&lt;p&gt;Enough talk, you are already asking: How do I get started? Everything to get you started is available in the GitHub repository below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/OElesin/sagemaker-autopilot-step-functions"&gt;OElesin/sagemaker-autopilot-step-functions&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PEd-vYny--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A1RBNjcCy0_D7xApSL6fx_A.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PEd-vYny--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A1RBNjcCy0_D7xApSL6fx_A.jpeg" alt=""&gt;&lt;/a&gt;Automate the end-to-end AutoML lifecycle with Amazon SageMaker Autopilot on Amazon Step Functions — CD4AutoML&lt;/p&gt;

&lt;p&gt;This project is designed to get up and running with &lt;a href="https://github.com/OElesin/sagemaker-autopilot-step-functions"&gt;CD4AutoML&lt;/a&gt; ( &lt;strong&gt;I coined this word&lt;/strong&gt; ), much &lt;a href="https://martinfowler.com/articles/cd4ml.html"&gt;CD4ML&lt;/a&gt; from &lt;a href="https://martinfowler.com/articles/cd4ml.html"&gt;Martin Fowler’s blogpost&lt;/a&gt;. This project indeed completes the “Automated” part of AutoML.&lt;/p&gt;

&lt;h4&gt;
  
  
  Technologies:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Amazon Cloudformation&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/step-functions/"&gt;Amazon Step Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/sagemaker/autopilot/"&gt;Amazon SageMaker Autopilot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Amazon CodeBuild&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws-step-functions-data-science-sdk.readthedocs.io/"&gt;AWS Step Functions Data Science SDK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;AWS Serverless Application Model&lt;/li&gt;
&lt;li&gt;Amazon Lambda&lt;/li&gt;
&lt;li&gt;Amazon API Gateway&lt;/li&gt;
&lt;li&gt;Amazon SSM Parameter Store&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this project, you move out of the play/lab mode with Amazon SageMaker Autopilot into running real-life applications with Amazon SageMaker Autopilot.&lt;/p&gt;

&lt;h4&gt;
  
  
  State machine Workflow
&lt;/h4&gt;

&lt;p&gt;The entire workflow is managed with AWS Step Functions Data Science SDK. Amazon Step Functions does not have service integration with Amazon SageMaker Autopilot out of the box. To manage this, I leveraged Amazon Lambda integration with Step Functions to periodically poll for Amazon SageMaker Autopilot job status.&lt;/p&gt;

&lt;p&gt;Once the AutoML job is completed, a model is created using the Amazon SageMaker Autopilot Inference Containers, and an Amazon SageMaker Endpoint is deployed. But there is more…&lt;/p&gt;

&lt;p&gt;On completion of the deployment of the Amazon SageMaker Endpoint, an Amazon CodeBuild Project state machine task is triggered which deploys our Amazon API Gateway with AWS Serverless Application Model.&lt;/p&gt;

&lt;p&gt;See workflow image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r5bH9Ko_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/374/0%2AW-XSK7MB9R4ATNmi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r5bH9Ko_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/374/0%2AW-XSK7MB9R4ATNmi.png" alt="CD4AutoML: Continuous Delivery for AutoML with Amazon SageMaker Autopilot and Amazon Step Functions"&gt;&lt;/a&gt;CD4AutoML: Continuous Delivery for AutoML with Amazon SageMaker Autopilot and Amazon Step Functions&lt;/p&gt;

&lt;h3&gt;
  
  
  Future Work
&lt;/h3&gt;

&lt;p&gt;I have plans to abstract away all deployment details and convert this into a Python Module or better put AutoML-as-a-Service. Users can either provide their Pandas DataFrame or local CSV/JSON data, and the service takes care of the rest. Users will get a secure REST API which they can make predictions in their applications.&lt;/p&gt;

&lt;p&gt;If you’re interested in working on this together, feel free to reach out. Also feel free to extend this project as it suites you. Experiencing any challenges getting started, create an issue and I will have a look as soon as I can.&lt;/p&gt;

&lt;h3&gt;
  
  
  Further Reading
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Part 1: &lt;a href="https://medium.com/@elesin.olalekan/automating-machine-learning-workflows-with-aws-glue-sagemaker-and-aws-step-functions-data-science-b4ed59e4d7f9"&gt;Automating Machine Learning Workflows with AWS Glue, Amazon SageMaker and AWS Step Functions Data Science SDK&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Part 2: &lt;a href="https://dev.to/oelesin/automating-machine-learning-workflows-pt2-sagemaker-processing-sagemaker-and-aws-step-functions-3an5-temp-slug-2013947"&gt;Automating Machine Learning Workflows Pt2: Amazon SageMaker Processing and AWS Step Functions Data Science SDK&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/step-functions/"&gt;Amazon Step Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html"&gt;Amazon Step Functions Developer Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws-step-functions-data-science-sdk.readthedocs.io/"&gt;AWS Step Functions Data Science SDK&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kindly share your thoughts and comments — looking forward to your feedback. You can reach me via &lt;a href="//mailto:elesin.olalekan@gmail.com"&gt;email&lt;/a&gt;, follow me on &lt;a href="https://twitter.com/elesinOlalekan"&gt;Twitter&lt;/a&gt; or connect with me on &lt;a href="https://www.linkedin.com/in/elesinolalekan/"&gt;LinkedIn&lt;/a&gt;. Can’t wait to hear from you!!&lt;/p&gt;

</description>
      <category>automl</category>
      <category>aws</category>
      <category>awsstepfunctions</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Continuously deploy to Expo with Amazon CodeBuild</title>
      <dc:creator>Olalekan Fuad Elesin</dc:creator>
      <pubDate>Sun, 17 May 2020 09:04:18 +0000</pubDate>
      <link>https://dev.to/oelesin/continuously-deploy-to-expo-with-amazon-codebuild-47o9</link>
      <guid>https://dev.to/oelesin/continuously-deploy-to-expo-with-amazon-codebuild-47o9</guid>
      <description>&lt;p&gt;&lt;a href="https://medium.com/swlh/continuously-deploy-to-expo-with-amazon-codebuild-84d19924224?source=rss-98b05140c1ad------2"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LQolfq6m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1496/1%2AeYkLfkO7R2RlaTZR2r2fYQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is going to be a really short post on what I learned in the past one week. For the past one week, I had been working on a mobile…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/swlh/continuously-deploy-to-expo-with-amazon-codebuild-84d19924224?source=rss-98b05140c1ad------2"&gt;Continue reading on The Startup »&lt;/a&gt;&lt;/p&gt;

</description>
      <category>continuousdeployment</category>
      <category>amazonwebservices</category>
      <category>reactnative</category>
      <category>expo</category>
    </item>
    <item>
      <title>Using artificial intelligence to differentiate between human and synthetic hair wigs with Amazon…</title>
      <dc:creator>Olalekan Fuad Elesin</dc:creator>
      <pubDate>Sat, 02 May 2020 07:19:10 +0000</pubDate>
      <link>https://dev.to/oelesin/using-artificial-intelligence-to-differentiate-between-human-and-synthetic-hair-wigs-with-amazon-54cm</link>
      <guid>https://dev.to/oelesin/using-artificial-intelligence-to-differentiate-between-human-and-synthetic-hair-wigs-with-amazon-54cm</guid>
      <description>&lt;h3&gt;
  
  
  Using artificial intelligence to differentiate between human and synthetic hair wigs with Amazon SageMaker
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--62Qv-aVb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A3q79lx7S4E6yRetKAx-BDw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--62Qv-aVb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A3q79lx7S4E6yRetKAx-BDw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The hair extensions industry is a multi-billion dollar global industry. &lt;a href="https://www.scmp.com/business/china-business/article/3011657/chinas-wig-capital-has-designs-africa-us-tariffs-loom"&gt;According to China Customs&lt;/a&gt;, China’s wig exports reached excess of $2 billion dollar, with US being the largest destination. However, wig manufacturers in China are moving focus from US to Africa.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--irJdkOU6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/972/1%2ArFy9LzT4WCS1HKhZTePw_Q.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--irJdkOU6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/972/1%2ArFy9LzT4WCS1HKhZTePw_Q.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Customer Problem Discovery
&lt;/h3&gt;

&lt;p&gt;After speaking with a handful of ladies, one of the major challenges experienced by shoppers is &lt;strong&gt;Trust&lt;/strong&gt; which is rooted in vendors selling synthetic hair (low quality) and human hair. Also speaking with vendors, it turns out that differentiating between both synthetic hair and human hair wigs can be challenging. One only knows when the hair is made or wig is bought and used. This appears like a classic task for &lt;a href="https://www.tensorflow.org/tutorials/images/classification"&gt;Image Classification&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;p&gt;In this tutorial, we will train an image classification model using &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/image-classification.html"&gt;Amazon SageMaker built-in algorithm&lt;/a&gt;. Images are organized in folders named for corresponding classes, &lt;strong&gt;human-hair&lt;/strong&gt; and &lt;strong&gt;synthetic-hair&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;images\_to\_classify

├── human-hair
│ ├── 1.jpg
│ ├── 2.jpg
| ├── 3.jpg
│ └── . . .
└── synthetic-hair
│ ├── 1.jpg
│ ├── 2.jpg
│ ├── 3.jpg
│ ├── . . .
└── . . .
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://gram-to-store-images.s3-eu-west-1.amazonaws.com/dataset/wigs/"&gt;sample dataset&lt;/a&gt; was scraped from &lt;a href="https://www.glamorousremihair.com/"&gt;GlamorousHair.com&lt;/a&gt; and is available on &lt;a href="https://aws.amazon.com/s3/"&gt;Amazon S3&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cwMyZs55--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AgonYgs08DAwcUEq7YYpXmQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cwMyZs55--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AgonYgs08DAwcUEq7YYpXmQ.png" alt=""&gt;&lt;/a&gt;Synthetic and Human Hair wig images. Courtesy: GlamorousHair.com&lt;/p&gt;

&lt;h4&gt;
  
  
  Hypothesis
&lt;/h4&gt;

&lt;p&gt;If we are able to differentiate between &lt;strong&gt;synthetic&lt;/strong&gt; and &lt;strong&gt;human hair&lt;/strong&gt; wigs with images right before customers complete their purchase, then we can help customers can build trust with hair vendors. We will know that we succeeded if we achieve &lt;strong&gt;65%&lt;/strong&gt; validation accuracy with our machine learning model.&lt;/p&gt;

&lt;p&gt;Jupyter Notebook available below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/OElesin/aws-samples/blob/master/sagemaker/HumanHairImageClassification.ipynb"&gt;OElesin/aws-samples&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/FZX4F5ty5sw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h4&gt;
  
  
  Hypothesis Validation
&lt;/h4&gt;

&lt;p&gt;Based on the acceptance criterion defined above hypothesis, we can proceed to deploy our model into production. The deployment is completed with the Amazon SageMaker Endpoint.&lt;/p&gt;

&lt;p&gt;First run, 10 epochs, with the following accuracy metrics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Train accuracy: &lt;strong&gt;1.000000&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Validation-accuracy: &lt;strong&gt;0.937500&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also trained on Spot instances saving &lt;strong&gt;69.8%&lt;/strong&gt; of the cost.&lt;/p&gt;

&lt;p&gt;Further model improvements, &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning.html"&gt;Amazon SageMaker Automatic Model Tuning&lt;/a&gt; will be used. For real-life, constant retraining of the model and evaluation with Human-In-the-Loop with &lt;a href="https://aws.amazon.com/augmented-ai/"&gt;Amazon Augmented AI (Amazon A2I&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This is my first recipe with &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/gs-studio.html"&gt;Amazon SageMaker Studio&lt;/a&gt;. A next step might be to train an &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/semantic-segmentation.html"&gt;image segmentation model&lt;/a&gt; to identify hair quality at pixel level.&lt;/p&gt;

&lt;p&gt;I hope to share more with you. If you enjoyed reading this, kindly share and comment. You can reach me via &lt;a href="//mailto:elesin.olalekan@gmail.com"&gt;email&lt;/a&gt;, follow me on &lt;a href="https://twitter.com/elesinOlalekan"&gt;Twitter&lt;/a&gt; or connect with me on &lt;a href="https://www.linkedin.com/in/elesinolalekan/"&gt;LinkedIn&lt;/a&gt;. Can’t wait to hear from you!!&lt;/p&gt;

</description>
      <category>humanhairwigs</category>
      <category>artificialintelligen</category>
      <category>imageclassification</category>
      <category>sagemaker</category>
    </item>
    <item>
      <title>Dear Product Manager, how NOT to fail your next Data Science Initiative</title>
      <dc:creator>Olalekan Fuad Elesin</dc:creator>
      <pubDate>Thu, 02 Apr 2020 07:08:12 +0000</pubDate>
      <link>https://dev.to/oelesin/dear-product-manager-how-not-to-fail-your-next-data-science-initiative-5d5p</link>
      <guid>https://dev.to/oelesin/dear-product-manager-how-not-to-fail-your-next-data-science-initiative-5d5p</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hLmLhSqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AMJAV4igxK8oUVKDzl7piFA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hLmLhSqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AMJAV4igxK8oUVKDzl7piFA.png" alt="How product managers should think of data science/AI initiatives — Olalekan Elesin"&gt;&lt;/a&gt;How product managers should think of data science/AI initiatives — Olalekan Elesin&lt;/p&gt;

&lt;p&gt;In the course of my career from a Software Engineer, Data Science Engineer, Data Landscape Engineer, Technical Product Manager, and now Product Manager, Data Science, I have built a series of failed and very successful data science projects. When I talk about successful, I mean huge business impact as measured by bottomline. See a few of my portfolio projects below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://medium.com/@elesin.olalekan/saving-millions-in-naira-with-simple-decision-tree-classifier-1c52ed44439c"&gt;Saving Millions in Naira with Simple Decision Tree Classifier&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/@elesin.olalekan/growth-hacking-with-data-science-600-increase-in-qualified-leads-with-zero-ad-budget-afe5a9b1f7c5"&gt;Growth Hacking with Data Science — 600% Increase in Qualified Leads with Zero Ad Budget&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://towardsdatascience.com/guide-your-next-property-investment-in-africa-with-data-science-5a9fd623bb52"&gt;Guide Your Next Property Investment in Africa with Data Science&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Based on these, I can share with you what works and does not work — although I am yet to write about the one(s) that failed. As a product manager, many a time, you are informed that your company is adopting or rather developing an AI Strategy or something close. However, you wonder to yourself how this translates to improving lives for your users or its impact on your next product feature. Please be aware you are not alone. Many a product manager struggle with this as well. The problem is not you nor your company’s data scientists. The challenge is how to translate your product understanding to what data scientists understand and vice-versa.&lt;/p&gt;

&lt;p&gt;In this short post, I share with you a framework that has worked for me over the years. What I share here are not only based on heuristics; I attended trainings such as &lt;a href="https://www.cloudera.com/about/training/courses/data-scientist-training.html"&gt;Cloudera Data Science&lt;/a&gt; and recently bagged a certification from Wharton Online AI for Business course:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youracclaim.com/badges/18a51bd8-f2cc-45e7-9984-2f69ba4a6332"&gt;AI for Business was issued by Wharton Online to Olalekan Fuad Elesin.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this post, we define a framework for Data Science and AI inclined projects. The goal of the framework is to create a repeatable execution model for DS/AI projects through shorter iterative cycles and strong focus on business/product outcomes. Following this framework, you will be guided through solving business/user problems with the scientific method, building new knowledge and data along the way. It is very important to note the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Data Science problem is NOT a Machine Learning problem.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data Science projects DO NOT necessarily need to begin with a machine learning model.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NOT all Data Science projects will result in a machine learning model.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Originally, solving business problems with &lt;a href="https://en.wikipedia.org/wiki/Data_science"&gt;Data Science&lt;/a&gt; or &lt;a href="https://en.wikipedia.org/wiki/Artificial_intelligence"&gt;Artificial Intelligence&lt;/a&gt; started out in &lt;a href="https://en.wikipedia.org/wiki/Statistical_model"&gt;Statistical&lt;/a&gt; and &lt;a href="https://en.wikipedia.org/wiki/Mathematical_model"&gt;Mathematical&lt;/a&gt; modeling techniques which are the basis of the scientific method. Furthermore, solving business problems with Statistical and Mathematical modeling techniques resulted from the inefficiencies in traditional software programs in accommodating variation in data using standard control flows, i.e &lt;a href="https://en.wikipedia.org/wiki/Conditional_(computer_programming)"&gt;“if…else” statements&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Project Framework
&lt;/h4&gt;

&lt;p&gt;The framework has its foundation in the &lt;a href="https://en.wikipedia.org/wiki/Cross-industry_standard_process_for_data_mining"&gt;CRISP DM&lt;/a&gt; (Cross-industry standard process for data mining). The starting point of applying this framework to a data science/AI project is that a clear &lt;strong&gt;business problem&lt;/strong&gt; , an &lt;strong&gt;assumption&lt;/strong&gt; of what the outcome of solving the problem and &lt;strong&gt;measurable signals&lt;/strong&gt; of the outcome are defined. Definitely, data is required as with any data project but data is not the starting point. This is because, if data is defined as the starting point, there is a possibility to confine our scope to &lt;strong&gt;ONLY&lt;/strong&gt; the data believe we have available. Technologies and machine learning techniques are least to know upfront, this is in the domain of our &lt;a href="https://en.wikipedia.org/wiki/Data_science"&gt;data scientists&lt;/a&gt; and machine learning experts to figure out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hLmLhSqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AMJAV4igxK8oUVKDzl7piFA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hLmLhSqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AMJAV4igxK8oUVKDzl7piFA.png" alt=""&gt;&lt;/a&gt;Dear product manager, data science should be part of your toolbox — Olalekan Elesin&lt;/p&gt;

&lt;h4&gt;
  
  
  Problem Formulation with Framework
&lt;/h4&gt;

&lt;p&gt;Having defined the individual components of the framework as outlined in the previous section, we define the smallest testable hypothesis which can be implemented within a short iteration and provides learnings in the direction of the ideal world, the defined outcome. See format and example below:&lt;/p&gt;

&lt;h4&gt;
  
  
  Format
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;We see/have&lt;/strong&gt; .&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We believe that&lt;/strong&gt;  &lt;strong&gt;will result in&lt;/strong&gt; .&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We will know&lt;/strong&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can read more on &lt;a href="https://www.thoughtworks.com/insights/articles/how-implement-hypothesis-driven-development"&gt;Hypothesis-Driven Development in this post from ThoughtWorks&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why?
&lt;/h4&gt;

&lt;p&gt;The goal is to aim for an assumption that can be implemented and tested within a &lt;strong&gt;4-week work window&lt;/strong&gt; or less. This is mainly due to scientific nature (&lt;em&gt;lots of uncertainties&lt;/em&gt;) of developing data science initiatives. As such, we learn faster in shorter iterations and demonstrate value quickly (&lt;em&gt;or park the idea for later if data collected informs us otherwise&lt;/em&gt;). This way, you will figure out measurable progress rapidly, not having to wait 8 to 18 months to know the idea was not worth it — think lean.&lt;/p&gt;

&lt;p&gt;At the completion of every work window, you should evaluate your desired outcome with defined measurable signals as checks that you are moving in the right direction.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Takeaways
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Focus on business/user problem not product feature&lt;/li&gt;
&lt;li&gt;If you don’t have an AI Strategy, ask why. If you need some guidance, let’s talk.&lt;/li&gt;
&lt;li&gt;Data Scientists are people, talk to them.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.amazon.com/Goal-Process-Ongoing-Improvement/dp/0884271951"&gt;Agile and Lean&lt;/a&gt; practices are not from Software Engineering originally. They can be adopted to Data Science as well.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope you found this resourceful. Kindly share your thoughts and comments — looking forward to your feedback. You can reach me via &lt;a href="//mailto:elesin.olalekan@gmail.com"&gt;email&lt;/a&gt;, follow me on &lt;a href="https://twitter.com/elesinOlalekan"&gt;Twitter&lt;/a&gt; or connect with me on &lt;a href="https://www.linkedin.com/in/elesinolalekan/"&gt;LinkedIn&lt;/a&gt;. Can’t wait to hear from you!!&lt;/p&gt;

</description>
      <category>productthinking</category>
      <category>artificialintelligen</category>
      <category>userresearch</category>
      <category>datascience</category>
    </item>
    <item>
      <title>How to train and serve deep learning models on low budget — $20 or less per month</title>
      <dc:creator>Olalekan Fuad Elesin</dc:creator>
      <pubDate>Thu, 27 Feb 2020 07:40:40 +0000</pubDate>
      <link>https://dev.to/oelesin/how-to-train-and-serve-deep-learning-models-on-low-budget-20-or-less-per-month-39ie</link>
      <guid>https://dev.to/oelesin/how-to-train-and-serve-deep-learning-models-on-low-budget-20-or-less-per-month-39ie</guid>
      <description>&lt;h3&gt;
  
  
  How to train and serve deep learning models on low budget — $20 or less per month
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SR5EcEPP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AcAyVJwjov_LS5A9DZNe9tg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SR5EcEPP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AcAyVJwjov_LS5A9DZNe9tg.png" alt=""&gt;&lt;/a&gt;How to train and serve deep learning models on low budget — $20 or less per month&lt;/p&gt;

&lt;p&gt;My friends, &lt;a href="https://medium.com/u/927b4b610b0c"&gt;Samuel James&lt;/a&gt; and &lt;a href="https://medium.com/u/471fe3ca1957"&gt;emmy adigun&lt;/a&gt;, and I recently submitted our project to the &lt;a href="https://fbai1.devpost.com/"&gt;Facebook’s AI Hackathon hosted on DevPost&lt;/a&gt;. The main hackathon requirement was to (as stated on the hackathon page):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Build a creative and well-implemented solution using PyTorch that can unlock positive impact on businesses or people. The solution can be a machine learning model, an application, or focused on a creative project like art or music — all built with PyTorch.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;None of us, at least I, had ever done anything with PyTorch. Besides, we had our separate daily jobs and we were pretty much a cross-continent distributed team. After a short call, we decided to help people eat healthier green by identifying diseased plants and fruits with artificial intelligence. With each of us possessing expertise in different parts of software engineering craft, we allocated our responsibilities as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://medium.com/u/471fe3ca1957"&gt;emmy adigun&lt;/a&gt;, being a user experience expert, to design the mobile app&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://medium.com/u/927b4b610b0c"&gt;Samuel James&lt;/a&gt;, the Chuck Norris of code, develop and train the deep learning model in PyTorch plus setting up the &lt;a href="https://expo.io/"&gt;mobile app with Expo&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;And I, coordinating and helping when I can.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With responsibilities, Sammy and I worked on the deep learning part together as this was new to both us. We started out searching for available &lt;a href="https://plantvillage.psu.edu/plants"&gt;dataset&lt;/a&gt; and using the &lt;a href="https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html"&gt;image classification tutorial&lt;/a&gt; on &lt;a href="https://pytorch.org/get-started"&gt;PyTorch&lt;/a&gt; website. Our starting point was &lt;a href="https://colab.research.google.com/"&gt;Google Colab&lt;/a&gt; to leverage free GPU instances. This, however, did not work out as planned as took longer than usual before the model training completed. Meaning, we to keep our laptops on for a long time. At this point, we split the work so as to deliver faster: Sam focused on developing the mobile app while I focused on PyTorch.&lt;/p&gt;

&lt;h4&gt;
  
  
  Welcome, &lt;a href="https://aws.amazon.com/sagemaker"&gt;Amazon SageMaker&lt;/a&gt;!
&lt;/h4&gt;

&lt;p&gt;We wanted to run on a budget as low as we could, thankfully we have &lt;a href="https://aws.amazon.com/"&gt;team AWS Account&lt;/a&gt; loaded with credits from AWS. I launched an Amazon SageMaker notebook instance with GPU (p2.xlarge), and got to work. We trained the PyTorch model successfully in good time and exported the model as &lt;a href="https://docs.python.org/3/library/pickle.html"&gt;pickled&lt;/a&gt; object in GPU and CPU versions. Here comes the hard part.&lt;/p&gt;

&lt;p&gt;We could have easily hosted the model on Amazon SageMaker, but this would cost us &lt;a href="https://aws.amazon.com/sagemaker/pricing/"&gt;about $100 a month&lt;/a&gt;. This is large portion of our AWS credits. Hence, we decided to be creative: Train on &lt;a href="https://aws.amazon.com/sagemaker"&gt;Amazon SageMaker&lt;/a&gt;, Deploy on &lt;a href="https://devcenter.heroku.com/articles/container-registry-and-runtime"&gt;Heroku Containers&lt;/a&gt;. Our idea is still an experiment, as such running on the free &lt;a href="https://www.heroku.com/pricing"&gt;Heroku pricing tier&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Training time: ~45 mins&lt;/p&gt;

&lt;p&gt;Total Cost: ~$5.00&lt;/p&gt;

&lt;h4&gt;
  
  
  Enter, &lt;a href="https://devcenter.heroku.com/articles/container-registry-and-runtime"&gt;Heroku Container Registry &amp;amp; Runtime&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;For me, this was more or less like the &lt;a href="https://en.wikipedia.org/wiki/Wonders_of_the_World"&gt;8th Wonder of the World&lt;/a&gt;: free docker runtime. I wrote a simple &lt;a href="https://flask.palletsprojects.com/en/1.1.x/tutorial/factory/"&gt;Python Flask api&lt;/a&gt; to serve, following the same pattern as hosting &lt;a href="https://github.com/OElesin/autogluon-tabular-sagemaker-container"&gt;custom models on Amazon SageMaker&lt;/a&gt;, built the docker container on my local and now time to push the image to Heroku Container Registry. This posed another issue as the image about 1.8GB in size and my internet upload speed was not fast enough, running for more than 1 hour. How to solve this? We got more creative.&lt;/p&gt;

&lt;p&gt;We setup an &lt;a href="https://aws.amazon.com/codebuild/"&gt;Amazon CodeBuild&lt;/a&gt; &lt;a href="https://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html"&gt;pipeline&lt;/a&gt; linked to our project GitHub repository. The idea behind the build was push our model serving container image to Heroku. For this to happen, we needed to include Heroku credentials in the build. As fast as we wanted to be, we are also security first. So, we saved our Heroku security credentials in &lt;a href="https://aws.amazon.com/systems-manager/"&gt;Amazon Systems Manager&lt;/a&gt; &lt;a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html"&gt;Parameter Store&lt;/a&gt;, and accessed at build time. With these setup, we were ready to go and as with every software project, nothing works the first time. However, we got it working. Our new build time: &lt;strong&gt;5 mins&lt;/strong&gt; , compared to &amp;gt;1 &lt;strong&gt;hour&lt;/strong&gt; when we run from my local machine. Now, we only commit to GitHub, AWS CodeBuild does the rest&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup time&lt;/strong&gt; : Friday night, 2 hours 30 mins&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total cost&lt;/strong&gt; : &amp;lt;$2&lt;/p&gt;

&lt;h4&gt;
  
  
  Finally, Automation. WHAT!!!@?
&lt;/h4&gt;

&lt;p&gt;Our goal, should we be named as winners, would be to scale solution from product and technical perspective. On the technical front, until we make money, we need to find a way to be agile with our software —infrastructure as code, continuous deployment, continuous delivery. What better place to do this, if not on Amazon Web Services Cloud. I will not be sharing the code to our repository, but will show you a glimpse of our architecture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SR5EcEPP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AcAyVJwjov_LS5A9DZNe9tg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SR5EcEPP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AcAyVJwjov_LS5A9DZNe9tg.png" alt=""&gt;&lt;/a&gt;How to train and serve deep learning models on low budget — $20 or less per month&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total cost&lt;/strong&gt; : ~ &lt;strong&gt;$20.00&lt;/strong&gt; per  &lt;strong&gt;month&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrapping Up
&lt;/h3&gt;

&lt;p&gt;For now, we are not able to share our code but I hope you got the idea and inspired you. We are not saying this is the best, however, constraints placed on us while working on this project forced to rethink our approach and come up with a creative solution to build within budget. If you have any questions, feel free to reach out to me or &lt;a href="https://medium.com/u/471fe3ca1957"&gt;emmy adigun&lt;/a&gt; or &lt;a href="https://medium.com/u/927b4b610b0c"&gt;Samuel James&lt;/a&gt;. You can reach me via &lt;a href="//mailto:elesin.olalekan@gmail.com"&gt;email&lt;/a&gt;, follow me on &lt;a href="https://twitter.com/elesinOlalekan"&gt;Twitter&lt;/a&gt; or connect with me on &lt;a href="https://www.linkedin.com/in/elesinolalekan/"&gt;LinkedIn&lt;/a&gt;. Can’t wait to hear from you!!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>sagemaker</category>
      <category>heroku</category>
      <category>pytorch</category>
    </item>
    <item>
      <title>Automating Machine Learning Workflows Pt2: SageMaker Processing, SageMaker and AWS Step Functions…</title>
      <dc:creator>Olalekan Fuad Elesin</dc:creator>
      <pubDate>Sat, 15 Feb 2020 13:17:07 +0000</pubDate>
      <link>https://dev.to/oelesin/automating-machine-learning-workflows-pt2-sagemaker-processing-sagemaker-and-aws-step-functions-5cn4</link>
      <guid>https://dev.to/oelesin/automating-machine-learning-workflows-pt2-sagemaker-processing-sagemaker-and-aws-step-functions-5cn4</guid>
      <description>&lt;h3&gt;
  
  
  Automating Machine Learning Workflows Pt2: Amazon SageMaker Processing and AWS Step Functions Data Science SDK
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BM16dRKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ASqEFm7t97p1IQ8S2JSKPdA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BM16dRKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ASqEFm7t97p1IQ8S2JSKPdA.png" alt=""&gt;&lt;/a&gt;Automating Machine Learning Workflows with Amazon SageMaker Processing, Amazon SageMaker and AWS Step Functions Data Science SDK&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@elesin.olalekan/automating-machine-learning-workflows-with-aws-glue-sagemaker-and-aws-step-functions-data-science-b4ed59e4d7f9"&gt;In the previous blogpost&lt;/a&gt;, I demonstrated how to automate machine learning workflows with AWS Step Functions from data preparation with PySpark on &lt;a href="https://aws.amazon.com/glue/"&gt;AWS Glue&lt;/a&gt; to Model (Endpoint) Deployment with &lt;a href="https://aws.amazon.com/sagemaker/"&gt;Amazon SageMaker&lt;/a&gt;. In this tutorial, I will repeat almost the same approach, however with a little adjustment in the data preparation phase.&lt;/p&gt;

&lt;p&gt;Not all data preparation in machine learning require distributed nature of PySpark. Hence, what happens if you don’t need PySpark? Would you need to run Glue Jobs anyway? You could, but would probably be wasting Glue compute resources. One more thing to consider is the use of external libraries with AWS Glue; you have to package external libraries as zip files and upload to some external location. This process in itself might not be user friendly especially when you want to focus only on building your machine learning pipeline.&lt;/p&gt;

&lt;p&gt;Enter &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/processing-job.html"&gt;Amazon SageMaker Processing&lt;/a&gt;, fully managed data processing and model evaluation solution. You can read more about &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/processing-job.html"&gt;Amazon SageMaker&lt;/a&gt;&lt;a href="https://aws.amazon.com/blogs/aws/amazon-sagemaker-processing-fully-managed-data-processing-and-model-evaluation/"&gt;processing in this blogpost from&lt;/a&gt; AWS. As of the time of this post, &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/processing-job.html"&gt;Amazon SageMaker Processing&lt;/a&gt; is not yet part of &lt;a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-service-integrations.html"&gt;AWS Step Functions Service Integrations&lt;/a&gt;, however, AWS Step Functions offers the flexibility to orchestrate AWS services with Lambda Functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prepare the workflow
&lt;/h3&gt;

&lt;p&gt;Knowing that &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/processing-job.html"&gt;Amazon SageMaker&lt;/a&gt; Processing is not natively integrated with AWS Step Functions, we will start by creating 2 Amazon Lambda functions that will orchestrate: &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/processing-job.html"&gt;Amazon SageMaker&lt;/a&gt; Processing Job creation and &lt;a href="https://docs.aws.amazon.com/sagemaker/latest/dg/processing-job.html"&gt;Amazon SageMaker&lt;/a&gt; Processing job status checker.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Once we have both functions in place, we are ready to define our workflow with the AWS Step Functions Data Science SDK. For more details about the &lt;a href="https://aws.amazon.com/about-aws/whats-new/2019/11/introducing-aws-step-functions-data-science-sdk-amazon-sagemaker/"&gt;AWS Step Functions Data Science SDK&lt;/a&gt;, you &lt;a href="https://medium.com/@elesin.olalekan/automating-machine-learning-workflows-with-aws-glue-sagemaker-and-aws-step-functions-data-science-b4ed59e4d7f9"&gt;can read my previous blogpost&lt;/a&gt; or visit the project page on &lt;a href="https://github.com/aws/aws-step-functions-data-science-sdk-python"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Amazon SageMaker Processing Jobs run processing scripts with pre-baked docker containers hosted on AWS ECR. Below, we will create a docker container with the necessary packages required for our processing job.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Note that you could as well achieve the above operation using &lt;a href="https://aws.amazon.com/cloudformation/"&gt;AWS Cloudformation&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Workflow Definition
&lt;/h4&gt;

&lt;p&gt;In my previous post, I demonstrated workflow definition steps from data preparation to model deployment. Since I am only replacing the AWS Glue Step, I will not go into the details of the model training and endpoint deployment steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Preparation with Amazon SageMaker Processing&lt;/strong&gt;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We created our create-processing-job Lambda function with &lt;a href="https://en.wikipedia.org/wiki/Convention_over_configuration"&gt;sensible defaults&lt;/a&gt; ensuring that we provide the minimum possible arguments as Amazon SageMaker Processing job configurations. Next we poll for the job status with a Lambda Function step every 60 seconds.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We then need to create the processing script, which will contain our data transformations and will be executed by Amazon SageMaker Processing on our docker container.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The above script is an example data preparation logic, depending on your use case and requirements, you might have more complex data transformation logic. Last step is to upload the processing script to an &lt;a href="https://aws.amazon.com/s3/"&gt;S3&lt;/a&gt; location.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ aws s3 cp scripts/preprocessing.py s3://my-code-bucket/processing/scripts/preprocessing.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Having completed the build up to our data preparation steps, we proceed to defining our machine learning steps. For the purpose of brevity, I defined these steps in my previous post, so I will not delve into the details, but show how to chain the respective steps together:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@elesin.olalekan/automating-machine-learning-workflows-with-aws-glue-sagemaker-and-aws-step-functions-data-science-b4ed59e4d7f9"&gt;Automating Machine Learning Workflows with AWS Glue, SageMaker and AWS Step Functions Data Science…&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ml\_steps\_definition = Chain([
    training\_step,
    model\_step,
    endpoint\_config\_step,
    endpoint\_step,
    workflow\_success
])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To build the entire workflow graph, we will make use of &lt;a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html"&gt;AWS Step Function Choice States&lt;/a&gt;, which adds a branching logic to our workflow. The choice state checks the status of the data processing job, and proceeds to next steps based on the job status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;check\_job\_choice = Choice(
    state\_id= **"IsProcessingJobComplete"**  
)

check\_job\_choice.add\_choice(
    ChoiceRule.StringEquals(variable=get\_processing\_job\_status.output()[**'Payload'**][**'ProcessingJobStatus'**], value= **'InProgress'** ),
    next\_step=get\_processing\_job\_status
)

check\_job\_choice.add\_choice(
    ChoiceRule.StringEquals(variable=get\_processing\_job\_status.output()[**'Payload'**][**'ProcessingJobStatus'**], value= **'Stopping'** ),
    next\_step=get\_processing\_job\_status
)

check\_job\_choice.add\_choice(
    ChoiceRule.StringEquals(variable=get\_processing\_job\_status.output()[**'Payload'**][**'ProcessingJobStatus'**], value= **'Failed'** ),
    next\_step=workflow\_failure
)

check\_job\_choice.add\_choice(
    ChoiceRule.StringEquals(variable=get\_processing\_job\_status.output()[**'Payload'**][**'ProcessingJobStatus'**], value= **'Stopped'** ),
    next\_step=workflow\_failure
)

check\_job\_choice.add\_choice(
    ChoiceRule.StringEquals(variable=get\_processing\_job\_status.output()[**'Payload'**][**'ProcessingJobStatus'**], value= **'Completed'** ),
    next\_step=ml\_steps\_definition
)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The choice state is explained as follows: if the processing job is running, it loops back to check the job status, if the job failed, the entire workflow is terminated and if the job is completed, it proceeds to the model training and endpoint deployment steps.&lt;/p&gt;

&lt;p&gt;Our complete machine learning workflow is chained together as the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ml\_workflow\_definition = Chain(
    [
        create\_processing\_job\_step, 
        get\_processing\_job\_status,
        check\_job\_wait\_state,
        check\_job\_choice
    ]
)

ml\_workflow = Workflow(
    name= **"MyCompleteMLWorkflow\_v2"** ,
    definition=ml\_workflow\_definition,
    role=workflow\_execution\_role
)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BM16dRKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ASqEFm7t97p1IQ8S2JSKPdA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BM16dRKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ASqEFm7t97p1IQ8S2JSKPdA.png" alt=""&gt;&lt;/a&gt;Automating Machine Learning Workflows with Amazon SageMaker Processing, Amazon SageMaker and AWS Step Functions Data Science SDK&lt;/p&gt;

&lt;p&gt;Create and execute the workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**try** :
    workflow\_arn = ml\_workflow.create()
**except** BaseException **as** e:
    print( **"Workflow already exists"** )
    workflow\_arn = ml\_workflow.update(ml\_workflow\_definition)

# execute workflow 
ml\_workflow.execute(
    inputs={
**'IAMRole'** : **sagemaker\_execution\_role** ,
**'EcrContainerUri'** : **'1234567890.dkr.ecr.eu-west-1.amazonaws.com/sagemaker-processing-container'** ,
**'S3InputDataPath'** : **f's3://{data\_bucket}/raw-data/'** ,
**'S3OutputDataPath'** : **f's3://{data\_bucket}/{processed\_data\_output\_path}/'** ,
**'S3CodePath'** : **'s3://my-code-bucket/processing/scripts/preprocessing.py'** ,
**'JobName'** : job\_name,   
**'ModelName'** : model\_name_,_  
**'EndpointName'** : endpoint\_name
    }
)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JksmTiDU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/302/1%2AC9aBTDFk7cao19AYTRyO2w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JksmTiDU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/302/1%2AC9aBTDFk7cao19AYTRyO2w.png" alt=""&gt;&lt;/a&gt;Successful machine learning workflow with Amazon SageMaker Processing, Amazon SageMaker and AWS Step Functions Data Science SDK&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In my previous post, I demonstrated how to create an end-to-end machine learning workflow on AWS using AWS Glue for data preparation. In this post, I swapped the data preparation component with Amazon SageMaker processing. Your choice of AWS Service to execute data processing job on depends on your use case. You can also use with &lt;a href="https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr.html"&gt;Step Functions service integration with AWS EMR&lt;/a&gt; to run your data preparation jobs which is also supported natively by the &lt;a href="https://github.com/aws/aws-step-functions-data-science-sdk-python/blob/6ca96bad71b02fcf961bf4b01bb88e2273579237/src/stepfunctions/steps/service.py#L152-L284"&gt;AWS Step Functions Data Science SDK&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Further Reading
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Part 1: &lt;a href="https://medium.com/@elesin.olalekan/automating-machine-learning-workflows-with-aws-glue-sagemaker-and-aws-step-functions-data-science-b4ed59e4d7f9"&gt;Automating Machine Learning Workflows with AWS Glue, Amazon SageMaker and AWS Step Functions Data Science SDK&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/step-functions/"&gt;Amazon Step Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html"&gt;Amazon Step Functions Developer Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws-step-functions-data-science-sdk.readthedocs.io/"&gt;AWS Step Functions Data Science SDK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/glue/"&gt;Amazon Glue&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kindly share your thoughts and comments — looking forward to your feedback. You can reach me via &lt;a href="//mailto:elesin.olalekan@gmail.com"&gt;email&lt;/a&gt;, follow me on &lt;a href="https://twitter.com/elesinOlalekan"&gt;Twitter&lt;/a&gt; or connect with me on &lt;a href="https://www.linkedin.com/in/elesinolalekan/"&gt;LinkedIn&lt;/a&gt;. Can’t wait to hear from you!!&lt;/p&gt;

</description>
      <category>stepfunctions</category>
      <category>workflow</category>
      <category>sagemaker</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
