Coder Social home page Coder Social logo

daisuke19891023 / ml-system-in-actions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shibuiwilliam/ml-system-in-actions

0.0 0.0 0.0 119.96 MB

machine learning system examples

License: MIT License

Makefile 7.81% Python 76.19% Shell 4.72% Dockerfile 3.83% Kotlin 5.81% Jinja 1.63%

ml-system-in-actions's Introduction

ml-system-in-actions

machine learning system examples

tl;dr

  • 本レポジトリは 2021 年 5 月翔泳社出版『AI エンジニアのための機械学習システムデザインパターン』のサンプルコード集です。
  • 本レポジトリでは機械学習のモデル学習、リリース、推論器の稼働、運用のためのコードおよび実行環境を用例ごとに提供します。
  • 「機械学習システムデザインパターン」の詳細は本書および mercari/ml-system-design-pattern をご参照ください。

img

実行環境

  • Python 3.8 以上
  • Docker
  • Docker-compose
  • (一部)Kubernetes または minikube
  • (一部)Android Studio

本レポジトリではプログラムの実行環境として Docker、Docker-compose、(一部)Kubernetes/minikube、(一部)Android Studio を使用します。 また、コマンドラインとして kubectlistioctl を使用します。 各種ミドルウェア、開発環境、コマンドラインは以下公式ドキュメントを参考にインストールしてください。

Python の実行環境

本レポジトリで用いる Python のライブラリはpipenvで指定しています。以下の手順で pipenv とともにライブラリをインストールしてください。 サンプルコードは Python3.8 以上で実行を検証しています。実行環境の Python バージョンが合わない場合、pyenv等で実行環境を整えてください。

# Pythonのバージョン
$ python -V
# 出力
Python 3.8.5

# pyenvバージョン
$ pyenv versions
# 出力
  system
* 3.8.5

# pipenvをインストールし、シェルをpipenv venvに変更
$ make dev
# 出力例
# pip install pipenv
# Requirement already satisfied: pipenv in ~/.pyenv/versions/3.8.5/lib/python3.8/site-packages (2020.11.15)
# (中略)
# Requirement already satisfied: six<2,>=1.9.0 in ~/.pyenv/versions/3.8.5/lib/python3.8/site-packages (from virtualenv->pipenv) (1.15.0)
# WARNING: You are using pip version 20.1.1; however, version 21.0.1 is available.
# You should consider upgrading via the '~/.pyenv/versions/3.8.5/bin/python3.8 -m pip install --upgrade pip' command.
# PIPENV_VENV_IN_PROJECT=true pipenv shell
# Creating a virtualenv for this project...
# Pipfile: ~/book/ml-system-in-actions/Pipfile
# Using ~/.pyenv/versions/3.8.5/bin/python3.8 (3.8.5) to create virtualenv...
# ⠧ Creating virtual environment...created virtual environment CPython3.8.5.final.0-64 in 433ms
#   creator CPython3Posix(dest=~/book/ml-system-in-actions/.venv, clear=False, no_vcs_ignore=False, global=False)
#   seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=~/Library/Application Support/virtualenv)
#     added seed packages: pip==21.0.1, setuptools==52.0.0, wheel==0.36.2
#   activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

# ✔ Successfully created virtual environment!
# Virtualenv location: ~/book/ml-system-in-actions/.venv
# Launching subshell in virtual environment...
#  . ~/book/ml-system-in-actions/.venv/bin/activate
# [21-02-27 10:03:37] your_name@your_namenoMacBook-Pro:~/book/ml-system-in-actions
# $  . ~/book/ml-system-in-actions/.venv/bin/activate
# (ml-system-in-actions) [21-02-27 10:03:37] your_name@your_namenoMacBook-Pro:~/book/ml-system-in-actions

# 依存ライブラリをインストール
$ make dev_sync
# 出力例
# pipenv sync --dev
# Installing dependencies from Pipfile.lock (a2c081)...
#   🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 93/93 — 00:02:36
# All dependencies are now up-to-date!

##################################
####### 開発、プログラムの実行 #######
##################################


# 開発、プログラムの実行が完了したらpipenv venvシェルを終了
$ exit

ただし、一部のサンプルコードでは他のライブラリを使用することがあります。当該サンプルコードのディレクトリで README を参照してください。

コード一覧

本レポジトリが提供するプログラムは以下に示す各プログラムのディレクトリで実行されることを想定して開発されています。 各プログラムを実行する際は目的のディレクトリに移動してください。 各プログラムの実行方法は各プログラムディレクトリ配下の README に示してあります。

.
├── chapter2_training
│   ├── cifar10
│   ├── iris_binary
│   ├── iris_sklearn_outlier
│   ├── iris_sklearn_rf
│   ├── iris_sklearn_svc
│   └── model_db
├── chapter3_release_patterns
│   ├── model_in_image_pattern
│   └── model_load_pattern
├── chapter4_serving_patterns
│   ├── asynchronous_pattern
│   ├── batch_pattern
│   ├── data_cache_pattern
│   ├── edge_ai_pattern
│   ├── horizontal_microservice_pattern
│   ├── prediction_cache_pattern
│   ├── prep_pred_pattern
│   ├── sync_async_pattern
│   ├── synchronous_pattern
│   └── web_single_pattern
├── chapter5_operations
│   ├── prediction_log_pattern
│   └── prediction_monitoring_pattern
└── chapter6_operation_management
   ├── circuit_breaker_pattern
   ├── condition_based_pattern
   ├── load_test_pattern
   ├── online_ab_pattern
   ├── paramater_based_pattern
   └── shadow_ab_pattern

ml-system-in-actions's People

Contributors

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