第1章はじめに
1.1. A Motivating Example1.1 動機となる例
Before beginning writing, the authors of this book, like much of the work force, had to become caffeinated. We hopped in the car and started driving. Using an iPhone, Alex called out “Hey Siri”, awakening the phone’s voice recognition system. Then Mu commanded “directions to Blue Bottle coffee shop”. The phone quickly displayed the transcription of his command. It also recognized that we were asking for directions and launched the Maps application (app) to fulfill our request. Once launched, the Maps app identified a number of routes. Next to each route, the phone displayed a predicted transit time. While this story was fabricated for pedagogical convenience, it demonstrates that in the span of just a few seconds, our everyday interactions with a smart phone can engage several machine learning models.
英語のヒント
書き始める前に、この本の著者たちは、働く人の多くと同じく、カフェインを補給する必要があった。私たちは車に乗り込んで走り出した。AlexがiPhoneに向かって「Hey Siri」と呼びかけ、電話の音声認識システムを起こした。続いてMuが「Blue Bottleのコーヒー店への道順」と命じた。電話はすぐに彼の命令の書き起こしを表示した。さらに、私たちが道順を尋ねていることを認識し、要求に応えるために地図のアプリケーション(アプリ)を起動した。起動すると、地図アプリはいくつかの経路を見つけた。各経路の横に、電話は予測所要時間を表示した。この話は教えるのに都合がよいように作ったものだが、ほんの数秒のうちに、スマートフォンとの日常のやり取りがいくつもの機械学習モデルを働かせうることを示している。
Imagine just writing a program to respond to a wake word such as “Alexa”, “OK Google”, and “Hey Siri”. Try coding it up in a room by yourself with nothing but a computer and a code editor, as illustrated in Fig. 1.1.1. How would you write such a program from first principles? Think about it… the problem is hard. Every second, the microphone will collect roughly 44,000 samples. Each sample is a measurement of the amplitude of the sound wave. What rule could map reliably from a snippet of raw audio to confident predictions about whether the snippet contains the wake word? If you are stuck, do not worry. We do not know how to write such a program from scratch either. That is why we use machine learning.
英語のヒント
「Alexa」「OK Google」「Hey Siri」のような起動語に反応するプログラムを書くだけのことを想像してほしい。図1.1.1に示すように、コンピュータとコードエディタのほかには何もない部屋で、たった一人で書いてみよう。そのようなプログラムを、第一原理からどう書けばよいだろうか。考えてみると……この問題は難しい。マイクは毎秒およそ44,000個のサンプルを集める。各サンプルは音波の振幅の測定値である。生の音声の断片から、その断片が起動語を含むかどうかについての確かな予測へと、どんな規則なら確実に写像できるだろうか。行き詰まっても心配はいらない。私たちもそんなプログラムをゼロから書く方法は知らない。だからこそ機械学習を使うのである。
Fig. 1.1.1図1.1.1
Identify a wake word.
英語のヒント
起動語を識別する。
Here is the trick. Often, even when we do not know how to tell a computer explicitly how to map from inputs to outputs, we are nonetheless capable of performing the cognitive feat ourselves. In other words, even if you do not know how to program a computer to recognize the word “Alexa”, you yourself are able to recognize it. Armed with this ability, we can collect a huge dataset containing examples of audio snippets and associated labels, indicating which snippets contain the wake word. In the currently dominant approach to machine learning, we do not attempt to design a system explicitly to recognize wake words. Instead, we define a flexible program whose behavior is determined by a number of parameters. Then we use the dataset to determine the best possible parameter values, i.e., those that improve the performance of our program with respect to a chosen performance measure.
英語のヒント
ここに秘訣がある。入力から出力へどう写像すればよいかをコンピュータに明示的に伝える方法がわからなくても、その認知的な技を私たち自身はやってのけられることが多い。言い換えれば、「Alexa」という単語を認識するようコンピュータをプログラムする方法を知らなくても、あなた自身はその単語を認識できる。この能力を武器にすれば、音声の断片の事例と、どの断片が起動語を含むかを示す対応するラベルとからなる、巨大なデータセットを集めることができる。今の機械学習で支配的な方法では、起動語を認識するシステムを明示的に設計しようとはしない。代わりに、いくつものパラメータによって振る舞いが決まる柔軟なプログラムを定義する。そして、データセットを使って、可能なかぎり最良のパラメータの値、つまり、選んだ性能の尺度に照らしてプログラムの性能を高める値を決めるのである。
You can think of the parameters as knobs that we can turn, manipulating the behavior of the program. Once the parameters are fixed, we call the program a model. The set of all distinct programs (input–output mappings) that we can produce just by manipulating the parameters is called a family of models. And the “meta-program” that uses our dataset to choose the parameters is called a learning algorithm.
英語のヒント
パラメータは、回すことでプログラムの振る舞いを操作できるつまみだと考えればよい。パラメータが固定されたら、そのプログラムをモデルと呼ぶ。パラメータを操作するだけで作り出せる異なるプログラム(入力と出力の対応)全部の集まりを、モデルの族という。そして、データセットを使ってパラメータを選ぶ「メタプログラム」を学習アルゴリズムという。
Before we can go ahead and engage the learning algorithm, we have to define the problem precisely, pinning down the exact nature of the inputs and outputs, and choosing an appropriate model family. In this case, our model receives a snippet of audio as input, and the model generates a selection among as output. If all goes according to plan the model’s guesses will typically be correct as to whether the snippet contains the wake word.
英語のヒント
学習アルゴリズムを動かす前に、問題を正確に定義しなければならない。入力と出力の正確な性質を突き止め、適切なモデルの族を選ぶのである。この場合、モデルは音声の断片を入力として受け取り、のどちらかを選んで出力する。すべてが計画どおりに進めば、断片が起動語を含むかどうかについてのモデルの推測は、普通は正しくなる。
If we choose the right family of models, there should exist one setting of the knobs such that the model fires “yes” every time it hears the word “Alexa”. Because the exact choice of the wake word is arbitrary, we will probably need a model family sufficiently rich that, via another setting of the knobs, it could fire “yes” only upon hearing the word “Apricot”. We expect that the same model family should be suitable for “Alexa” recognition and “Apricot” recognition because they seem, intuitively, to be similar tasks. However, we might need a different family of models entirely if we want to deal with fundamentally different inputs or outputs, say if we wanted to map from images to captions, or from English sentences to Chinese sentences.
英語のヒント
正しいモデルの族を選べば、「Alexa」という単語を聞くたびにモデルが「yes」を発するような、つまみの設定が一つ存在するはずである。起動語をどれにするかは任意なので、つまみを別の設定にすれば「Apricot」という単語を聞いたときだけ「yes」を発せるほど豊かなモデルの族が、おそらく必要になる。「Alexa」の認識と「Apricot」の認識は直観的には似た課題に思えるので、同じモデルの族でどちらにも対応できると期待する。しかし、根本的に異なる入力や出力を扱いたいなら、たとえば画像から説明文へ、あるいは英語の文から中国語の文へと写像したいなら、まったく別のモデルの族が必要になるかもしれない。
As you might guess, if we just set all of the knobs randomly, it is unlikely that our model will recognize “Alexa”, “Apricot”, or any other English word. In machine learning, the learning is the process by which we discover the right setting of the knobs for coercing the desired behavior from our model. In other words, we train our model with data. As shown in Fig. 1.1.2, the training process usually looks like the following:
英語のヒント
察しがつくように、つまみをすべてでたらめに設定しただけでは、モデルが「Alexa」も「Apricot」も、ほかのどんな英単語も認識することはまずない。機械学習では、学習とは、モデルから望む振る舞いを引き出すためのつまみの正しい設定を見つける過程のことである。言い換えれば、データでモデルを訓練するのである。図1.1.2に示すように、訓練の過程は普通、次のようになる。
- Start off with a randomly initialized model that cannot do anything useful.
英語のヒント
役に立つことは何もできない、でたらめに初期化されたモデルから始める。 - Grab some of your data (e.g., audio snippets and corresponding labels).
英語のヒント
データの一部をつかみ取る(たとえば、音声の断片と、対応するのラベル)。 - Tweak the knobs to make the model perform better as assessed on those examples.
英語のヒント
それらの事例で評価したときにモデルの成績が上がるように、つまみを微調整する。 - Repeat Steps 2 and 3 until the model is awesome.
英語のヒント
モデルがすばらしくなるまで、手順2と3を繰り返す。
Fig. 1.1.2図1.1.2
A typical training process.
英語のヒント
典型的な訓練の過程。
To summarize, rather than code up a wake word recognizer, we code up a program that can learn to recognize wake words, if presented with a large labeled dataset. You can think of this act of determining a program’s behavior by presenting it with a dataset as programming with data. That is to say, we can “program” a cat detector by providing our machine learning system with many examples of cats and dogs. This way the detector will eventually learn to emit a very large positive number if it is a cat, a very large negative number if it is a dog, and something closer to zero if it is not sure. This barely scratches the surface of what machine learning can do. Deep learning, which we will explain in greater detail later, is just one among many popular methods for solving machine learning problems.
英語のヒント
まとめると、起動語の認識器を書く代わりに、ラベル付きの大きなデータセットを与えられれば起動語を認識できるようになるプログラムを書くのである。データセットを与えることでプログラムの振る舞いを決めるこの行いは、データによるプログラミングだと考えることができる。つまり、機械学習のシステムに猫と犬の事例をたくさん与えることで、猫の検出器を「プログラム」できる。こうすれば検出器は、やがて、猫なら非常に大きな正の数を、犬なら非常に大きな負の数を、自信がなければゼロに近い何かを出力することを学ぶ。これは機械学習にできることの、ほんの表面をなでたにすぎない。後でもっと詳しく説明する深層学習は、機械学習の問題を解く人気の方法の多くのうちの、一つにすぎない。