Heroku meetup#15 lt

24
Copyright © 2017 TIS Inc. All rights reserved. Heroku×Prediction IO でででででででででで でででででででで でで で

Transcript of Heroku meetup#15 lt

Page 1: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved.

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

戦略技術センター

菊谷 匠

Page 2: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 2

自己紹介

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

Page 3: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 3

PredictionIO とはどんなものか?

Page 4: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 4

PredictionIO とは?

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

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

Page 5: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 5

PredictionIO 使い方

Page 6: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 6

イベントサーバ起動

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

Page 7: Heroku meetup#15 lt

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

Page 8: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 8

データ収集

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

Page 9: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 9

データ収集のイメージ

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

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

Page 10: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 10

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

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

Page 11: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 11

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

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

Page 12: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 12

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

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

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

Page 13: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 13

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

Page 14: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 14

エンジンデプロイ

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

Page 15: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 15

クエリに対する予測結果

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

Page 16: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 16

データ収集のイメージ

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

Page 17: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 17

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

Page 18: Heroku meetup#15 lt

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 点と評価した

Page 19: Heroku meetup#15 lt

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}]

}

Page 20: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 20

感想

Page 21: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 21

PredictionIO

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

Page 22: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 22

Heroku×PredictionIO

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

Page 23: Heroku meetup#15 lt

Copyright © 2017 TIS Inc. All rights reserved. 23

まとめ

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

Page 24: Heroku meetup#15 lt

THANK YOU