![]() ![]() |
机器学习Python版(英文版) 读者对象:机器学习初学者、爱好者
本书面向初学者,使用Python语言以及流行的scikit-learn机器学习库等资源,通过易于实践的项目,帮助读者掌握开发有效的机器学习系统所需的流程、模式和策略。本书首先介绍机器学习的基本概念和机器学习系统的评估技术;之后扩展工具库,引入另外几种分类和回归技术以及特征工程;最后介绍一些较为前沿的新技术,包括组合机器学习模型和自动化特征工程模型等,并将机器学习应用于图像处理和文本处理两个特定领域。本书不依赖于复杂的数学公式,仅要求读者具备一定的编程基础,适合学生、数据分析人员、科研人员等各领域的读者阅读参考。
第一部分 机器学习入门
第1章 机器学习概论 3 1.1 欢迎来到机器学习的世界 3 1.2 范围、术语、预测和数据 4 1.2.1 特征 5 1.2.2 目标值和预测值 6 1.3 让机器开始机器学习 7 1.4 学习系统举例 9 1.4.1 预测类别:分类器举例 9 1.4.2 预测值:回归器举例 10 1.5 评估机器学习系统 11 1.5.1 准确率 11 1.5.2 资源消耗 12 1.6 创建机器学习系统的过程 13 1.7 机器学习的假设和现实 15 1.8 参考阅读资料 17 1.8.1 进一步研究方向 17 1.8.2 注释 17 第2章 相关技术背景 19 2.1 编程环境配置 19 2.2 数学语言的必要性 19 2.3 用于解决机器学习问题的软件 20 2.4 概率 21 2.4.1 基本事件 22 2.4.2 独立性 23 2.4.3 条件概率 24 2.4.4 概率分布 25 2.5 线性组合、加权和以及点积 28 2.5.1 加权平均 30 2.5.2 平方和 32 2.5.3 误差平方和 33 2.6 几何视图:空间中的点 34 2.6.1 直线 34 2.6.2 直线拓展 39 2.7 表示法和加1技巧 43 2.8 渐入佳境:突破线性和非线性 45 2.9 NumPy与“数学无所不在” 47 2.9.1 一维数组与二维数组 49 2.10 浮点数问题 52 2.11 参考阅读资料 53 2.11.1 小结 53 2.11.2 注释 54 第3章 预测类别:分类入门 55 3.1 分类任务 55 3.2 一个简单的分类数据集 56 3.3 训练和测试:请勿“应试教育” 59 3.4 评估:考试评分 62 3.5 简单分类器1:最近邻分类器、远距离关系和假设 63 3.5.1 定义相似性 63 3.5.2 k-最近邻中的k 64 3.5.3 答案组合 64 3.5.4 k-最近邻、参数和非参数方法 65 3.5.5 建立一个k-最近邻分类模型 66 3.6 简单分类器2:朴素贝叶斯分类器、概率和违背承诺 68 3.7 分类器的简单评估 70 3.7.1 机器学习的性能 70 3.7.2 分类器的资源消耗 71 3.7.3 独立资源评估 77 3.8 参考阅读资料 81 3.8.1 再次警告:局限性和尚未解决的问题 81 3.8.2 小结 82 3.8.3 注释 82 3.8.4 练习题 83 第4章 预测数值:回归入门 85 4.1 一个简单的回归数据集 85 4.2 最近邻回归和汇总统计 87 4.2.1 中心测量:中位数和均值 88 4.2.2 构建一个k-最近邻回归模型 90 4.3 线性回归和误差 91 4.3.1 地面总是不平坦的:为什么需要斜坡 92 4.3.2 倾斜直线 94 4.3.3 执行线性回归 97 4.4 优化:选择最佳答案 98 4.4.1 随机猜测 98 4.4.2 随机步进 99 4.4.3 智能步进 99 4.4.4 计算的捷径 100 4.4.5 线性回归的应用 101 4.5 回归器的简单评估和比较 101 4.5.1 均方根误差 101 4.5.2 机器学习的性能 102 4.5.3 回归过程中的资源消耗 102 4.6 参考阅读资料 104 4.6.1 局限性和尚未解决的问题 104 4.6.2 小结 105 4.6.3 注释 105 4.6.4 练习题 105 第二部分 通用评估技术 第5章 机器学习算法的评估和比较分析 109 5.1 评估和大道至简的原则 109 5.2 机器学习阶段的术语 110 5.2.1 有关机器的重新讨论 110 5.2.2 更规范的阐述 113 5.3 过拟合和欠拟合 116 5.3.1 合成数据和线性回归 117 5.3.2 手动操控模型的复杂度 118 5.3.3 “恰到好处”原则:可视化过拟合、欠拟合和最佳拟合 120 5.3.4 简单性 124 5.3.5 关于过拟合必须牢记的注意事项 124 5.4 从误差到成本 125 5.4.1 损失 125 5.4.2 成本 126 5.4.3 评分 127 5.5 (重新)抽样:以少胜多 128 5.5.1 交叉验证 128 5.5.2 分层抽样 132 5.5.3 重复的训练–测试数据集拆分 133 5.5.4 一种更好的方法和混排 137 5.5.5 留一交叉验证 140 5.6 分解:将误差分解为偏差和方差 142 5.6.1 数据的方差 143 5.6.2 模型的方差 144 5.6.3 模型的偏差 144 5.6.4 结合所有的因素 145 5.6.5 偏差–方差权衡示例 145 5.7 图形可视化评估和比较 149 5.7.1 学习曲线:到底需要多少数据 150 5.7.2 复杂度曲线 152 5.8 使用交叉验证比较机器学习模型 154 5.9 参考阅读资料 155 5.9.1 小结 155 5.9.2 注释 155 5.9.3 练习题 157 第6章 评估分类器 159 6.1 基线分类器 159 6.2 准确度以外:分类器的其他度量指标 161 6.2.1 从混淆矩阵中消除混淆 163 6.2.2 错误的方式 164 6.2.3 基于混淆矩阵的度量指标 165 6.2.4 混淆矩阵编码 166 6.2.5 处理多元类别:多元类别平均 168 6.2.6 F1分数 170 6.3 ROC曲线 170 6.3.1 ROC模式 173 6.3.2 二元分类ROC 174 6.3.3 AUC:(ROC)曲线下的面积 177 6.3.4 多元分类机器学习模型、一对其他和ROC 179 6.4 多元分类的另一种方法:一对一 181 6.4.1 多元分类AUC第二部分:寻找单一值 182 6.5 精确率–召回率曲线 185 6.5.1 关于精确率–召回率权衡的说明 185 6.5.2 构建精确率–召回率曲线 186 6.6 累积响应和提升曲线 187 6.7 更复杂的分类器评估:第二阶段 190 6.7.1 二元分类 190 6.7.2 一个新颖的多元分类问题 195 6.8 参考阅读资料 201 6.8.1 小结 201 6.8.2 注释 202 6.8.3 练习题 203 第7章 评估回归器 205 7.1 基线回归器 205 7.2 回归器的其他度量指标 207 7.2.1 创建自定义的评估指标 207 7.2.2 其他内置的回归度量指标 208 7.2.3 R2 209 7.3 残差图 214 7.3.1 误差图 215 7.3.2 残差图 217 7.4 标准化初探 221 7.5 使用更复杂的方法评估回归系数:第二阶段 225 7.5.1 多个度量指标的交叉验证结果 226 7.5.2 交叉验证结果汇总 230 7.5.3 残差 230 7.6 参考阅读资料 232 7.6.1 小结 232 7.6.2 注释 232 7.6.3 练习题 234 第三部分 更多方法和其他技术 第8章 更多分类方法 237 8.1 重温分类知识 237 8.2 决策树 239 8.2.1 树构建算法 242 8.2.2 让我们开始:决策树时间 245 8.2.3 决策树中的偏差和方差 249 8.3 支持向量分类器 249 8.3.1 执行支持向量分类器 253 8.3.2 SVC中的偏差和方差 256 8.4 逻辑回归 259 8.4.1 投注几率 259 8.4.2 概率、几率和对数几率 262 8.4.3 实现操作:逻辑回归版本 267 8.4.4 逻辑回归:空间奇异性 268 8.5 判别分析 269 8.5.1 协方差 270 8.5.2 方法 282 8.5.3 执行判别分析 283 8.6 假设、偏差和分类器 285 8.7 分类器的比较:第三阶段 287 8.7.1 数字 287 8.8 参考阅读资料 290 8.8.1 小结 290 8.8.2 注释 290 8.8.3 练习题 293 第9章 更多回归方法 295 9.1 惩罚框中的线性回归:正则化 295 9.1.1 执行正则化回归 300 9.2 支持向量回归 301 9.2.1 铰链损失 301 9.2.2 从线性回归到正则化回归,再到支持向量回归 305 9.2.3 实践应用:支持向量回归风格 307 9.3 分段常数回归 308 9.3.1 实现分段常数回归器 310 9.3.2 模型实现的一般说明 311 9.4 回归树 313 9.4.1 用决策树实现回归 313 9.5 回归器比较:第三阶段 314 9.6 参考阅读资料 318 9.6.1 小结 318 9.6.2 注释 318 9.6.3 练习题 319 第10章 手动特征工程:操作数据的乐趣和意义 321 10.1 特征工程的术语和动机 321 10.1.1 为什么选择特征工程 322 10.1.2 何时开始特征工程 323 10.1.3 特征工程是如何发生的 324 10.2 特征选择和数据简化:清除垃圾 324 10.3 特征缩放 325 10.4 离散化 329 10.5 分类编码 332 10.5.1 编码的另一种方式以及无截距的奇怪情况 334 10.6 关系和相互作用 341 10.6.1 手动特征构造 341 10.6.2 相互作用 343 10.6.3 使用转换器添加特征 348 10.7 对输入空间和目标的相关操作 350 10.7.1 对输入空间的相关操作 351 10.7.2 对目标的相关操作 353 10.8 参考阅读资料 356 10.8.1 小结 356 10.8.2 注释 356 10.8.3 练习题 357 第11章 调整超参数和管道技术 359 11.1 模型、参数、超参数 360 11.2 调整超参数 362 11.2.1 关于计算机科学和机器学习术语的说明 362 11.2.2 关于完整搜索的示例 362 11.2.3 使用随机性在大海中捞针 368 11.3 递归的神奇世界:嵌套交叉验证 370 11.3.1 重温交叉验证 370 11.3.2 作为模型的网格搜索 371 11.3.3 交叉验证中嵌套的交叉验证 372 11.3.4 关于嵌套交叉验证的注释 375 11.4 管道技术 377 11.4.1 简单的管道 378 11.4.2 复杂的管道 379 11.5 管道和调参相结合 380 11.6 参考阅读资料 382 11.6.1 小结 382 11.6.2 注释 382 11.6.3 练习题 383 第四部分 高级主题 第12章 组合机器学习模型 387 12.1 集成 387 12.2 投票集成 389 12.3 装袋法和随机森林 390 12.3.1 自举 390 12.3.2 从自举到装袋法 394 12.3.3 随机森林 396 12.4 提升方法 398 12.4.1 提升方法的核心理念 399 12.5 各种树集成方法的比较 401 12.6 参考阅读资料 405 12.6.1 小结 405 12.6.2 注释 405 12.6.3 练习题 406 第13章 提供特征工程的模型 409 13.1 特征选择 411 13.1.1 基于度量特征的“单步筛选”方法 412 13.1.2 基于模型的特征选择 423 13.1.3 将特征选择与机器学习管道相集成 426 13.2 基于核的特征构造 428 13.2.1 核激励因子 428 13.2.2 手动核方法 433 13.2.3 核方法和核选项 438 13.2.4 核化支持向量分类器:支持向量机 442 13.2.5 关于SVM的建议和示例 443 13.3 主成分分析:一种无监督技术 445 13.3.1 预热:中心化数据 445 13.3.2 寻找不同的最佳线路 448 13.3.3 第一次执行PCA 449 13.3.4 PCA的内部原理 452 13.3.5 对一般PCA的评论 457 13.3.6 核心PCA和流形方法 458 13.4 参考阅读资料 462 13.4.1 小结 462 13.4.2 注释 462 13.4.3 练习题 467 第14章 领域特征工程:领域特定的机器学习 469 14.1 处理文本 470 14.1.1 对文本进行编码 471 14.1.2 文本学习的示例 476 14.2 聚类 479 14.2.1 k-均值聚类 479 14.3 处理图像 481 14.3.1 视觉词袋 481 14.3.2 图像数据 482 14.3.3 端到端系统 483 14.3.4 全局视觉词袋转换器的完整代码 491 14.4 参考阅读资料 493 14.4.1 小结 493 14.4.2 注释 494 14.4.3 练习题 495 第15章 连接、扩展和进一步研究方向 497 15.1 优化 497 15.2 基于原始数据的线性回归 500 15.2.1 线性回归的可视化视图 504 15.3 基于原始数据构建逻辑回归 504 15.3.1 采用0-1编码的逻辑回归 506 15.3.2 采用加1减1编码的逻辑回归 508 15.3.3 逻辑回归的可视化视图 509 15.4 基于原始数据的SVM 510 15.5 神经网络 512 15.5.1 线性回归的神经网络视图 512 15.5.2 逻辑回归的神经网络视图 515 15.5.3 超越基本神经网络 516 15.6 概率图模型 516 15.6.1 抽样 518 15.6.2 线性回归的概率图模型视图 519 15.6.3 逻辑回归的概率图模型视图 523 15.7 参考阅读资料 525 15.7.1 小结 525 15.7.2 注释 526 15.7.3 练习题 527 附录A mlwpy.py程序清单 529 Contents I First Steps 1 1 Let’s Discuss Learning 3 1.1 Welcome 3 1.2 Scope, Terminology, Prediction, and Data 4 1.2.1 Features 5 1.2.2 Target Values and Predictions 6 1.3 Putting the Machine in Machine Learning 7 1.4 Examples of Learning Systems 9 1.4.1 Predicting Categories: Examples of Classifiers 9 1.4.2 Predicting Values: Examples of Regressors 10 1.5 Evaluating Learning Systems 11 1.5.1 Correctness 11 1.5.2 Resource Consumption 12 1.6 A Process for Building Learning Systems 13 1.7 Assumptions and Reality of Learning 15 1.8 End-of-Chapter Material 17 1.8.1 The Road Ahead 17 1.8.2 Notes 17 2 Some Technical Background 19 2.1 About Our Setup 19 2.2 The Need for Mathematical Language 19 2.3 Our Software for Tackling Machine Learning 20 2.4 Probability 21 2.4.1 Primitive Events 22 2.4.2 Independence 23 2.4.3 Conditional Probability 24 2.4.4 Distributions 25 2.5 Linear Combinations, Weighted Sums, and Dot Products 28 2.5.1 Weighted Average 30 2.5.2 Sums of Squares 32 2.5.3 Sum of Squared Errors 33 2.6 A Geometric View: Points in Space 34 2.6.1 Lines 34 2.6.2 Beyond Lines 39 2.7 Notation and the Plus-One Trick 43 2.8 Getting Groovy, Breaking the Straight-Jacket, and Nonlinearity 45 2.9 NumPy versus “All the Maths” 47 2.9.1 Back to 1D versus 2D 49 2.10 Floating-Point Issues 52 2.11 EOC 53 2.11.1 Summary 53 2.11.2 Notes 54 3 Predicting Categories: Getting Started with Classification 55 3.1 Classification Tasks 55 3.2 A Simple Classification Dataset 56 3.3 Training and Testing: Don’t Teach to the Test 59 3.4 Evaluation: Grading the Exam 62 3.5 Simple Classifier #1: Nearest Neighbors, Long Distance Relationships, and Assumptions 63 3.5.1 Defining Similarity 63 3.5.2 The k in k-NN 64 3.5.3 Answer Combination 64 3.5.4 k-NN, Parameters, and Nonparametric Methods 65 3.5.5 Building a k-NN Classification Model 66 3.6 Simple Classifier #2: Naive Bayes, Probability, and Broken Promises 68 3.7 Simplistic Evaluation of Classifiers 70 3.7.1 Learning Performance 70 3.7.2 Resource Utilization in Classification 71 3.7.3 Stand-Alone Resource Evaluation 77 3.8 EOC 81 3.8.1 Sophomore Warning: Limitations and Open Issues 81 3.8.2 Summary 82 3.8.3 Notes 82 3.8.4 Exercises 83 4 Predicting Numerical Values: Getting Started with Regression 85 4.1 A Simple Regression Dataset 85 4.2 Nearest-Neighbors Regression and Summary Statistics 87 4.2.1 Measures of Center: Median and Mean 88 4.2.2 Building a k-NN Regression Model 90 4.3 Linear Regression and Errors 91 4.3.1 No Flat Earth: Why We Need Slope 92 4.3.2 Tilting the Field 94 4.3.3 Performing Linear Regression 97 4.4 Optimization: Picking the Best Answer 98 4.4.1 Random Guess 98 4.4.2 Random Step 99 4.4.3 Smart Step 99 4.4.4 Calculated Shortcuts 100 4.4.5 Application to Linear Regression 101 4.5 Simple Evaluation and Comparison of Regressors 101 4.5.1 Root Mean Squared Error 101 4.5.2 Learning Performance 102 4.5.3 Resource Utilization in Regression 102 4.6 EOC 104 4.6.1 Limitations and Open Issues 104 4.6.2 Summary 105 4.6.3 Notes 105 4.6.4 Exercises 105 II Evaluation 107 5 Evaluating and Comparing Learners 109 5.1 Evaluation and Why Less Is More 109 5.2 Terminology for Learning Phases 110 5.2.1 Back to the Machines 110 5.2.2 More Technically 113 5.3 Major Tom, There’s Something Wrong: Overfitting and Underfitting 116 5.3.1 Synthetic Data and Linear Regression 117 5.3.2 Manually Manipulating Model Complexity 118 5.3.3 Goldilocks: Visualizing Overfitting, Underfitting, and “Just Right” 120 5.3.4 Simplicity 124 5.3.5 Take-Home Notes on Overfitting 124 5.4 From Errors to Costs 125 5.4.1 Loss 125 5.4.2 Cost 126 Speaking 5.4.3 Score 127 5.5 (Re)Sampling: Making More from Less 128 5.5.1 Cross-Validation 128 5.5.2 Stratification 132 5.5.3 Repeated Train-Test Splits 133 5.5.4 A Better Way and Shuffling 137 5.5.5 Leave-One-Out Cross-Validation 140 5.6 Break-It-Down: Deconstructing Error into Bias and Variance 142 5.6.1 Variance of the Data 143 5.6.2 Variance of the Model 144 5.6.3 Bias of the Model 144 5.6.4 All Together Now 145 5.6.5 Examples of Bias-Variance Tradeoffs 145 5.7 Graphical Evaluation and Comparison 149 5.7.1 Learning Curves: How Much Data Do We Need? 150 5.7.2 Complexity Curves 152 5.8 Comparing Learners with Cross-Validation 154 5.9 EOC 155 5.9.1 Summary 155 5.9.2 Notes 155 5.9.3 Exercises 157 6 Evaluating Classifiers 159 6.1 Baseline Classifiers 159 6.2 Beyond Accuracy: Metrics for Classification 161 6.2.1 Eliminating Confusion from the Confusion Matrix 163 6.2.2 Ways of Being Wrong 164 6.2.3 Metrics from the Confusion Matrix 165 6.2.4 Coding the Confusion Matrix 166 6.2.5 Dealing with Multiple Classes: Multiclass Averaging 168 6.2.6 F1 170 6.3 ROC Curves 170 6.3.1 Patterns in the ROC 173 6.3.2 Binary ROC 174 6.3.3 AUC: Area-Under-the-(ROC)- Curve 177 6.3.4 Multiclass Learners, One-versus-Rest, and ROC 179 6.4 Another Take on Multiclass: One-versus-One 181 6.4.1 Multiclass AUC Part Two: The Quest for a Single Value 182 6.5 Precision-Recall Curves 185 6.5.1 A Note on Precision-Recall Tradeoff 185 6.5.2 Constructing a Precision-Recall Curve 186 6.6 Cumulative Response and Lift Curves 187 6.7 More Sophisticated Evaluation of Classifiers: Take Two 190 6.7.1 Binary 190 6.7.2 A Novel Multiclass Problem 195 6.8 EOC 201 6.8.1 Summary 201 6.8.2 Notes 202 6.8.3 Exercises 203 7 Evaluating Regressors 205 7.1 Baseline Regressors 205 7.2 Additional Measures for Regression 207 7.2.1 Creating Our Own Evaluation Metric 207 7.2.2 Other Built-in Regression Metrics 208 7.2.3 R2 209 7.3 Residual Plots 214 7.3.1 Error Plots 215 7.3.2 Residual Plots 217 7.4 A First Look at Standardization 221 7.5 Evaluating Regressors in a More Sophisticated Way: Take Two 225 7.5.1 Cross-Validated Results on Multiple Metrics 226 7.5.2 Summarizing Cross-Validated Results 230 7.5.3 Residuals 230 7.6 EOC 232 7.6.1 Summary 232 7.6.2 Notes 232 7.6.3 Exercises 234 III More Methods and Fundamentals 235 8 More Classification Methods 237 8.1 Revisiting Classification 237 8.2 Decision Trees 239 8.2.1 Tree-Building Algorithms 242 8.2.2 Let’s Go: Decision Tree Time 245 8.2.3 Bias and Variance in Decision Trees 249 8.3 Support Vector Classifiers 249 8.3.1 Performing SVC 253 8.3.2 Bias and Variance in SVCs 256 8.4 Logistic Regression 259 8.4.1 Betting Odds 259 8.4.2 Probabilities, Odds, and Log-Odds 262 8.4.3 Just Do It: Logistic Regression Edition 267 8.4.4 A Logistic Regression: A Space Oddity 268 8.5 Discriminant Analysis 269 8.5.1 Covariance 270 8.5.2 The Methods 282 8.5.3 Performing DA 283 8.6 Assumptions, Biases, and Classifiers 285 8.7 Comparison of Classifiers: Take Three 287 8.7.1 Digits 287 8.8 EOC 290 8.8.1 Summary 290 8.8.2 Notes 290 8.8.3 Exercises 293 9 More Regression Methods 295 9.1 Linear Regression in the Penalty Box: Regularization 295 9.1.1 Performing Regularized Regression 300 9.2 Support Vector Regression 301 9.2.1 Hinge Loss 301 9.2.2 From Linear Regression to Regularized Regression to Support Vector Regression 305 9.2.3 Just Do It — SVR Style 307 9.3 Piecewise Constant Regression 308 9.3.1 Implementing a Piecewise Constant Regressor 310 9.3.2 General Notes on Implementing Models 311 9.4 Regression Trees 313 9.4.1 Performing Regression with Trees 313 9.5 Comparison of Regressors: Take Three 314 9.6 EOC 318 9.6.1 Summary 318 9.6.2 Notes 318 9.6.3 Exercises 319 Data for Fun and Profit 321 10.1 Feature Engineering Terminology and Motivation 321 10.1.1 Why Engineer Features? 322 10.1.2 When Does Engineering Happen? 323 10.1.3 How Does Feature Engineering Occur? 324 10.2 Feature Selection and Data Reduction: Taking out the Trash 324 10.3 Feature Scaling 325 10.4 Discretization 329 10.5 Categorical Coding 332 10.5.1 Another Way to Code and the Curious Case of the Missing Intercept 334 10.6 Relationships and Interactions 341 10.6.1 Manual Feature Construction 341 10.6.2 Interactions 343 10.6.3 Adding Features with Transformers 348 10.7 Target Manipulations 350 10.7.1 Manipulating the Input Space 351 10.7.2 Manipulating the Target 353 10.8 EOC 356 10.8.1 Summary 356 10.8.2 Notes 356 10.8.3 Exercises 357 359 11.1 Models, Parameters, Hyperparameters 360 11.2 Tuning Hyperparameters 362 11.2.1 A Note on Computer Science and Learning Terminology 362 11.2.2 An Example of Complete Search 362 11.2.3 Using Randomness to Search for a Needle in a Haystack 368 11 Tuning Hyperparameters and Pipelines 10 Manual Feature Engineering: Manipulating 11.3 Down the Recursive Rabbit Hole: Nested Cross-Validation 370 11.3.1 Cross-Validation, Redux 370 11.3.2 GridSearch as a Model 371 11.3.3 Cross-Validation Nested within Cross-Validation 372 11.3.4 Comments on Nested CV 375 11.4 Pipelines 377 11.4.1 A Simple Pipeline 378 11.4.2 A More Complex Pipeline 379 11.5 Pipelines and Tuning Together 380 11.6 EOC 382 11.6.1 Summary 382 11.6.2 Notes 382 11.6.3 Exercises 383 IV Adding Complexity 385 387 12.1 Ensembles 387 12.2 Voting Ensembles 389 12.3 Bagging and Random Forests 390 12.3.1 Bootstrapping 390 12.3.2 From Bootstrapping to Bagging 394 12.3.3 Through the Random Forest 396 12.4 Boosting 398 12.4.1 Boosting Details 399 12.5 Comparing the Tree-Ensemble Methods 401 12.6 EOC 405 12.6.1 Summary 405 12.6.2 Notes 405 12.6.3 Exercises 406 12 Combining Learners409 13.1 Feature Selection 411 13.1.1 Single-Step Filtering with Metric-Based Feature Selection 412 13.1.2 Model-Based Feature Selection 423 13.1.3 Integrating Feature Selection with a Learning Pipeline 426 13.2 Feature Construction with Kernels 428 13.2.1 A Kernel Motivator 428 13.2.2 Manual Kernel Methods 433 13.2.3 Kernel Methods and Kernel Options 438 13.2.4 Kernelized SVCs: SVMs 442 13.2.5 Take-Home Notes on SVM and an Example 443 13.3 Principal Components Analysis: An Unsupervised Technique 445 13.3.1 A Warm Up: Centering 445 13.3.2 Finding a Different Best Line 448 13.3.3 A First PCA 449 13.3.4 Under the Hood of PCA 452 13.3.5 A Finale: Comments on General PCA 457 13.3.6 Kernel PCA and Manifold Methods 458 13.4 EOC 462 13.4.1 Summary 462 13.4.2 Notes 462 13.4.3 Exercises 467 Domain-Specific Learning 469 14.1 Working with Text 470 14.1.1 Encoding Text 471 14.1.2 Example of Text Learning 476 14.2 Clustering 479 14.2.1 k-Means Clustering 479 13 Models That Engineer Features for Us 14 Feature Engineering for Domains: 14.3 Working with Images 481 14.3.1 Bag of Visual Words 481 14.3.2 Our Image Data 482 14.3.3 An End-to-End System 483 14.3.4 Complete Code of BoVW Transformer 491 14.4 EOC 493 14.4.1 Summary 493 14.4.2 Notes 494 14.4.3 Exercises 495 Directions 497 15.1 Optimization 497 15.2 Linear Regression from Raw Materials 500 15.2.1 A Graphical View of Linear Regression 504 15.3 Building Logistic Regression from Raw Materials 504 15.3.1 Logistic Regression with Zero-One Coding 506 15.3.2 Logistic Regression with Plus-One Minus-One Coding 508 15.3.3 A Graphical View of Logistic Regression 509 15.4 SVM from Raw Materials 510 15.5 Neural Networks 512 15.5.1 A NN View of Linear Regression 512 15.5.2 A NN View of Logistic Regression 515 15.5.3 Beyond Basic Neural Networks 516 15.6 Probabilistic Graphical Models 516 15.6.1 Sampling 518 15.6.2 A PGM View of Linear Regression 519 15 Connections, Extensions, and Further 15.6.3 A PGM View of Logistic Regression 523 15.7 EOC 525 15.7.1 Summary 525 15.7.2 Notes 526 15.7.3 Exercises 527 A mlwpy.py Listing 529 Index 537
你还可能感兴趣
我要评论
|