Heroku meetup#15 lt

Post on 11-Apr-2017

36 views 0 download

Transcript of Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved.

Heroku×PredictionIOで機械学習を始めよう

戦略技術センター

菊谷 匠

Copyright © 2017 TIS Inc. All rights reserved. 2

自己紹介

• 菊谷 匠 (きくや たくみ)• 機械学習経験: Coursera • Heroku & PredictionIO 歴: 1 ヶ月• Qiita アカウント :@KIKUYA-Takumi• Twitter アカウント :@kky_tkm

Copyright © 2017 TIS Inc. All rights reserved. 3

PredictionIO とはどんなものか?

Copyright © 2017 TIS Inc. All rights reserved. 4

PredictionIO とは?

・オープンソースの機械学習サーバ by Scala

引用元: http://predictionio.incubator.apache.org/start/

Copyright © 2017 TIS Inc. All rights reserved. 5

PredictionIO 使い方

Copyright © 2017 TIS Inc. All rights reserved. 6

イベントサーバ起動

引用元: http://predictionio.incubator.apache.org/start/

Copyright © 2017 TIS Inc. All rights reserved. 7

イベントサーバの起動

イベントサーバの軌道方法は以下の 2 通り・ソースコード(公式に手順あり)・ Docker

必要なもの(新しいバージョンは可)・ Apach Spark 1.4.0・ Java SE Development Kit 7・ Apache Hadoop 2.4.0(option)・ PostgreSQL 9.1 or MySQL 5.1 or Apache Hbase 0.98.6 & Elasticsearch 1.4.0

Copyright © 2017 TIS Inc. All rights reserved. 8

データ収集

引用元: http://predictionio.incubator.apache.org/start/

Copyright © 2017 TIS Inc. All rights reserved. 9

データ収集のイメージ

引用元: http://predictionio.incubator.apache.org/datacollection/

複数のアプリとの連携も可能

Copyright © 2017 TIS Inc. All rights reserved. 10

データの学習 & 予測モデル作成

引用元: http://predictionio.incubator.apache.org/start/

Copyright © 2017 TIS Inc. All rights reserved. 11

データ収集のイメージ 複数のエンジンを実装可能

引用元: http://predictionio.incubator.apache.org/datacollection/

Copyright © 2017 TIS Inc. All rights reserved. 12

用意されているテンプレートエンジン

・ Recommenders・ Classification・ Regression・ NLP・ Clustering・ Similarity・ Other

各カテゴリごとにテンプレートが用意

Copyright © 2017 TIS Inc. All rights reserved. 13

自作のエンジンをテンプレートとして提出でき

Copyright © 2017 TIS Inc. All rights reserved. 14

エンジンデプロイ

引用元: http://predictionio.incubator.apache.org/start/

Copyright © 2017 TIS Inc. All rights reserved. 15

クエリに対する予測結果

引用元: http://predictionio.incubator.apache.org/start/

Copyright © 2017 TIS Inc. All rights reserved. 16

データ収集のイメージ

引用元: http://predictionio.incubator.apache.org/datacollection/エンジン稼働中

Copyright © 2017 TIS Inc. All rights reserved. 17

Heroku×PredictionIO でレコメンドのサンプルをやってみた

Copyright © 2017 TIS Inc. All rights reserved. 18

学習データ

{ "event" : "rate", "entityType" : "user", "entityId" : "0", "targetEntityType" : "item", "targetEntityId" : "0", "properties" : { "rating" : 5 } "eventTime" : "2017-02-02T07:09:10.346Z"

}

ユーザ 0 が商品 0 を 5 点と評価した

Copyright © 2017 TIS Inc. All rights reserved. 19

予測結果

curl -H “Content-Type: application/json” -d ‘{ “user”: “1”, “num”: 4 }’ エンジンURL{

"itemScores":[{"item":"18","score":5.6416108945911665},{"item":"11","score":5.323105684481337},{"item":"59","score":4.9416970523096975},{"item":"48","score":4.7580425593880795}]

}

Copyright © 2017 TIS Inc. All rights reserved. 20

感想

Copyright © 2017 TIS Inc. All rights reserved. 21

PredictionIO

・機械学習のコードを 書く必要なし必要なもの・イベントサーバ・エンジン・ PredictionIO と連携させるもの(アプリ、 Web サイト等)

Copyright © 2017 TIS Inc. All rights reserved. 22

Heroku×PredictionIO

・デプロイが楽・相性が良い・ Bui ld pack が用意されている・ Heroku も PredictionIO もSalesforce!

Copyright © 2017 TIS Inc. All rights reserved. 23

まとめ

・ PredictionIOではデータを用意するだけで、機械学習を活用できる・テンプレートのエンジンを使うだけでなく、作って提出できる・ Herokuへのデプロイが楽

THANK YOU