📚 Introduction to Machine Learning | 机器学习入门
Machine learning (ML) is a branch of artificial intelligence that enables systems to learn from data and improve their performance over time without being explicitly programmed. In the WJEC A‑Level Computer Science specification, you are expected to understand the fundamental concepts, different types of learning, and the evaluation of ML models. This article breaks down each key topic to help you master the exam content.
机器学习(ML)是人工智能的一个分支,能够让系统从数据中学习,并在无需显式编程的情况下随时间提升性能。在 WJEC A‑Level 计算机科学大纲中,你需要理解基本概念、不同类型的学习方式以及如何评估 ML 模型。本文逐项拆解每个关键主题,帮助你掌握考试内容。
1. What is Machine Learning? | 什么是机器学习?
Machine learning is a process where a computer program learns from experience E with respect to some task T and a performance measure P, such that its performance on T, as measured by P, improves with experience E. This classic definition, given by Tom Mitchell, captures the essence of ML: an algorithm builds a mathematical model based on sample data, known as training data, to make predictions or decisions.
机器学习是一个过程,其中计算机程序根据某个任务 T 和性能度量 P,从经验 E 中学习,使得它在任务 T 上的表现(由 P 衡量)随着经验 E 的提升而提高。Tom Mitchell 给出的这个经典定义抓住了 ML 的本质:算法基于样本数据(即训练数据)构建数学模型,以进行预测或决策。
In the WJEC syllabus, ML is presented as a method of solving problems where traditional procedural programming is impractical, for example in image recognition, spam filtering, or recommendation systems. You need to distinguish ML from ordinary algorithms: ML models improve as more data becomes available.
在 WJEC 大纲中,ML 被视为一种解决传统过程式编程难以处理的问题的方法,例如图像识别、垃圾邮件过滤或推荐系统。你需要区分 ML 和普通算法:ML 模型会随着更多数据的出现而不断改进。
2. Key Terminology: Features, Labels, and Models | 关键术语:特征、标签和模型
A feature is an individual measurable property or characteristic of the data used for learning. For example, in a house price prediction system, features might include the number of bedrooms, floor area, and location. A label is the output value we want to predict, such as the actual house price. The model is the mathematical relationship learned from the features to the labels.
特征是数据中用于学习的单个可测量属性或特性。例如,在房价预测系统中,特征可能包括卧室数量、面积和位置。标签是我们想要预测的输出值,例如实际房价。模型是从特征到标签所学到的数学关系。
In supervised learning, the training data includes both features and labels. The model adjusts its internal parameters to minimise the difference between predicted labels and true labels. Understanding this terminology is essential for answering exam questions about data preparation and algorithm design.
在监督学习里,训练数据同时包含特征和标签。模型调整其内部参数以使预测标签与真实标签之间的差异最小。理解这些术语对于回答关于数据准备和算法设计的考题至关重要。
3. Types of Machine Learning | 机器学习的类型
There are three main types of machine learning: supervised learning, unsupervised learning, and reinforcement learning. Each type addresses different kinds of problems and uses data in distinct ways.
机器学习主要有三种类型:监督学习、无监督学习和强化学习。每种类型处理不同种类的问题,并以不同的方式使用数据。
Supervised learning uses labelled data, where the correct output is provided during training. Unsupervised learning works with unlabelled data to find hidden patterns or groupings. Reinforcement learning involves an agent that learns by interacting with an environment and receiving rewards or penalties. The exam may ask you to compare these types and give examples.
监督学习使用带标签的数据,训练时提供了正确的输出。无监督学习处理未标注的数据,以发现隐藏的模式或分组。强化学习涉及一个智能体,通过与环境的互动,获得奖励或惩罚来学习。考试可能要求你比较这些类型并举出例子。
4. Supervised Learning: Classification and Regression | 监督学习:分类与回归
Supervised learning is divided into classification and regression tasks. Classification predicts discrete categories, such as whether an email is spam or not spam. Regression predicts a continuous numeric value, such as the temperature tomorrow or the price of a stock.
监督学习分为分类和回归任务。分类预测离散的类别,例如一封电子邮件是否为垃圾邮件。回归预测连续的数值,例如明天的气温或股票价格。
Common classification algorithms include decision trees, k‑nearest neighbours (k‑NN), and support vector machines (SVM). For regression, linear regression and polynomial regression are typical. In the WJEC exam, you may be asked to identify whether a given problem is a classification or regression task and to interpret simple decision boundaries.
常见的分类算法包括决策树、k‑最近邻(k‑NN)和支持向量机(SVM)。回归则常用线性回归和多项式回归。在 WJEC 考试中,你可能会被要求判断给定问题是分类还是回归任务,并能解释简单的决策边界。
5. Unsupervised Learning: Clustering and Association | 无监督学习:聚类与关联
Unsupervised learning finds structure in data without using labels. Clustering groups similar data points together, for example segmenting customers into distinct groups based on purchase history. The k‑means algorithm is a classic clustering method that partitions data into k clusters by minimising within‑cluster variance.
无监督学习在不使用标签的情况下发现数据中的结构。聚类将相似的数据点归为一组,例如根据购买历史将客户划分为不同的群体。k‑均值算法是一种经典的聚类方法,通过最小化簇内方差将数据划分为 k 个簇。
Association rule learning discovers interesting relationships between variables in large databases. For instance, a supermarket might find that customers who buy bread also buy butter. The A‑Level specification expects you to know these concepts and recognise that no correct answer is provided during training; the algorithm discovers patterns autonomously.
关联规则学习发现大型数据库中变量之间的有趣关系。例如,超市可能发现购买面包的顾客也常常购买黄油。A‑Level 大纲要求你知晓这些概念,并认识到在训练过程中并没有提供正确答案;算法自主地发现模式。
6. Reinforcement Learning: Learning from Rewards | 强化学习:从奖励中学习
Reinforcement learning (RL) is about an agent that takes actions in an environment to maximise cumulative reward. Unlike supervised learning, the agent is not told which action is correct; it must explore and learn from trial and error. Key elements include the state, action, reward, and policy.
强化学习是指智能体在环境中采取行动以最大化累积奖励。与监督学习不同,智能体并不知道哪个动作是正确的;它必须通过试错来探索和学习。关键要素包括状态、动作、奖励和策略。
A typical example is a program learning to play a video game: the agent receives positive reward for increasing the score and negative reward for losing a life. WJEC students should understand the basic concept and how RL differs from supervised and unsupervised learning, as this is a common comparison question.
一个典型的例子是程序学习玩电子游戏:智能体在得分增加时获得正奖励,在失去生命时获得负奖励。WJEC 学生应理解基本概念,以及 RL 与监督学习和无监督学习的不同之处,因为这是常见的比较题。
7. Training and Testing: Splitting the Data | 训练与测试:数据划分
To evaluate how well a model generalises to unseen data, we split the dataset into a training set and a testing set. The training set is used to build the model; the testing set evaluates its performance on new examples. A common split ratio is 80% for training and 20% for testing.
为了评估模型对未见数据的泛化能力,我们将数据集划分为训练集和测试集。训练集用于构建模型;测试集则对模型在新样本上的性能进行评估。常用的划分比例是 80% 用于训练,20% 用于测试。
Sometimes a validation set is also used to fine‑tune model parameters without touching the test set. The exam may include a scenario where you need to explain why it is important not to test on the training data: because it would give an over‑optimistic estimate of performance.
有时还会使用验证集来微调模型参数,而不接触测试集。考试中可能出现这样的情景:你需要解释为什么不能在训练数据上进行测试——因为这会给出过于乐观的性能估计。
| Term | Definition | 中文 |
| Training set | Data used to fit the model | 用于拟合模型的数据 |
| Testing set | Data used to evaluate final model performance | 用于评估最终模型性能的数据 |
| Validation set | Data used to tune hyperparameters | 用于调整超参数的数据 |
8. Overfitting and Underfitting | 过拟合与欠拟合
Overfitting happens when a model learns the training data too well, including its noise and random fluctuations, but fails to generalise to new data. An overfit model shows excellent performance on the training set but poor performance on the test set. It is often too complex for the underlying pattern.
过拟合发生在模型过度学习训练数据(包括其中的噪声和随机波动),却无法泛化到新数据时。过拟合的模型在训练集上表现极佳,但在测试集上表现很差。它通常太过复杂,无法反映真实规律。
Underfitting occurs when a model is too simple to capture the underlying trend in the data, resulting in poor performance on both training and testing data. The goal is to find a balanced model that captures the general pattern. In the exam, you may be given graphs of training and validation error curves and asked to identify these situations.
欠拟合是指模型过于简单,无法捕捉数据中的潜在趋势,导致在训练集和测试集上都表现不佳。目标是找到一个能抓住总体规律的平衡模型。考试可能会给出训练和验证误差曲线图,要你识别这些情况。
-
Overfitting indicators: training error much lower than testing error.
过拟合指标:训练误差远低于测试误差。
-
Underfitting indicators: both training and testing error are high.
欠拟合指标:训练误差和测试误差都很高。
9. Model Evaluation Metrics | 模型评估指标
Different metrics are used to measure model performance depending on the task. For classification, accuracy is the proportion of correct predictions among all predictions. However, accuracy can be misleading when classes are imbalanced. For example, if 95% of emails are not spam, a model that always predicts ‘not spam’ has 95% accuracy but is useless.
根据任务的不同,衡量模型性能会使用不同的指标。对于分类,准确率是所有预测中正确预测的比例。然而,当类别不平衡时,准确率可能会产生误导。例如,如果 95% 的邮件不是垃圾邮件,一个总是预测“非垃圾邮件”的模型有 95% 的准确率,但实际上毫无用处。
Precision and recall provide a better picture. Precision measures how many of the positively predicted instances are actually positive. Recall measures how many of the actual positive instances were correctly predicted. The F1‑score is the harmonic mean of precision and recall. For regression, mean squared error (MSE) and R² are common metrics.
精确率和召回率能给出更好的评价。精确率衡量预测为正例的样本中有多少是真正的正例。召回率衡量所有真实正例中有多少被正确预测。F1 分数是精确率和召回率的调和平均值。对于回归,均方误差(MSE)和 R² 是常用指标。
Precision = TP / (TP + FP) Recall = TP / (TP + FN) F1 = 2 × (Precision × Recall) / (Precision + Recall)
In the exam, you may need to calculate these from a confusion matrix and explain their trade‑offs.
考试中你可能需要根据混淆矩阵计算这些指标,并解释它们之间的权衡。
10. Ethical Considerations in ML | 机器学习中的伦理考量
Machine learning systems can inherit biases present in the training data, leading to unfair or discriminatory outcomes. For example, a hiring algorithm trained on historical data might favour certain demographics. The WJEC specification expects you to discuss issues like data bias, transparency, and accountability.
机器学习系统可能继承训练数据中存在的偏见,导致不公平或有歧视性的结果。例如,用历史数据训练出的招聘算法可能偏向某些特定人群。WJEC 大纲要求你讨论数据偏见、透明度和问责制等问题。
Other ethical concerns include privacy (how personal data is collected and used), security (models can be fooled by adversarial examples), and the environmental impact of training large models. Understanding these issues shows a broader awareness beyond pure technical knowledge, which is valued in higher‑mark questions.
其他伦理问题包括隐私(个人数据的收集和使用方式)、安全性(模型可能被对抗样本欺骗)以及训练大模型对环境的影响。对这些问题的理解展示了超越纯技术知识的广泛意识,在高分题中尤为重要。
11. Real-world Applications | 现实应用
The exam may ask you to link ML concepts to real‑world examples. In healthcare, ML models assist in diagnosing diseases from medical images. In finance, they detect fraudulent transactions. In entertainment, recommendation systems on platforms like Netflix suggest content based on user behaviour.
考试可能会要求你将 ML 概念与现实案例联系起来。在医疗中,ML 模型可辅助从医学图像中诊断疾病。在金融领域,它们能检测欺诈交易。在娱乐领域,Netflix 等平台上的推荐系统根据用户行为推荐内容。
Autonomous vehicles use a combination of supervised learning for object recognition and reinforcement learning for decision‑making. By being able to categorise these applications (supervised/unsupervised/reinforcement), you demonstrate applied understanding, which is essential for top grades.
自动驾驶汽车结合了用于物体识别的监督学习和用于决策的强化学习。能够将这些应用归类(监督/无监督/强化学习)表明你具备应用理解能力,这对获得高分至关重要。
12. Summary: Key Points for the Exam | 总结:考试要点
For the WJEC A‑Level Computer Science exam, make sure you can define machine learning, distinguish between supervised, unsupervised, and reinforcement learning, and identify whether a problem is classification or regression. Be prepared to explain overfitting and underfitting with training/testing curves.
针对 WJEC A‑Level 计算机科学考试,确保你能定义机器学习,区分监督、无监督和强化学习,并判断一个问题是分类还是回归。准备好用训练/测试曲线解释过拟合和欠拟合。
Understand the importance of splitting data into training and testing sets, and know basic evaluation metrics like accuracy, precision, recall, and for regression, MSE. Ethical implications are also a recurring theme, so always be ready to comment on bias, fairness, and privacy.
理解将数据划分为训练集和测试集的重要性,并知道基本的评估指标,如准确率、精确率、召回率,以及回归中的 MSE。伦理影响也是一个反复出现的主题,因此随时准备好对偏见、公平性和隐私发表评论。
Remember that the exam focuses on conceptual understanding rather than deep mathematical detail. Use clear terminology, give appropriate examples, and structure your answers logically to score well.
请记住,考试侧重于概念理解,而非深入的数学细节。使用清晰的术语,给出合适的例子,并逻辑清晰地组织你的答案,以获得高分。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导