20.🔗本章代码笔记📓链接(需要🪜):(01_the_machine_learning_landscape.ipynb - Colab (google.com))
如果你不想通过上面的官方网址下载本章的笔记,还可以在本篇博文的附件中下载笔记!但我更推荐你支持原版的书和原版的网址
21.参考答案原文及其中文翻译:
Machine Learning is about building systems that can learn from data.
机器学习是关于构建能够从数据中学习的系统。Learning means getting better at some task, given some performance measure.
学习意味着在某些任务上变得更好,这是根据某些性能度量来衡量的。Machine Learning is great for complex problems for which we have no algorithmic solution, to replace long lists of hand-tuned rules, to build systems that adapt to fluctuating environments, and finally to help humans learn (e.g., data mining).
机器学习非常适合那些我们没有算法解决方案的复杂问题,用来替代长长的手工调整规则列表,构建能够适应波动环境的系统,最终帮助人类学习(例如,数据挖掘)。A labeled training set is a training set that contains the desired solution (a.k.a. a label) for each instance.
一个被标记的训练集是一个训练集,它为每个实例包含了期望的解决方案(即标签)。The two most common supervised tasks are regression and classification.
两种最常见的监督任务是回归和分类。Common unsupervised tasks include clustering, visualization, dimensionality reduction, and association rule learning.
常见的无监督任务包括聚类、可视化、降维和关联规则学习。Reinforcement Learning is likely to perform best if we want a robot to learn to walk in various unknown terrains, since this is typically the type of problem that Reinforcement Learning tackles. It might be possible to express the problem as a supervised or semi-supervised learning problem, but it would be less natural.
如果我们希望机器人学会在各种未知地形中行走,强化学习可能会表现得最好,因为这是强化学习通常处理的问题类型。虽然有可能将问题表达为监督或半监督学习问题,但这样做会显得不那么自然。If you don’t know how to define the groups, then you can use a clustering algorithm (unsupervised learning) to segment your customers into clusters of similar customers. However, if you know what groups you would like to have, then you can feed many examples of each group to a classification algorithm (supervised learning), and it will classify all your customers into these groups.
如果你不知道如何定义组别,那么可以使用聚类算法(无监督学习)将客户分割成相似客户的群集。然而,如果你知道你想要的组别,那么你可以向分类算法(监督学习)提供每个组的许多示例,它将把所有客户分类到这些组中。Spam detection is a typical supervised learning problem: the algorithm is fed many emails along with their labels (spam or not spam).
垃圾邮件检测是一个典型的监督学习问题:算法被输入了许多电子邮件及其标签(垃圾邮件或非垃圾邮件)。An online learning system can learn incrementally, as opposed to a batch learning system. This makes it capable of adapting rapidly to both changing data and autonomous systems, and of training on very large quantities of data.
在线学习系统可以逐步学习,与批量学习系统相反。这使得它能够快速适应变化的数据和自主系统,并且能够训练大量数据。Out-of-core algorithms can handle vast quantities of data that cannot fit in a computer’s main memory. An out-of-core learning algorithm chops the data into mini-batches and uses online learning techniques to learn from these mini-batches.
核心外算法可以处理大量无法适应计算机主存储器的数据。核心外学习算法将数据分割成小批量,并使用在线学习技术从小批量中学习。An instance-based learning system learns the training data by heart; then, when given a new instance, it uses a similarity measure to find the most similar learned instances and uses them to make predictions.
基于实例的学习系统通过心记忆训练数据;然后,当给定一个新的实例时,它使用相似性度量来找到最相似的学习实例,并用它们进行预测。A model has one or more model parameters that determine what it will predict given a new instance (e.g., the slope of a linear model). A learning algorithm tries to find optimal values for these parameters such that the model generalizes well to new instances. A hyperparameter is a parameter of the learning algorithm itself, not of the model (e.g., the amount of regularization to apply).
模型有一个或多个模型参数,这些参数决定了它将对新实例进行什么预测(例如,线性模型的斜率)。学习算法试图找到这些参数的最优值,以便模型能够很好地泛化到新实例。超参数是学习算法本身的参数,而不是模型的参数(例如,要应用的正则化量)。Model-based learning algorithms search for an optimal value for the model parameters such that the model will generalize well to new instances. We usually train such systems by minimizing a cost function that measures how bad the system is at making predictions on the training data, plus a penalty for model complexity if the model is regularized. To make predictions, we feed the new instance’s features into the model’s prediction function, using the parameter values found by the learning algorithm.
基于模型的学习算法寻找模型参数的最优值,以便模型能够很好地泛化到新实例。我们通常通过最小化一个代价函数来训练这样的系统,该函数衡量系统在训练数据上进行预测的表现有多差,如果模型进行了正则化,还会加上模型复杂性的惩罚。要进行预测,我们将新实例的特征输入到模型的预测函数中,使用学习算法找到的参数值。Some of the main challenges in Machine Learning are the lack of data, poor data quality, nonrepresentative data, uninformative features, excessively simple models that underfit the training data, and excessively complex models that overfit the data.
机器学习面临的一些主要挑战包括数据缺乏、数据质量差、数据不具代表性、特征不具信息量、过于简单的模型导致训练数据欠拟合,以及过于复杂的模型导致数据过拟合。If a model performs great on the training data but generalizes poorly to new instances, the model is likely overfitting the training data (or we got extremely lucky on the training data). Possible solutions to overfitting are getting more data, simplifying the model (selecting a simpler algorithm, reducing the number of parameters or features used, or regularizing the model), or reducing the noise in the training data.
如果一个模型在训练数据上表现很好,但对新实例的泛化能力很差,那么模型可能过拟合了训练数据(或者我们在训练数据上非常幸运)。解决过拟合的可能方案是获取更多数据、简化模型(选择一个更简单的算法、减少使用的参数或特征数量,或者对模型进行正则化)或减少训练数据中的噪声。A test set is used to estimate the generalization error that a model will make on new instances, before the model is launched in production.
测试集用于在模型投入生产之前估计模型将在新实例上犯的泛化错误。A validation set is used to compare models. It makes it possible to select the best model and tune the hyperparameters.
验证集用于比较模型。它使得选择最佳模型和调整超参数成为可能。The train-dev set is used when there is a risk of mismatch between the training data and the data used in the validation and test datasets (which should always be as close as possible to the data used once the model is in production). The train-dev set is a part of the training set that’s held out (the model is not trained on it). The model is trained on the rest of the training set, and evaluated on both the train-dev set and the validation set. If the model performs well on the training set but not on the train-dev set, then the model is likely overfitting the training set. If it performs well on both the training set and the train-dev set, but not on the validation set, then there is probably a significant data mismatch between the training data and the validation + test data, and you should try to improve the training data to make it look more like the validation + test data.
当训练数据与验证和测试数据集使用的数据之间存在不匹配的风险时,使用训练-开发集(train-dev set)。训练-开发集是保留出来的训练集的一部分(模型未在此部分上训练)。模型在训练集的其余部分上进行训练,并在训练-开发集和验证集上进行评估。如果模型在训练集上表现良好,但在训练-开发集上表现不佳,那么模型可能过拟合了训练集。如果它在训练集和训练-开发集上都表现良好,但在验证集上表现不佳,那么训练数据与验证+测试数据之间可能存在显著的数据不匹配,你应该尝试改进训练数据,使其更接近验证+测试数据。If you tune hyperparameters using the test set, you risk overfitting the test set, and the generalization error you measure will be optimistic (you may launch a model that performs worse than you expect).
如果你使用测试集来调整超参数,你冒着过拟合测试集的风险,你测量的泛化错误将会是乐观的(你可能推出的模型表现比你预期的要差)。