機械学習での利用に対して力を入れてきている感があるAzureですが、Microsoftの人が書いたAzureを使った分析例の記事が出ていました。
Building Azure ML Models on the NYC Taxi Dataset
(ニューヨークのタクシーのデータセットのAzure MLモデル)
The NYC taxi public dataset consists of over 173 million NYC taxi rides in the year 2013. The dataset includes driver details, pickup and drop-off locations, time of day, trip locations (longitude-latitude), cab fare and tip amounts.
ニューヨークタクシーの公開データセンターには、1億7千3百万のタクシーの乗車情報が入っている(2013年のデータ)。このデータセットには、ドライバーの情報、乗車と降車の位置、日時、経路、請求額、チップの金額が含まれている。
こんなデータが公開されているんですね。
今回行われたのはチップの分析。金曜と土曜の夜のチップが最も高い(飲んでるからですかね)とか、マンハッタンからクイーンへ行く経路が一番チップが高いといったことをAzureを使って算出しています。
使ったスキーマはこんな感じだそうです。
Schema: medallion,hack_license,vendor_id,pickup_datetime,payment_type,fare_amount, surcharge,mta_tax,tip_amount,tolls_amount,total_amount
Example: 89D227B655E5C82AECF13C3F540D4CF4,BA96DE419E711691B9445D6A6307C170,CMT,2013-01-01 15:11:48,CSH,6.5,0,0.5,0,0,7
チップは1ドル未満、1ドル以上5ドル未満、5ドル以上10ドル未満、10ドル以上20ドル未満、20ドル以上の5つのクラスに分けています。
時間帯についてもMorning (05-09), Mid-morning(10-11), Afternoon(12-15), Evening(16-21), and Night(22-04)に分けています。
前に全く別のデータ分析をする際に、時間についてはどう分けるのが標準的なのかわからずに悩んだことがあるのですが、本ケースは1つの参考になりますね。出勤等の一般的な用途以外が増えそうなMid-morningを分けるわけか。
分析の手法はLearning with Countsを利用します。
下記はLearning with Countsの説明。
Imagine you’re trying to validate a credit card transaction. One crucial piece of information is where this transaction came from, and one of the most common encodings of that location is the postal code. However, there might be as many as 40,000 postal codes, zip codes, and geographical codes to account for. Does your model have the capacity to learn 40,000 more parameters? If you give it that capacity, do you now have enough training data to prevent it from overfitting?
クレジットカードのトランザクションを分析することを考えてみよう。重要な情報の1つに、どこでそのトランザクションが発生したかがある。ロケーションを取る場合は郵便番号が使われることが多い。でも郵便番号は40000種類もある。あなたのモデルは40000以上のパラメータを扱える? できたとして、過学習は起きない?
(中略)
One solution to this conundrum is to learn with counts. That is, rather than introduce 40,000 more features, you can observe the counts and proportions of fraud for each postal code. By using these counts as features, you gain a notion of the strength of the evidence for each value. Moreover, by encoding the relevant statistics of the counts, the learner can use the statistics to decide when to back off and use other features.
1つの解決方法として、カウントを使って学習する方法がある。40000以上の特徴量をカウントを使って観察する。それらのカウントを特徴量として学習し、統計的に適切なカウントに変換し、どの特徴を使うべきかを決定する。
というようなことのようです。(使ったことがない手法なので訳が少し怪しいです。私の訳はいつも怪しいですが)
The Build Count Table module builds a count table for the high dimensional categorical features on a 33GB dataset allocated for counts using MapReduce.
count tableモジュールに、MapReduceを使って33GBの多次元の特徴量を取り込ませてcount tableを生成しています。
といったことをAzure上で行っています。
分析結果は元記事に図で表示されていますのでそちらをご覧ください。GUIで工程を管理(Machine Learning Studio。Rも使える)しているなど、クラウド+機械学習の分野でもMicrosoftっぽさが見てとれます。
Azureの機械学習に対するアプローチはけっこう本気さが感じられるので、こうしたレポートを見ると試しに借りてみたくなってきます。