Artificial Intelligence and Machine Learning
University Computer Science Topic 13 6:33 English narration · English and 中文 subtitles you can switch
Chapters
Transcript
This course covers the classical core of artificial intelligence, honestly measured.
本课程介绍人工智能的经典核心内容,并对其进行如实衡量。
The first three units are the spine: search, logical reasoning and probability.
前三个单元是主干:搜索、逻辑推理和概率。
The next two learn from data: regression, classification and optimisation.
接下来两个单元介绍从数据中学习:回归、分类和优化。
The last two keep it honest, with evaluation and fairness.
最后两个单元通过评估和公平性确保结果可信。
One synthetic dataset, Overnight, with 200 delivery records and a data card, feeds every number.
所有数字都来自一个名为 Overnight 的合成数据集,其中包含 200 条配送记录和一张数据卡。
A star search expands the node with the smallest f, which is g, the cost so far, plus h, an estimate of the cost remaining.
A* 搜索展开 f 值最小的节点,其中 f 等于已付出的代价 g 加上对剩余代价的估计 h。
If h never overestimates, the first time the goal is popped its path is optimal.
如果 h 从不高估,那么目标节点第一次被取出时,得到的路径就是最优的。
On the course graph, A star pops D, B, C and then the goal: cost 8, via D, B, C, G.
在课程给出的图中,A* 依次取出 D、B、C 和目标节点:路径为 D、B、C、G,代价为 8。
Overestimate h, and it trusts a lie.
如果 h 高估了代价,算法就会相信错误的估计。
Read the f values on the nodes of this search tree.
看这棵搜索树各节点上的 f 值。
Each one is the path cost so far plus the estimate still to go.
每个值都是当前路径代价加上对剩余代价的估计。
A star always expands the smallest, so with an admissible estimate it expands only four nodes and finds the cheapest path.
A* 总是展开 f 值最小的节点,因此使用可采纳的估计时,它只展开四个节点就找到了代价最低的路径。
Breadth-first search, knowing nothing about distance, visits all five.
广度优先搜索不了解距离信息,会访问全部五个节点。
A knowledge base holds facts and rules: storm, weekend, and rules such as storm implies delayed.
知识库存储事实和规则:例如暴风雨、周末,以及暴风雨蕴含延误这样的规则。
Forward chaining floods outward from the facts: in the first wave delayed and heavy traffic, in the second refund risk.
前向链推理从事实出发向外扩展:第一轮得到延误和交通拥堵,第二轮得到退款风险。
Backward chaining starts from the goal and works back to known facts.
后向链推理从目标出发,反向追溯到已知事实。
Modus ponens is sound: it can never invent a falsehood.
肯定前件推理是可靠的:它绝不会凭空推导出错误结论。
Here is one chain, read in two directions.
这里有一条推理链,可以从两个方向来看。
Forward, from the facts at the top, rules fire wave by wave until refund risk appears.
正向推理从顶部的事实出发,规则一轮接一轮地触发,直到得出退款风险。
Backward, from the question at the bottom, you ask which rule could prove it, then which fact proves that rule's condition, until you reach the facts.
反向推理从底部的问题出发,先问哪条规则能证明它,再问哪个事实能证明该规则的条件,直到追溯到事实。
Both directions arrive at conclusions the data never stated directly.
两个方向都能得出数据中没有直接陈述的结论。
A Bayesian network breaks a joint probability into small tables.
贝叶斯网络把联合概率分解成多个小表。
With a storm probability of 0.3, the chance of a complaint is 0.49 given a storm and 0.105 without one, so 0.2205 overall.
暴风雨的概率为 0.3 时,发生暴风雨的条件下出现投诉的概率为 0.49,没有暴风雨时为 0.105,因此总体概率为 0.2205。
Bayes' rule then gives the probability of a storm given a complaint: 0.667.
然后根据贝叶斯公式,已知出现投诉时发生暴风雨的概率为 0.667。
If storms were rare, at 0.03, the same evidence gives only 0.126.
如果暴风雨很少见,概率为 0.03,那么同样的证据只会得到 0.126。
In this network, a storm raises the chance of a delay, and a delay explains both late deliveries and complaints.
在这个网络中,暴风雨会提高延误的概率,而延误解释了配送迟到和投诉。
Now query it: given a complaint, how likely was a storm?
现在来查询:已知出现了投诉,发生过暴风雨的概率有多大?
Evidence flows backward along the arrows.
证据沿着箭头反向传播。
The base rate of storms is not a footnote: it carries much of the arithmetic.
暴风雨的基准发生率不是无关紧要的细节:它在计算中起着很大作用。
Least squares has a closed form.
最小二乘法有闭式解。
For the five course points, the best line has a slope of 0.9 and an intercept of 1.3, with a sum of squared errors of 1.9.
对于课程中的五个点,最佳拟合直线的斜率为 0.9,截距为 1.3,误差平方和为 1.9。
A fourth-degree polynomial fits the training points perfectly, but its error on held-out data is about 42.7, against 0.55 for the line.
四次多项式完美拟合了训练点,但它在留出数据上的误差约为 42.7,而直线的误差为 0.55。
Training error is just an advertisement.
训练误差只能算是一种宣传。
Count the residuals against the fitted line: the vertical gaps from each point to the line.
看各点相对于拟合直线的残差:也就是每个点到直线的竖直距离。
Beside it is a classifier's decision boundary, the line where the answer flips from on time to late.
旁边是分类器的决策边界,即判断结果从准时变为迟到的那条线。
A point's distance from the boundary shows the model's confidence.
一个点到边界的距离反映了模型的置信程度。
Fitting the training data is not the same as generalising to new data.
拟合训练数据并不等于能够泛化到新数据。
Gradient descent steps against the gradient, scaled by a learning rate eta.
梯度下降沿梯度的反方向更新,步长由学习率 η 调节。
For the loss w minus 3 squared, eta of 0.1 walks steadily from 0 towards 3, while eta of 1 jumps between 0 and 6 forever.
对于损失函数 (w - 3) 的平方,η 为 0.1 时,参数从 0 稳步走向 3;而 η 为 1 时,参数会永远在 0 和 6 之间跳动。
For this loss it is stable only when eta is below 1.
对于这个损失函数,只有 η 小于 1 时才稳定。
When features have very different scales, standardise them first, or no single rate works.
当特征的尺度相差很大时,要先将它们标准化,否则没有一个统一的学习率能起作用。
Watch the three learning rates on the same bowl-shaped loss.
观察同一个碗形损失函数上的三个学习率。
A small rate crawls slowly but surely towards the bottom.
较小的学习率缓慢但稳定地向底部靠近。
A medium rate overshoots a little and settles.
中等学习率会稍微越过底部,然后趋于稳定。
A rate that is too large bounces from side to side and never settles.
过大的学习率会在两侧来回反弹,始终无法稳定下来。
The steps shrink only when the rate suits the curvature of the bowl.
只有学习率适合碗形曲面的曲率时,步长才会逐渐缩小。
The test set is spent only once.
测试集只使用一次。
On 200 test records, the confusion matrix gives an accuracy of 0.92, a precision of 0.783 and a recall of 0.857.
对 200 条测试记录,混淆矩阵给出的准确率为 0.92,精确率为 0.783,召回率为 0.857。
Five-fold cross-validation averages 0.916 with a spread of 0.013, so a rival at 0.921 is within noise.
五折交叉验证的平均值为 0.916,波动幅度为 0.013,因此另一个模型的 0.921 处于噪声范围内。
A feature that secretly encodes the answer is leakage.
暗中编码了答案的特征会造成数据泄漏。
Every metric comes from four counts: true positives, false positives, false negatives and true negatives.
每个指标都来自四个计数:真正例、假正例、假负例和真负例。
Precision asks how many flagged deliveries were really late; recall asks how many late deliveries were caught.
精确率问的是被标记的配送中有多少确实迟到;召回率问的是迟到的配送中有多少被识别出来。
The split diagram shows the test data locked away until the end.
数据划分图显示,测试数据被保留到最后才使用。
A score without folds is only an anecdote.
没有通过分折验证的分数,只能算是个例。
Audit a model group by group.
逐组审查模型。
Recall in the city is 27 out of 30, 0.90, but in the rural region only 9 out of 12, 0.75: the model misses one in four rural late deliveries.
城市地区的召回率是 30 个中识别出 27 个,即 0.90;但农村地区只有 12 个中识别出 9 个,即 0.75:模型漏掉了四分之一的农村迟到配送。
The cause is in the data: rural late deliveries are rarer, so that class is thinner.
原因在数据中:农村迟到配送更少见,因此这一类别的样本更少。
The data card states this gap and the model's limits.
数据卡说明了这一差距和模型的局限。
This chart shows recall by region: 0.90 for the city and 0.75 for rural areas.
这张图展示了各地区的召回率:城市为 0.90,农村地区为 0.75。
The bar for the gap is the audit itself.
表示差距的柱形本身就是审查结果。
Fairness means naming the criterion, measuring the gap, and stating the limits honestly, then fixing the data or the weights, rather than adjusting the metric until the problem disappears.
公平性意味着明确评价标准、衡量差距,并如实说明局限,然后改进数据或调整权重,而不是调整指标直到问题消失。
Now test yourself from memory.
现在凭记忆测试一下自己。
How many nodes does A star expand on the course graph before reaching the goal?
在课程给出的图中,A* 到达目标之前展开了多少个节点?
What is the probability of a storm given a complaint?
已知出现投诉时,发生暴风雨的概率是多少?
What is the least-squares line for the course points?
课程中这些点的最小二乘拟合直线是什么?
What are the recall values for the city and rural regions?
城市和农村地区的召回率分别是多少?
Pause, answer, then check.
暂停视频,回答问题,然后核对。
Comments
No comments yet. Be the first to ask or share something.