プリンキピア

第2章準備

2.6. Probability and Statistics2.6 確率と統計

One way or another, machine learning is all about uncertainty. In supervised learning, we want to predict something unknown (the target) given something known (the features). Depending on our objective, we might attempt to predict the most likely value of the target. Or we might predict the value with the smallest expected distance from the target. And sometimes we wish not only to predict a specific value but to quantify our uncertainty. For example, given some features describing a patient, we might want to know how likely they are to suffer a heart attack in the next year. In unsupervised learning, we often care about uncertainty. To determine whether a set of measurements are anomalous, it helps to know how likely one is to observe values in a population of interest. Furthermore, in reinforcement learning, we wish to develop agents that act intelligently in various environments. This requires reasoning about how an environment might be expected to change and what rewards one might expect to encounter in response to each of the available actions.
英語のヒント
なんだかんだ言っても、機械学習とは不確かさにかかわるものである。教師あり学習では、既知の何か(特徴量)が与えられたとき、未知の何か(目標値)を予測したい。目的によっては、目標値の最も可能性の高い値を予測しようとするかもしれない。あるいは、目標値からの期待距離が最も小さい値を予測するかもしれない。そして、特定の値を予測するだけでなく、自分の不確かさを数値で表したいこともある。たとえば、ある患者を記述する特徴量が与えられたとき、その人が来年心臓発作を起こす可能性がどれほどかを知りたいかもしれない。教師なし学習でも、不確かさを気にかけることが多い。ある測定値の集まりが異常かどうかを決めるには、関心のある母集団でその値を観測する可能性がどれほどかを知っていると助かる。さらに強化学習では、さまざまな環境で知的に振る舞うエージェントを開発したい。そのためには、環境がどう変わると予想されるか、利用できる各行動に応じてどんな報酬に出会うと予想できるかについて推論する必要がある。
Probability is the mathematical field concerned with reasoning under uncertainty. Given a probabilistic model of some process, we can reason about the likelihood of various events. The use of probabilities to describe the frequencies of repeatable events (like coin tosses) is fairly uncontroversial. In fact, frequentist scholars adhere to an interpretation of probability that applies only to such repeatable events. By contrast Bayesian scholars use the language of probability more broadly to formalize reasoning under uncertainty. Bayesian probability is characterized by two unique features: (i) assigning degrees of belief to non-repeatable events, e.g., what is the probability that a dam will collapse?; and (ii) subjectivity. While Bayesian probability provides unambiguous rules for how one should update their beliefs in light of new evidence, it allows for different individuals to start off with different prior beliefs. Statistics helps us to reason backwards, starting off with collection and organization of data and backing out to what inferences we might draw about the process that generated the data. Whenever we analyze a dataset, hunting for patterns that we hope might characterize a broader population, we are employing statistical thinking. Many courses, majors, theses, careers, departments, companies, and institutions have been devoted to the study of probability and statistics. While this section only scratches the surface, we will provide the foundation that you need to begin building models.
英語のヒント
確率は、不確かさのもとでの推論を扱う数学の分野である。ある過程の確率モデルが与えられれば、さまざまな出来事の起こりやすさについて推論できる。(硬貨投げのような)繰り返せる出来事の頻度を確率で記述することには、ほとんど異論がない。実際、頻度主義の学者たちは、そのような繰り返せる出来事にだけ当てはまる確率の解釈を守っている。これに対してベイズ主義の学者たちは、確率の言葉をもっと広く使い、不確かさのもとでの推論を形式化する。ベイズ確率には二つの独特な特徴がある。(i)繰り返せない出来事に信念の度合いを割り当てること。たとえば、ダムが決壊する確率はどれほどか。(ii)主観性。ベイズ確率は、新しい証拠に照らして信念をどう更新すべきかについてあいまいさのない規則を与えるが、異なる人が異なる事前の信念から出発することを許す。統計学は、逆向きに推論するのを助けてくれる。データの収集と整理から始めて、そのデータを生み出した過程についてどんな推論を引き出せるかへとさかのぼるのである。データセットを分析し、より広い母集団を特徴づけてくれることを願うパターンを探すときは、いつでも統計的な考え方を使っている。多くの講座、専攻、論文、職業、学科、企業、機関が、確率と統計の研究に捧げられてきた。この節は表面をなでるだけだが、モデルを作り始めるのに必要な基礎は示す。
%matplotlib inline
import random
import torch
from torch.distributions.multinomial import Multinomial
from d2l import torch as d2l