机器学习实战(Machine Learning in Action)笔记--Chapter1:机器学习基础

Part1 分类

监督学习一般使用两种类型的目标变量:标称型(主要用于分类)、数值型(主要用于回归)。

非均衡分类问题

第1章 机器学习基础

专家系统

训练样本、特征、目标变量(分类问题中为类别)

训练数据和测试数据

知识表示

  • 监督学习:分类、回归
  • 无监督学习
    • 将数据集合分成由类似的对象组成的多个类的过程被称为聚类
    • 将寻找描述数据统计值的过程称之为密度估计
  • 监督学习的用途:k-近邻算法、朴素贝叶斯算法、支持向量机、决策树、线性回归、局部加权线性回归、Ridge回归、Lasso最小回归系数估计
  • 无监督学习的用途:K-均值、DBSCAN、最大期望算法、Parzen窗设计

如何选择合适的算法

  1. 使用机器学习算法的目的,想要算法完成何种任务,比如是预测明天下雨的概率还是对投票者按照兴趣分组;
  2. 需要分析或收集的数据是什么

首先考虑使用机器学习算法的目的。如果想要预测目标变量的值,则可以选择监督学习算法,否则可以选择无监督学习算法。确定选择监督学习算法之后,需要进一步确定目标变量类型,如果目标变量为离散型,则可以选择分类算法;如果目标变量是连续型的数值,则需要选择回归算法。

如果不想预测目标变量的值,则可以选择无监督学习算法。进一步分析是否需要将数据划分为离散的组。如果这是唯一的需求,则使用聚类算法;如果还需要估计数据与每个分组的相似程度,则需要使用密度估计算法。

其次需要考虑的是数据问题,应该充分了解数据,对实际数据了解得越充分,越容易创建符合实际需求的应用程序。主要应该了解数据的以下特性:特征值是离散型变量还是连续型变量,特征值中是否存在缺失的值,何种原因造成缺失值,数据中是否存在异常值,某个特征发生的频率如何(是否罕见得如同海底捞针)等等。充分了解上面提到的这些数据特性可以缩短选择机器学习算法的时间。

一般来说发现最好算法的关键环节是反复试错的迭代过程。

开发机器学习应用程序的步骤

(1)收集数据
(2)准备输入数据
(3)分析输入数据
(4)训练算法
(5)算法测试
(6)使用算法

Python语言的优势

(1)Python的语法清晰
(2)易于操作纯文本文件
(3)使用广泛,存在大量的开发文档

  • SciPy和NumPy等许多科学函数库都实现了向量和矩阵操作。
  • Python的科学工具可以与绘图工具Matplotlib协同工作。Matplotlib可以绘制2D、3D图形,也可以处理科学研究中经常使用到的图形。
  • Python开发环境还提供了交互式Shell环境,允许用户开发程序时查看和检测程序内容。
  • Python开发环境将来还会集成Pylab模块,将NumPy、SciPy和Matplotlib合并为一个开发环境。

Python语言唯一的不足是性能问题。

Numpy函数库基础


from num import *   #将NumPy函数库中的所有模块引入当前的命名空间

random.rand(4,4)    #构造一个4*4的随机数组

randMat = mat(random.rand(4,4)  #调用mat()函数将数组转化为矩阵

randMat.I   #矩阵求逆

invRandMat = randMat.I

randMat*invRandMat  #结果应该是单位矩阵

myEye = randMat*invRandMat

myEye - eye(4)  #eye(4)创建4*4的单位矩阵

本系列笔记所涉及的知识、数据等信息的版权归原书作者所有,请购买正版图书。O(∩_∩)O谢谢~

参考资料:机器学习实战

Machine Learning in Action is unique book that blends the foundational theories of machine learning with the practical realities of building tools for everyday data analysis. You'll use the flexible Python programming language to build programs that implement algorithms for data classification, forecasting, recommendations, and higher-level features like summarization and simplification. About the Book A machine is said to learn when its performance improves with experience. Learning requires algorithms and programs that capture data and ferret out the interesting or useful patterns. Once the specialized domain of analysts and mathematicians, machine learning is becoming a skill needed by many. Machine Learning in Action is a clearly written tutorial for developers. It avoids academic language and takes you straight to the techniques you'll use in your day-to-day work. Many (Python) examples present the core algorithms of statistical data processing, data analysis, and data visualization in code you can reuse. You'll understand the concepts and how they fit in with tactical tasks like classification, forecasting, recommendations, and higher-level features like summarization and simplification. Readers need no prior experience with machine learning or statistical processing. Familiarity with Python is helpful. What's InsideA no-nonsense introduction Examples showing common ML tasks Everyday data analysis Implementing classic algorithms like Apriori and Adaboos =================================== Table of ContentsPART 1 CLASSIFICATION Machine learning basics Classifying with k-Nearest Neighbors Splitting datasets one feature at a time: decision trees Classifying with probability theory: naïve Bayes Logistic regression Support vector machines Improving classification with the AdaBoost meta algorithm PART 2 FORECASTING NUMERIC VALUES WITH REGRESSION Predicting numeric values: regression Tree-based regression PART 3 UNSUPERVISED LEARNING Grouping unlabeled items using k-means clustering Association analysis with the Apriori algorithm Efficiently finding frequent itemsets with FP-growth PART 4 ADDITIONAL TOOLS Using principal component analysis to simplify data Simplifying data with the singular value decomposition Big data and MapReduce
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值