Machine learning (ML) powers some of the most important technologies we use,
from translation apps to autonomous vehicles. This course explains the core
concepts behind ML.
机器学习(ML)为一些我们使用的重要技术提供动力,从翻译应用到自动驾驶汽车。本课程解释了机器学习背后的核心概念。
ML offers a new way to solve problems, answer complex questions, and create new
content. ML can predict the weather, estimate travel times, recommend
songs, auto-complete sentences, summarize articles, and generate
never-seen-before images.
机器学习提供了一种新的解决问题、回答复杂问题和创建新内容的方法。机器学习可以预测天气、估算旅行时间、推荐歌曲、自动完成句子、总结文章以及生成前所未有的图像。
In basic terms, ML is the process of
training a piece of software, called a
model, to make useful
predictions or generate content from
data.
在基本术语中,机器学习是训练一个称为模型的软件的过程,使其能够从数据中做出有用的预测或生成内容。
For example, suppose we wanted to create an app to predict rainfall. We could
use either a traditional approach or an ML approach. Using a traditional
approach, we'd create a physics-based representation of the Earth's atmosphere
and surface, computing massive amounts of fluid dynamics equations. This is
incredibly difficult.
例如,假设我们想要创建一个预测降雨的应用程序。我们可以使用传统方法或机器学习方法。使用传统方法,我们将创建地球大气和表面的基于物理的表示,计算大量流体动力学方程。这非常困难。
Using an ML approach, we would give an ML model enormous amounts of weather data
until the ML model eventually learned the mathematical relationship between
weather patterns that produce differing amounts of rain. We would then give the
model the current weather data, and it would predict the amount of rain.
使用机器学习方法,我们会向机器学习模型提供大量天气数据,直到模型最终学会产生不同降雨量的天气模式之间的数学关系。然后,我们会给模型提供当前的天气数据,它会预测降雨量。
Check Your Understanding 检查你的理解
机器学习中的“模型”是什么?
模型是你所研究事物的较小表示。
一个模型是一块计算机硬件
模型是从数据中推导出的数学关系,机器学习系统使用它来进行预测
Types of ML Systems 机器学习系统类型
ML systems fall into one or more of the following categories based on how they
learn to make predictions or generate content:
机器学习系统根据它们如何学习进行预测或生成内容,可以分为以下一个或多个类别:
- Supervised learning 监督学习
- Unsupervised learning 无监督学习
- Reinforcement learning 强化学习
- Generative AI 生成式 AI
Supervised learning 监督学习
Supervised learning
models can make predictions after seeing lots of data with the correct answers
and then discovering the connections between the elements in the data that
produce the correct answers. This is like a student learning new material by
studying old exams that contain both questions and answers. Once the student has
trained on enough old exams, the student is well prepared to take a new exam.
These ML systems are "supervised" in the sense that a human gives the ML system
data with the known correct results.
监督学习模型在看到大量带有正确答案的数据后,可以做出预测,并发现产生正确答案的数据元素之间的联系。这就像学生通过学习包含问题和答案的旧试卷来学习新材料。一旦学生训练了足够的旧试卷,学生就为参加新考试做好了充分准备。这些机器学习系统是“监督”的,因为人类提供了带有已知正确结果的机器学习系统数据。
Two of the most common use cases for supervised learning are regression and
classification.
监督学习的两个最常见用例是回归和分类。
Regression 回归
A regression model predicts a
numeric value. For example, a weather model that predicts the amount of rain, in
inches or millimeters, is a regression model.
回归模型预测一个数值。例如,预测降雨量的天气模型,以英寸或毫米为单位,是一个回归模型。
See the table below for more examples of regression models:
下表展示了更多回归模型的示例:
Scenario 场景 | Possible input data 可能输入数据 | Numeric prediction 数值预测 |
---|---|---|
Future house price 未来房价 | Square footage, zip code, number of bedrooms and bathrooms, lot size,
mortgage interest rate, property tax rate, construction costs, and
number of homes for sale in the area. 建筑面积、邮政编码、卧室和浴室数量、地块面积、抵押贷款利率、物业税率、建筑成本以及该地区待售房屋数量。 |
The price of the home. 房价。 |
Future ride time 未来骑行时间 | Historical traffic conditions (gathered from smartphones, traffic
sensors, ride-hailing and other navigation applications), distance from
destination, and weather conditions. 历史交通状况(来自智能手机、交通传感器、叫车和其他导航应用),目的地距离,以及天气状况。 |
The time in minutes and seconds to arrive at a destination. 到达目的地所需的时间(分钟和秒)。 |
Classification 分类
Classification models predict
the likelihood that something belongs to a category. Unlike regression models,
whose output is a number, classification models output a value that states
whether or not something belongs to a particular category. For example,
classification models are used to predict if an email is spam or if a photo
contains a cat.
分类模型预测某事物属于某一类别的可能性。与输出数字的回归模型不同,分类模型输出一个值,表示某事物是否属于特定类别。例如,分类模型用于预测一封电子邮件是否为垃圾邮件或一张照片中是否包含猫。
Classification models are divided into two groups: binary classification and
multiclass classification. Binary classification models output a value from a
class that contains only two values, for example, a model that outputs either
rain
or no rain
. Multiclass classification models output a value from a
class that contains more than two values, for example, a model that can output
either rain
, hail
, snow
, or sleet
.
分类模型分为两组:二元分类和多类分类。二元分类模型输出只包含两个值的类别中的一个值,例如,输出 rain
或 no rain
的模型。多类分类模型输出包含两个以上值的类别中的一个值,例如,可以输出 rain
、 hail
、 snow
或 sleet
的模型。
Check Your Understanding
检查你的理解
如果您想使用机器学习模型来预测商业建筑的能源消耗,您会使用哪种类型的模型?
Unsupervised learning 无监督学习
Unsupervised learning
models make predictions by being given data that does not contain any correct
answers. An unsupervised learning model's goal is to identify meaningful
patterns among the data. In other words, the model has no hints on how to
categorize each piece of data, but instead it must infer its own rules.
无监督学习模型通过提供不包含任何正确答案的数据来进行预测。无监督学习模型的目标是在数据中识别有意义的模式。换句话说,该模型没有关于如何对每条数据进行分类的提示,而必须推断自己的规则。
A commonly used unsupervised learning model employs a technique called
clustering. The model finds data points
that demarcate natural groupings.
一个常用的无监督学习模型采用了一种称为聚类的技术。该模型找到数据点,以界定自然分组。

Figure 1. An ML model clustering similar data points.
图 1. 一个机器学习模型对相似数据点进行聚类。

Figure 2. Groups of clusters with natural demarcations.
图 2. 具有自然分界的簇组。
Clustering differs from classification because the categories aren't defined by
you. For example, an unsupervised model might cluster a weather dataset based on
temperature, revealing segmentations that define the seasons. You might then
attempt to name those clusters based on your understanding of the dataset.
聚类与分类不同,因为类别不是由你定义的。例如,一个无监督模型可能会根据温度将天气数据集进行聚类,揭示出定义季节的分割。然后,你可能根据你对数据集的理解来命名这些聚类。

Figure 3. An ML model clustering similar weather patterns.

Figure 4. Clusters of weather patterns labeled as snow, sleet, rain, and no rain.
Check Your Understanding
Reinforcement learning
Reinforcement learning models make predictions by getting rewards or penalties based on actions performed within an environment. A reinforcement learning system generates a policy that defines the best strategy for getting the most rewards.
Reinforcement learning is used to train robots to perform tasks, like walking around a room, and software programs like AlphaGo to play the game of Go.
Generative AI
Generative AI is a class of models that creates content from user input. For example, generative AI can create unique images, music compositions, and jokes; it can summarize articles, explain how to perform a task, or edit a photo.
Generative AI can take a variety of inputs and create a variety of outputs, like text, images, audio, and video. It can also take and create combinations of these. For example, a model can take an image as input and create an image and text as output, or take an image and text as input and create a video as output.
We can discuss generative models by their inputs and outputs, typically written as "type of input"-to-"type of output." For example, the following is a partial list of some inputs and outputs for generative models:
- Text-to-text
- Text-to-image
- Text-to-video
- Text-to-code
- Text-to-speech
- Image and text-to-image
The following table list examples of generative models, their input, and an example of their possible output:
Model | Input | Example output |
---|---|---|
Text-to-text | Who invented the Le Mans race? |
The 24 Hours of Le Mans was founded by the Automobile Club de l'Ouest
(ACO), a motoring organization founded in 1906. The first race was held
on 26 and 27 May 1923 on the Sarthe Circuit, a 13.426-kilometre
(8.345-mile) road circuit located near the town of Le Mans in France.
The race was originally conceived as a way to promote the ACO and the
Sarthe region. Source: Bard |
Text-to-image | An alien octopus floats through a portal while reading a newspaper. |
![]() Source: Imagen |
Text-to-video | A photorealistic teddy bear is swimming in the ocean at San Francisco. The teddy bear goes under water. The teddy bear keeps swimming under the water with colorful fishes. A panda bear is swimming under water. |
![]() Source: Phenaki |
Text-to-code | Write a Python loop that loops over a list of numbers and prints the prime numbers. |
for number in numbers: # Check if the number is prime. is_prime = True for i in range(2, number): if number % i == 0: is_prime = False break # If the number is prime, print it. if is_prime: print(number) Source: Bard |
Image-to-text | ![]() |
This is a flamingo. They are found in the Caribbean. Source: Google DeepMind |
How does generative AI work? At a high-level, generative models learn patterns in data with the goal to produce new but similar data. Generative models are like the following:
- Comedians who learn to imitate others by observing people's behaviors and style of speaking
- Artists who learn to paint in a particular style by studying lots of paintings in that style
- Cover bands that learn to sound like a specific music group by listening to lots of music by that group
To produce unique and creative outputs, generative models are initially trained using an unsupervised approach, where the model learns to mimic the data it's trained on. The model is sometimes trained further using supervised or reinforcement learning on specific data related to tasks the model might be asked to perform, for example, summarize an article or edit a photo.
Generative AI is a quickly evolving technology with new use cases constantly being discovered. For example, generative models are helping businesses refine their ecommerce product images by automatically removing distracting backgrounds or improving the quality of low-resolution images.