GithubHelp home page GithubHelp logo

dockerized-ds-python's Introduction

Containerized Data Science w/ Python & Docker

This is a simple example of containerized data science illustrating how one can (and should) dockerize a data science application. The simple app that we are dockerizing here is a k-NN classification model trained on the famous iris dataset. The app could definitely be improved in terms of logging, error handling, etc., but many of those things have been left out here for the purpose of brevity.

Technologies

Motivation

As you may or may not know, data scientists often form habits of producing less-than-production-ready code, and, regardless how cool your deeplearning model is, it is not going to be useful if you can't put it into production. Docker can help us out of this situation.

By dockerizing your data science applications, you can ease the burden of putting your application into production, integrate your data science work into your company's CI/CD pipelines, make your application portable, scale your application easily across data center, and more.

This example is very simple, but the hope is that it provides a starting point for data scientists (familiar with python and scikit-learn) for experimentation with Docker and possibly JSON APIs.

Installation

  • Install these dependencies:

  • Clone this repo.

  • From the root of this repo build the Docker image:

    docker build --force-rm=true -t pythoniris .
    
  • Now run the Docker image with:

    docker run -p 5000:5000 -d --name iris pythoniris
    
  • The app's JSON API is now listening on port 5000 of this host. Congrats! You just deployed your first dockerized data science application. Now go forth and develop, train, test, validate, dockerize, and deploy more.

JSON API Usage

This application listens on port 5000 of the host on which it is running. You can query a prediction for a species of Iris using a GET request to the /prediction endpoint with parameters for the Sepal Length, Sepal Width, Petal Length, Pteal Width. For example, the following query:

http://localhost:5000/prediction?slength=1.5&swidth=0.7&plength=1.3&pwidth=0.3

should return:

{
  "pwidth": 0.3, 
  "plength": 1.3, 
  "slength": 1.5, 
  "species": "setosa", 
  "swidth": 0.7
}

dockerized-ds-python's People

Contributors

dwhitena avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.