1 of 22

Apache Arrow Meetup 2019

TensorFlow + BigQuery Storage API + Apache Arrow

SENSY株式会社 漆山和樹 @KUrushi_ml

人生�初登壇

2 of 22

自己紹介

漆山和樹

SENSY株式会社�- Researcher (Data Scientist) 研究とかPoCとか�- 機械学習エンジニア

3 of 22

弊社のやっていること

リテイルに機械学習モデルの導入(PoC)�感性学習をするAIの研究・開発

4 of 22

PoCでのよく使われるもの

Storage�Analytics

BigQuery

Cloud Storage

Compute Engine

5 of 22

PoCでの課題

  1. 数百GB ~ 数TBのデータ量
  2. Pandasの利用
  3. 密ベクトル

Storage�Analytics

BigQuery

Cloud Storage

Compute Engine

6 of 22

PoCでの課題

  • 数百GB ~ 数TBのデータ量
  • Pandasの利用
  • 密ベクトル

Storage�Analytics

BigQuery

Cloud Storage

Compute Engine

7 of 22

PoCでの課題

  • 数百GB ~ 数TBのデータ量
  • Pandasの利用
  • 密ベクトル

Storage�Analytics

BigQuery

Cloud Storage

Compute Engine

8 of 22

PoCでの課題

  • 数百GB ~ 数TBのデータ量
  • Pandasの利用
  • 密ベクトル

Storage�Analytics

BigQuery

Cloud Storage

Compute Engine

9 of 22

PoCでの課題

  • 数百GB ~ 数TBのデータ量
  • Pandasの利用
  • 密ベクトル

Storage�Analytics

BigQuery

Cloud Storage

Compute Engine

10 of 22

選ばれたのは、�Apache Arrowでした

11 of 22

Apache Arrowで解決したこと

  1. BQ Storage APIとの組み合わせによる転送の高速化
  2. 互換性があるのでPandasが前提のライブラリでも利用可
  3. ベクトルの保存と復元が簡単に

12 of 22

PoCでの課題

  • 数百GB ~ 数TBのデータ量
  • Pandasの利用
  • 密ベクトル

これらが解決され�試行錯誤が高速化

Storage�Analytics

BigQuery

Cloud Storage

Compute Engine

13 of 22

ケーススタディ: Taxi Trips

  • Apache Arrow + BigQuery Storage API + TensorFlowでどのくらい高速化したか
  • 検証に使ったColabノートブックはこちら
  • データサイズ: 22.89GB
  • レコード数:9419696件
  • 次元数: 11

14 of 22

データ転送について

15 of 22

BQ + Arrowの転送

  1. BigQuery Clientから転送
  2. BigQuery Storage API
  3. BigQuery Storage API �+ Apache Arrow

計測はwall timeによる計測

(ノートブックのセル実行終了時間)

16 of 22

BQ + Arrowの転送

  • BigQuery Clientから直接転送
  • BigQuery Storage API
  • BigQuery Storage API �+ Apache Arrow

計測はUser Time + Sys Time

17 of 22

BQ Storage API転送Pandas変換時間

  • BigQuery Storage API
  • BigQuery Storage API �+ Apache Arrow

計測はUser Time

18 of 22

学習について

19 of 22

ループ時間計測

  1. メモリに展開された状態のもの
    1. Pandas
    2. Arrow Table(RecordBatch)
  2. Serializeされたもの
    • CSV
    • Feather

Walltime計測�TFRecordについては除外

tf.data.Dataset + �Keras.Model.compile�Keras.model.fit()

20 of 22

学習時間(GPU)

  • メモリに展開された状態のもの
    • Pandas
    • Arrow Table(RecordBatch)
  • Serializeされたもの
    • CSV
    • Feather

Wall Time計測�TFRecordについては除外

tf.data.Dataset + �Keras.Model.compile�Keras.model.fit

21 of 22

Apache Arrow

TensorFlow

BigQuery Storage API

早い・安い・すごい

22 of 22

ありがとうございました