The Startup
Published in

The Startup

Between Machine Learning PoC and Production

the final architecture of this article

Introduction

What is written in this article

  • How to proceed with data analysis in a PoC
  • How to proceed with the test operation of the machine learning PoC (the main topic of this article).
  • Architecture in each phase of PoC and test operation (the main topic of this article).
  • Additional things to consider for production operations

What is not written in this article

  • Details on exploratory data analysis
  • Details on preprocessing and feature engineering
  • Details on building predictive models
  • Lower layers than middleware (databases and web servers)
  • Consulting skills to handle Machine Learning PoC

Systems assumed in this article

  • Use a relatively small dataset, less than 100 GB
  • Handle data that can be stored in memory, rather than data in the hundreds of millions of records
  • Batch learning and batch inference
  • Not perform online (real-time) learning and inference
  • System construction proceeds in parallel with data analysis
  • Not have concrete requirements to create in the beginning so we build them as needed while proceeding

Data used in this article

  • initial.csv: Past credit information, to be used in PoC
  • 20201001.csv: Credit information for October 2020. In the test operation, this data will be handled as training data together with “initial.csv”.
  • 20201101.csv”: Credit information for November 2020. In the test operation, this data is handled together with “initial.csv” as training data.
  • “20201201.csv”: Credit information for December 2020. In test operations, this data is handled together with “initial.csv” as training data.
  • “20210101.csv”: Credit information for January 2021. In the test operation, we will start forecasting from this month.

Situation to be considered

Scope of the project in this article

Structure assumed in this article

PoC phase

Purpose of this phase

Architecture in this phase

Data validation

Exploratory data analysis

Verification of prediction accuracy

  • Logistic regression
  • Decision Trees
  • Random Forest
  • SVM
  • LightGBM

Preprocessing

Feature Engineering

Prediction

Supplement: Machine learning model management

Test Operation

The three phases of test operations

  1. Building data pipelines and semi-automated operations
  2. Implementation of regular operation API
  3. Migration to the cloud and automation of operations

Test Operation Phase 1: Building data pipeline and semi-automated operations

Purpose of this phase

Architecture in this phase

Data pipeline

Semi-automating operations

  • PoC Phase
  1. upload data for the forecast month
  2. Combine training data of previous months
  3. Preprocessing and feature engineering of training data
  4. Train model from training data
  5. Preprocess test data and do feature engineering
  6. Predict the test data using the trained model
  7. download the prediction result
  • Test Operation Phase 1
  1. Upload the data for the forecast month
  2. Run the Workflow from Airflow
  3. Download the prediction result

Test Operation Phase 2: Implementation of regular operation API

Purpose of this phase

Architecture in this phase

Creating a web server

  • Upload function for input files
  • Execution of regular operations
  • Download function of forecast files

Creating the GUI screen

Test Operation Phase 3: Migration to the cloud and automation of operations

Purpose of this phase

Architecture Pattern 1 with AWS: Simple EC2-only configuration

Architecture Pattern 2 on AWS: Further automated configuration

  • Automation of data input/output
  • Splitting some functions into individual programs and managed services
  • Changed the storage location of input/output files to S3
  • Moved the trigger program for system execution to Lambda
  • Migrated the success/failure notification program to Lambda and SNS

Additional things to consider for production operations

Utilizing the cloud

Program reusability

Data storing

Data monitoring

Data governance

Software and code used in this article

Reference

--

--

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +768K followers.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store