2016年10月7日金曜日

モデル構築、評価 & 判定:Model Validation

モデル構築」からの続き。

全体像」で書いたように、本章は次の三段階で構成される。
  • Mapping business problems to machine learning tasks:ビジネス上の問題を機械学習のタスクに落とし込む
  • Evaluating model quality:モデルの質を評価
  • Validating model soundness:モデルの良さを判定する

この流れから次は "5.2. Evaluating models" なのだが、"5.3. Validating models" を先に取り上げる。理由は、単に "5.2" 節が「長すぎる、内容が濃すぎる」というもの。

その意味では、そもそも本第 5 章自体が「内容が濃すぎる」、データ分析の主要部分を全部詰め込んだ感じ。そのためか、本章だけの説明では「まとめ過ぎ、抽象的すぎる」という面もある。具体例は本章以降に期待して、詳細はその時に取り上げる。

なので、本章からは「つまみ食い」した部分を取り上げる。まぁ、大抵の私の投稿は「つまみ食い」なのだが...。煮詰まったりした時などに、「データ分析の基本に戻る」ために、本章を読み返すのは良いことかもしれない。


Evaluation と Validation

evaluation を「評価」、validation を「判定」と訳してはみたが、モヤモヤ感は払拭できずにいる。辞書的意味を Oxford Learner's Dictionaries から引用。

evaluation noun
the act of forming an opinion of the amount, value or quality of something after thinking about it carefully
  • an evaluation of the health care system
  • The technique is not widely practised and requires further evaluation.
  • The discussion includes a critical evaluation of the documentary sources.

validation noun
1. [uncountable, countable] the act of proving that something is true or correct
    There must be some form of external validation of the data.
2. [uncountable, countable] the act of making something legally valid
    validation of web service contracts
3. [uncountable, countable] the act of stating officially that something is useful and of an acceptable standard
    an agreement on the validation of the institution's degree courses
4. [uncountable] the feeling of recognition from others that you are right or good enough
We seek validation from our peers.


evaluation は、「良し悪し」の判断の前の「検討段階」という感じだが、「評価」という言葉に、「良い悪い」を判断するようなニュアンスがあるから、モヤモヤしてるような気がする。一方 validation では、「真偽」「良し悪し」をキッチリ判断する。


Common Model Problems

We’ve discussed how to choose a modeling technique and evaluate the performance of the model on training data. At this point your biggest worry should be the validity of your model: will it show similar quality on new data in production? We call the testing of a model on new data (or a simulation of new data from our test set) model validation 
これまでに、モデル構築の方法、訓練データによるモデル評価の方法を取り上げた。この時点で最大の懸念事項は「モデルの判定」、つまり「本番の新たなデータで同様の品質を示せるか」ということ。新しいデータでのモデルテストを model validation「モデル判定」と呼ぶ。

ここで取り上げるのは、具体的な判定方法ではなく、common model problems「一般的なモデル上の問題」。

A lot of modeling problems are related to overfitting. Looking for signs of overfit is a good first step in diagnosing models. 
多くのモデル上の問題は overfitting「当てはまりすぎ」に関するもの。「当てはまりすぎ」の兆候をさがすことは、モデル診断の最初にすべきこと。

overfitting については、既に何度か投稿している(参照:「分析モデル評価:Overfitting」「分析モデル評価:Overfitting & Generalization」)。

An overfit model looks great on the training data and performs poorly on new data. A model’s prediction error on the data that it trained from is called training error. A model’s prediction error on new data is called generalization error. Usually, training error will be smaller than generalization error (no big surprise). Ideally, though, the two error rates should be close. If generalization error is large, then your model has probably overfitit’s memorized the training data instead of discovering generalizable rules or patterns. You want to avoid overfitting by preferring (as long as possible) simpler models, which do in fact tend to generalize better.

「当てはまりすぎモデル」は訓練データでは良くて、新データではダメなモデル。訓練データでの予測エラーを training error「訓練エラー」、新データでのエラーを generalization error「一般的エラー」。理想的には、この二つのエラー率は近似すべき。「一般的エラー」が大きい場合、そのモデルは「当てはまりすぎ」の可能性が高い。

下線を引いて引用したのは「当てはまりすぎモデル」のこと。

訓練データを単に覚えただけのモデルで
一般化した規則やパターン
を発見したモデルではない。

generalizable rules or patterns の発見」という、モデル化の目的を改めて確認

「当てはまりすぎ」をさけるためにも
(可能な限り)シンプルなモデルを選ぶこと。

最後に、表 5.7 Common model problems を取り上げる。

Problem Description
BiasSystematic error in the model, such as always underpredicting.
「予測精度不足」のような、モデル上の systematic error 。
VarianceUndesirable (but non-systematic) distance between predictions and actual values. Often due to oversensitivity of the model training procedure to small variations in the distribution of training data.
予測と実際の間の望まない乖離。
OverfitFeatures of the model that arise from relations that are in the training data, but not representative of the general population. Overfit can usually be reduced by acquiring more training data and by techniques like regularization and bagging.
訓練データと関係するモデルの特徴だが、一般的母集団を表現しない。「当てはまりすぎ」の解消には、訓練データを増加したり、regularization や bagging などの手法を用いる。
NonsignificanceA model that appears to show an important relation when in fact the relation may not hold in the general population, or equally good predictions can be made without the relation.
実際は一般的母集団を示していないのに、モデルが重要な関係を示しているように見えること。


評価のモノサシ」に続く。

0 件のコメント:

コメントを投稿