JP version - Beyond Shuffling - Apache Spark のスケールアップのためのヒントとコツHolden Karau
The Japanese version of "Beyond Shuffling - Apache Spark のスケールアップのためのヒントとコツ"
皆さんについて
RDD の再利用 (キャッシング、永続化レベル、およびチェックポイント機能)
キー・バリュー・データの処理
group キーの使用が危険な理由と対処方法
Spark アキュムレーターに関するベスト・プラクティス*
Spark SQL がすばらしい理由
Spark MLLib のパフォーマンスを高めるための将来の機能強化に関する説明
JP version - Beyond Shuffling - Apache Spark のスケールアップのためのヒントとコツHolden Karau
The Japanese version of "Beyond Shuffling - Apache Spark のスケールアップのためのヒントとコツ"
皆さんについて
RDD の再利用 (キャッシング、永続化レベル、およびチェックポイント機能)
キー・バリュー・データの処理
group キーの使用が危険な理由と対処方法
Spark アキュムレーターに関するベスト・プラクティス*
Spark SQL がすばらしい理由
Spark MLLib のパフォーマンスを高めるための将来の機能強化に関する説明
This is an introduction to polyaxon and why I use polyaxon.
Polyaxon enables me to leverage kubernetes to achieve the objectives:
- Make the lead time of experiments as short as possible.
- Make the financial cost to train models as cheap as possible.
- Make the experiments reproducible.
セル生産方式におけるロボットの活用には様々な問題があるが,その一つとして 3 体以上の物体の組み立てが挙げられる.一般に,複数物体を同時に組み立てる際は,対象の部品をそれぞれロボットアームまたは治具でそれぞれ独立に保持することで組み立てを遂行すると考えられる.ただし,この方法ではロボットアームや治具を部品数と同じ数だけ必要とし,部品数が多いほどコスト面や設置スペースの関係で無駄が多くなる.この課題に対して音𣷓らは組み立て対象物に働く接触力等の解析により,治具等で固定されていない対象物が組み立て作業中に運動しにくい状態となる条件を求めた.すなわち,環境中の非把持対象物のロバスト性を考慮して,組み立て作業条件を検討している.本研究ではこの方策に基づいて,複数物体の組み立て作業を単腕マニピュレータで実行することを目的とする.このとき,対象物のロバスト性を考慮することで,仮組状態の複数物体を同時に扱う手法を提案する.作業対象としてパイプジョイントの組み立てを挙げ,簡易な道具を用いることで単腕マニピュレータで複数物体を同時に把持できることを示す.さらに,作業成功率の向上のために RGB-D カメラを用いた物体の位置検出に基づくロボット制御及び動作計画を実装する.
This paper discusses assembly operations using a single manipulator and a parallel gripper to simultaneously
grasp multiple objects and hold the group of temporarily assembled objects. Multiple robots and jigs generally operate
assembly tasks by constraining the target objects mechanically or geometrically to prevent them from moving. It is
necessary to analyze the physical interaction between the objects for such constraints to achieve the tasks with a single
gripper. In this paper, we focus on assembling pipe joints as an example and discuss constraining the motion of the
objects. Our demonstration shows that a simple tool can facilitate holding multiple objects with a single gripper.
【DLゼミ】XFeat: Accelerated Features for Lightweight Image Matchingharmonylab
公開URL:https://arxiv.org/pdf/2404.19174
出典:Guilherme Potje, Felipe Cadar, Andre Araujo, Renato Martins, Erickson R. ascimento: XFeat: Accelerated Features for Lightweight Image Matching, Proceedings of the 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) (2023)
概要:リソース効率に優れた特徴点マッチングのための軽量なアーキテクチャ「XFeat(Accelerated Features)」を提案します。手法は、局所的な特徴点の検出、抽出、マッチングのための畳み込みニューラルネットワークの基本的な設計を再検討します。特に、リソースが限られたデバイス向けに迅速かつ堅牢なアルゴリズムが必要とされるため、解像度を可能な限り高く保ちながら、ネットワークのチャネル数を制限します。さらに、スパース下でのマッチングを選択できる設計となっており、ナビゲーションやARなどのアプリケーションに適しています。XFeatは、高速かつ同等以上の精度を実現し、一般的なラップトップのCPU上でリアルタイムで動作します。
11. MLlib-specific Contribution Guidelines
• Be widely known
• Be used and accepted
• academic citations and concrete use cases can help justify this
• Be highly scalable
• Be well documented
• Have APIs consistent with other algorithms in MLLib that
accomplish the same thing
• Come with a reasonable expectation of developer support.
11
[https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark]
13. レコメンドアルゴリズム ALS の
単純な実行方法
val ratings =
sc.textFile(“s3n:/path/to/csv/files/*”)
.map(_.split(","))
.map(x => Rating(x(0).toInt, x(1).toInt, x(2).toDouble)
13
Data (CSV)
Load Data
Train Model
Evaluate
user_id product_id rating
473 348 0.8
5623 87583 0.3
6545 9382 0.5
234 246 0.6
14. レコメンドアルゴリズム ALS の
単純な実行方法
val ratings =
sc.textFile(“s3n:/path/to/csv/files/*”)
.map(_.split(","))
.map(x => Rating(x(0).toInt, x(1).toInt, x(2).toDouble)
val als = new ALS.setRank(10).setIterations(10)
val model = als.run(ratings)
14
Data
Loa Data
Train Model
Evaluate
レコメンド手法のひとつである
ALS のオブジェクトを生成して訓練
15. レコメンドアルゴリズム ALS の
単純な実行方法
val ratings =
sc.textFile(“s3n:/path/to/csv/files/*”)
.map(_.split(","))
.map(x => Rating(x(0).toInt, x(1).toInt, x(2).toDouble)
val als = new ALS.setRank(10).setIterations(10)
val model = als.run(ratings)
val userId = 12345
val productId = 987654
model.predict(userId, productId)
0.4…
15
Data
Loa Data
Train Model
EvaluateTop-level API がよくデザインされているので
非常に簡単に機械学習ライブラリが使える
16. ALSのベンチマーク
• データセット:Amazon Reviews Dataset
• データサイズ: 660万ユーザ, 220万アイテム
• クラスタサイズ:m3.2xlarge x 16
16
cited by: Xiangrui Meng: A More Scaleable Way of Making Recommendations with MLlib
17. MLlib の ALS について詳しく知りたい方は
「レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証」
http://www.slideshare.net/recruitcojp/sparkmapreduce
17
22. Spark をネイティブで書くより早い
22
cited by: Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structured Data
DataFrame API を利用すれば
少ないコードでより高速に処理することができる
27. Our Task
• レビュー (review) のテキストから評価 (rating) を予測
27
review Model rating
String Int
28. Load Data
• Data Schema
• label: Int
• text: String
28
Load Data
Feature Extraction
Train Model
Evaluate
29. Feature Extraction
• Data Schema
• label: Int
• text: String
• words: Seq[String]
• features: Vector
29
Load Data
Hashed Term Freq.
Train Model
Evaluate
Tokenizer
Transformer
30. Train a Model
• Data Schema
• label: Int
• text: String
• words: Seq[String]
• features: Vector
• prediction: Int
30
Load Data
Hashed Term Freq.
Logistic Regression
Evaluate
Tokenizer
Transformer
Estimator
31. Spark ML Pipeline API
val tokenizer = new Tokenizer()
.setInputCol("text")
.setOutputCol(“words")
val hashingTF = new HashingTF()
.setNumFeatures(1000)
.setInputCol(tokenizer.getOutputCol)
.setOutputCol("features")
31
Load Data
Hashed Term Freq.
Logistic Regression
Evaluate
Tokenizer
32. Spark ML Pipeline API
val tokenizer = new Tokenizer()
.setInputCol("text")
.setOutputCol(“words")
val hashingTF = new HashingTF()
.setNumFeatures(1000)
.setInputCol(tokenizer.getOutputCol)
.setOutputCol("features")
val lr = new LogisticRegression()
.setMaxIter(10)
.setRegParam(0.01)
32
Load Data
Hashed Term Freq.
Logistic Regression
Evaluate
Tokenizer
33. Spark ML Pipeline API
val tokenizer = new Tokenizer()
.setInputCol("text")
.setOutputCol(“words")
val hashingTF = new HashingTF()
.setNumFeatures(1000)
.setInputCol(tokenizer.getOutputCol)
.setOutputCol("features")
val lr = new LogisticRegression()
.setMaxIter(10)
.setRegParam(0.01)
val pipeline = new Pipeline()
.setStages(Array(tokenizer, hashingTF, lr))
val model = pipeline.fit(training)
33
Pipeline
Load Data
Hashed Term Freq.
Logistic Regression
Evaluate
Tokenizer
36. ML Pipelines for Test
36
Pipeline
Training Data
Hashed Term Freq.
Logistic Regression
Evaluate
Tokenizer
Pipeline
Test Data
Hashed Term Freq.
Logistic Regression
Evaluate
Tokenizer
37. Pipeline API for Test
val tokenizer = new Tokenizer()
.setInputCol("text")
.setOutputCol(“words")
val hashingTF = new HashingTF()
.setNumFeatures(1000)
.setInputCol(tokenizer.getOutputCol)
.setOutputCol("features")
val lr = new LogisticRegression()
.setMaxIter(10)
.setRegParam(0.01)
val pipeline = new Pipeline()
.setStages(Array(tokenizer, hashingTF, lr))
val model = pipeline.fit(training)
model.transform(test)
37
Pipeline
Test Data
Hashed Term Freq.
Logistic Regression
Evaluate
Tokenizer
39. Practical ML Pipeline is Complicated!
39
Data Image!
Parser
Normalizer Convolver
sqrt,mean
Zipper
Linear
Solver
Symmetric!
Rectifier
ident,abs
ident,mean
Global
Pooler
Patch!
Extractor
Patch
Whitener
KMeans!
Clusterer
Feature Extractor
Label!
Extractor
Linear!
Mapper
Model
Test!
Data
Label!
Extractor
Feature
Extractor
Test
Error
Error!
Computer
No Hyperparameters!
A few Hyperparameters!
Lotsa Hyperparameters
42. Practical Spark ML Pipeline API
val paramGrid = new ParamGridBuilder()
.addGrid(hashingTF.numFeatures, Array(10, 20, 40))
.addGrid(lr.regParam, Array(0.01, 0.1, 0.5))
.build()
42
43. Practical Spark ML Pipeline API
val paramGrid = new ParamGridBuilder()
.addGrid(hashingTF.numFeatures, Array(10, 20, 40))
.addGrid(lr.regParam, Array(0.01, 0.1, 0.5))
.build()
val cv = new CrossValidator()
.setNumFolds(3)
.setEstimator(pipeline)
.setEstimatorParamMaps(paramGrid)
.setEvaluator(new BinaryClassificationEvaluator)
val cvModel = cv.fit(trainingDataset)
43
Parameter Tuning も Cross-Validation も
API が用意されているので複雑な PIpeline も簡単に定義
44. Model export/import for Pipeline API is coming soon!
44
Pipeline
Load Data
Hashed Term Freq.
Logistic Regression
Tokenizer
save
Model
Load Model
Evaluate
モデルを保存することで
再構築の必要がなく再利用が簡単