Giter Club home page Giter Club logo

default_prediction's Introduction

Predicting probability of defaul

Workflow

  • Model training
  • Generate predictions
  • Deploy the model to AWS using SageMaker

Project Structure

|-- data
    |-- submission.csv
|-- sagemaker
     |-- data
     |-- models
     |-- AWS - SageMaker.ipynb
     |-- featurizer_local.py
     |-- featurizer_remote.py
|-- src
    |-- models
        |-- baseline_model.py: Class for training the binary classification model
        |-- transformers.py: ColumnSelector transformer for preprocessing
|-- api_request_exmpl.json
|-- pickled_model.pickle
|-- Model.ipunb: model evaluation notebook

Pre-requisites

  • python3.8
  • aws-cli

Submissions

  1. A verbose explanation of the model training and validation could be found here.
  2. CSV file with resulting predictions could be found here.

Steps

Model training (/Model.ipynb)

  1. Read and explore dataset (excluded from the current repo due to privacy reasons)
  2. Train baseline defualt prediction model
  3. Evaluate and сompare different models (Logistic Regression and Tree-based ensemble models) with a set of metrics
  4. Estimate feature inportance
  5. Generate predictions (/data/submission.csv)
  6. Dump the best estimator (/pickled_model.pickle)

Model deployment (sagemaker/AWS - SageMaker.ipynb)

  1. Define Sagemaker session and role
  2. Preprocessing data and train the model
  3. Create SageMaker Scikit Estimator
  4. Batch transform training data
  5. Fit a Tree-based Model with the preprocessed data
  6. Serial Inference Pipeline with Scikit preprocessor and classifier
  7. Deploy model
  8. Make a request to the pipeline endpoint

API Gateway endpoint exposing

Besides AWS SageMaker I tested some other AWS deployment options including AWS Serverless Application Model (SAM). It allows deploing ML models with Serverless API (AWS Lambda). I managed to expose API endpoint with helloworld application behind in order to try AWS Lambda.

Used technologies

  • ECR: Container & Registy
  • AWS Lambda: Serving API
  • SAM: Serverless Framework

Query the endpoint

GET request:

https://x3jp27x3t3.execute-api.eu-central-1.amazonaws.com/test/hello

Expected response:

{
    "message": "hello world"
}

default_prediction's People

Contributors

kushal334 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.