← 返回资讯屏轩教育 · 行业资讯

Introduction to Machine Learning | 机器学习入门

2026-07-13 09:37 · 本文部分内容由AI辅助创作

📚 Introduction to Machine Learning | 机器学习入门

Machine learning has revolutionised the way computers solve problems, moving beyond rigid programming to systems that learn from data. It is a core topic in modern computer science and a key component of the IB and WJEC specifications. Understanding the fundamental concepts, algorithms, and ethical implications of machine learning equips students with essential knowledge for further study and for navigating a world increasingly shaped by artificial intelligence.

机器学习彻底改变了计算机解决问题的方式,从僵化的编程转向从数据中学习的系统。它是现代计算机科学的核心课题,也是 IB 和 WJEC 课程大纲的关键组成部分。理解机器学习的基本概念、算法和伦理影响,能让学生掌握关键知识,为深造做好准备,并更好地适应日益被人工智能塑造的世界。

1. What is Machine Learning? | 什么是机器学习?

Machine learning is a branch of artificial intelligence that enables systems to learn and improve from experience without being explicitly programmed. Instead of following static instructions, a machine learning model identifies patterns in data and uses them to make decisions or predictions. Arthur Samuel famously defined it as the 'field of study that gives computers the ability to learn without being explicitly programmed.'

机器学习是人工智能的一个分支,它使系统能够从经验中学习和改进,而无需进行明确的编程。机器学习模型不遵循静态指令,而是识别数据中的模式,并利用这些模式做出决策或预测。阿瑟·萨缪尔曾将其定义为“使计算机无需明确编程即可学习的研究领域”。

2. Types of Machine Learning | 机器学习的类型

Machine learning is broadly categorised into three main paradigms: supervised learning, unsupervised learning, and reinforcement learning. Each type is suited to different kinds of tasks and datasets. In supervised learning, models learn from labelled data; in unsupervised learning, models find hidden structures in unlabelled data; and in reinforcement learning, agents learn by interacting with an environment and receiving rewards or penalties.

机器学习大致分为三种主要范式:监督学习、无监督学习和强化学习。每种类型都适用于不同类型的任务和数据集。在监督学习中,模型从有标签的数据中学习;在无监督学习中,模型在无标签数据中发现隐藏结构;而在强化学习中,智能体通过与环境的交互并接收奖励或惩罚来进行学习。

3. Supervised Learning | 监督学习

Supervised learning involves training a model on a dataset that contains input-output pairs. The goal is to learn a mapping from inputs to outputs so the model can predict outputs for new, unseen inputs. It is called 'supervised' because the training data acts like a teacher providing the correct answers. Common tasks include classification (predicting a category) and regression (predicting a continuous value).

监督学习涉及在包含输入-输出对的数据集上训练模型。其目标是学习从输入到输出的映射,以便模型能够为新的、未见过的输入预测输出。之所以称为“监督”,是因为训练数据就像一位提供正确答案的老师。常见任务包括分类(预测类别)和回归(预测连续值)。

Examples of supervised learning algorithms include linear regression, which fits a line to data points; decision trees, which split data based on feature values; and support vector machines, which find optimal boundaries between classes. In WJEC and IB contexts, students are often required to explain how these algorithms learn from labelled examples.

监督学习算法的例子包括线性回归(将一条直线拟合到数据点)、决策树(根据特征值分割数据)以及支持向量机(寻找类别之间的最佳边界)。在 WJEC 和 IB 的课程背景下,学生通常需要解释这些算法如何从有标签的示例中学习。

4. Unsupervised Learning | 无监督学习

Unsupervised learning works with unlabelled data, seeking to discover underlying patterns or groupings without any predefined output labels. The model must find structure in the data on its own. This makes unsupervised learning particularly useful for exploratory data analysis, customer segmentation, and anomaly detection.

无监督学习处理的是无标签数据,旨在没有任何预定义输出标签的情况下发现潜在的模式或分组。模型必须自行找到数据中的结构。这使得无监督学习对于探索性数据分析、客户细分和异常检测特别有用。

Clustering is a primary unsupervised learning technique, where the algorithm groups similar data points together. K-means clustering divides data into a predefined number of clusters by minimising within-cluster variance. Another important area is dimensionality reduction, which simplifies data by reducing the number of features while preserving essential information. Principal Component Analysis (PCA) is a common method for this purpose.

聚类是一种主要的无监督学习技术,算法将相似的数据点分组在一起。K 均值聚类通过最小化簇内方差,将数据划分为预定义数量的簇。另一个重要领域是降维,它通过减少特征数量来简化数据,同时保留基本信息。主成分分析 (PCA) 是用于此目的的常用方法。

5. Reinforcement Learning | 强化学习

Reinforcement learning (RL) involves an agent that learns to make decisions by performing actions in an environment and receiving feedback in the form of rewards or penalties. The agent's objective is to maximise the cumulative reward over time. Unlike supervised learning, there are no correct answers provided in advance; the agent discovers successful strategies through trial and error.

强化学习涉及一个智能体,它通过在一个环境中执行动作并接收以奖励或惩罚形式出现的反馈来学习做出决策。智能体的目标是随着时间的推移最大化累积奖励。与监督学习不同,没有预先提供正确答案;智能体通过反复试验来发现成功的策略。

Key concepts in reinforcement learning include the policy (the strategy the agent follows), the reward signal, the value function (which estimates future rewards), and the environment model. RL is widely used in game playing, robotics, and autonomous driving. For example, an RL agent can learn to play a video game by receiving positive rewards for increasing the score and negative rewards for losing lives.

强化学习中的关键概念包括策略(智能体遵循的策略)、奖励信号、价值函数(用于估计未来的奖励)以及环境模型。强化学习被广泛应用于游戏对弈、机器人和自动驾驶。例如,一个强化学习智能体可以通过增加分数获得正奖励、失去生命获得负奖励的方式学会玩电子游戏。


6. The Machine Learning Workflow | 机器学习工作流程

A typical machine learning project follows a structured workflow to ensure reliable results. It begins with problem definition and data collection, followed by data preprocessing, model selection, training, evaluation, and deployment. Each stage is iterative, meaning results from later stages often lead to revisiting earlier decisions.

一个典型的机器学习项目遵循结构化的流程以确保获得可靠的结果。它从问题定义和数据收集开始,然后是数据预处理、模型选择、训练、评估和部署。每个阶段都是迭代的,意味着后期阶段的结果常常会促使人们重新审视早期的决策。

Data preprocessing is crucial because real-world data is rarely clean and ready for analysis. It involves handling missing values, normalising numeric features, encoding categorical variables, and splitting the dataset into training, validation, and test sets. A well-structured workflow prevents data leakage and ensures the model generalises well to new data.

数据预处理至关重要,因为现实世界的数据很少是干净且可直接用于分析的。它涉及处理缺失值、标准化数值特征、对分类变量进行编码,以及将数据集划分为训练集、验证集和测试集。一个结构良好的工作流程可防止数据泄漏,并确保模型能很好地泛化到新数据上。


广告 / Sponsored

7. Data Preprocessing | 数据预处理

Data preprocessing transforms raw data into a format suitable for machine learning algorithms. This step often includes cleaning data by removing duplicates or correcting errors, handling missing values by imputation or removal, and feature scaling to bring numerical values onto a similar scale. Common scaling methods are min-max normalisation and standardisation (z-score).

数据预处理将原始数据转换为适合机器学习算法的格式。此步骤通常包括通过删除重复项或修正错误来清洗数据,通过填充或删除来处理缺失值,以及进行特征缩放使数值处于相似的范围。常见的缩放方法有最小-最大归一化和标准化(z 分数)。

For categorical data, such as colour (red, blue, green) or country names, encoding is necessary because most machine learning models require numerical input. One-hot encoding creates binary columns for each category, while label encoding assigns a unique integer to each class. The choice depends on whether the categories have an ordinal relationship.

对于分类数据,例如颜色(红、蓝、绿)或国家名称,需要进行编码,因为大多数机器学习模型需要数值输入。独热编码为每个类别创建二元列,而标签编码则为每个类分配一个唯一的整数。选择哪种方法取决于类别是否具有顺序关系。


8. Training, Validation and Testing | 训练、验证与测试

To build a generalisable model, the dataset is typically split into three subsets: training, validation, and test sets. The training set is used to fit the model's parameters. The validation set is used to tune hyperparameters and select the best model version during development, without touching the test set.

为了构建一个可泛化的模型,数据集通常被划分为三个子集:训练集、验证集和测试集。训练集用于拟合模型的参数。验证集用于在开发过程中调整超参数并选择最佳模型版本,而不接触测试集。

The test set is held back until the very end. It provides an unbiased evaluation of the final model's performance on unseen data. A common split ratio is 70% training, 15% validation, and 15% testing, though this varies with dataset size. Cross-validation is another technique where multiple splits are created to make efficient use of limited data.

测试集被保留到最后。它能对最终模型在未见过的数据上的性能提供无偏评估。常见的划分比例是 70% 训练、15% 验证和 15% 测试,不过这取决于数据集的大小。交叉验证是另一种技术,通过创建多个分割来高效利用有限的数据。


9. Overfitting and Underfitting | 过拟合与欠拟合

Overfitting occurs when a model learns the training data too well, capturing noise and random fluctuations instead of the underlying pattern. Such a model performs excellently on training data but poorly on new, unseen data. It is like memorising the answers for a specific past paper rather than understanding the subject.

过拟合发生于模型对训练数据学习得过于到位,捕获了噪声和随机波动而不是潜在模式。这样的模型在训练数据上表现出色,但在新的未见过的数据上表现不佳。这就像死记硬背某份往年的试卷答案而不理解这门学科。

Underfitting, on the other hand, happens when a model is too simple to capture the underlying structure of the data. It performs poorly on both training and test sets. Striking the right balance between model complexity and generalisation is a central challenge. Regularisation techniques, pruning in decision trees, and using more training data can help combat overfitting.

另一方面,欠拟合发生在模型过于简单而无法捕捉数据底层结构的情况下。它在训练集和测试集上都表现不佳。在模型复杂度和泛化能力之间找到恰当的平衡是一个核心挑战。正则化技术、决策树中的剪枝以及使用更多训练数据都有助于克服过拟合。


10. Evaluation Metrics | 评估指标

Choosing the right evaluation metric is essential for interpreting model performance. For classification tasks, accuracy (the proportion of correct predictions) is intuitive but can be misleading when classes are imbalanced. Precision, recall, and the F1-score provide a more nuanced view by considering false positives and false negatives.

选择合适的评估指标对于解读模型性能至关重要。对于分类任务,准确率(正确预测的比例)很直观,但在类别不平衡时可能会产生误导。精确率、召回率和 F1 分数通过考虑假正例和假负例,提供了一个更细致的视角。

A confusion matrix is a table that summarises correct and incorrect predictions by class. It allows calculation of metrics such as:

For regression tasks, common metrics include Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE).

混淆矩阵是一个按类别汇总正确和错误预测情况的表格。它可用于计算诸如以下指标:

对于回归任务,常用指标包括平均绝对误差 (MAE) 和均方根误差 (RMSE)。


11. Ethical Considerations | 伦理考量

Machine learning systems can have profound ethical implications. Bias in training data can lead to discriminatory outcomes, reinforcing societal inequalities. For example, a hiring algorithm trained on historical data might favour certain demographics if past hiring decisions were biased. Transparency and fairness are critical principles in responsible AI development.

机器学习系统可能具有深远的伦理影响。训练数据中的偏见可能导致歧视性结果,加剧社会不平等。例如,如果过去的招聘决策存在偏见,那么基于历史数据训练的招聘算法可能会偏向某些人口群体。透明度和公平性是负责任的人工智能开发中的关键原则。

Other concerns include privacy violations from collecting massive datasets, the black-box nature of some models making decisions hard to explain, and the potential for job displacement. Students are expected to discuss these issues and propose ways to mitigate harm, such as using diverse datasets, conducting algorithmic audits, and involving human oversight.

其他问题包括因收集海量数据而造成的隐私侵犯、某些模型的黑箱特性导致决策难以解释,以及潜在的就业岗位流失。学生们应讨论这些问题并提出减轻危害的方法,例如使用多样化的数据集、开展算法审计,以及引入人工监督。


12. Real-World Applications | 实际应用

Machine learning is embedded in countless everyday technologies. Recommendation systems on platforms like Netflix and Amazon use collaborative filtering to suggest content based on user behaviour. Natural language processing (NLP) powers voice assistants, machine translation, and sentiment analysis. Computer vision enables facial recognition, medical image diagnosis, and autonomous vehicles.

机器学习嵌入了无数的日常技术中。像 Netflix 和亚马逊等平台上的推荐系统使用协同过滤,根据用户行为推荐内容。自然语言处理 (NLP) 为语音助手、机器翻译和情感分析提供支持。计算机视觉使得面部识别、医学图像诊断和自动驾驶汽车成为可能。

In finance, machine learning detects fraudulent transactions and predicts stock market trends. Healthcare uses predictive models to identify patients at risk of certain diseases. Even in agriculture, ML helps monitor crop health and optimise irrigation. Understanding these applications helps students appreciate the breadth and impact of machine learning in society.

在金融领域,机器学习可检测欺诈性交易并预测股票市场趋势。医疗保健领域使用预测模型来识别有患某些疾病风险的患者。即使在农业领域,机器学习也有助于监测作物健康并优化灌溉。了解这些应用有助于学生领会机器学习在社会中的广泛性和影响力。

Published by TutorHao | IB WJEC Computer Science Revision Series | aleveler.com

广告 / Sponsored
现货 Cambridge Biology for the IB Diploma coursebook 剑桥国际文凭 I…
生物 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥546.0

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao