- 博客(7)
- 收藏
- 关注
原创 决策树与随机森林的sklearn实现(update on going)
决策树对iris数据进行决策树分类,采用sklearn库实现。决策树算法不需要对原始数据进行归一化处理,缺点是容易陷入过拟合,此时可以通过剪枝来控制树的深度。# Author: Daniel Gengfrom sklearn import treefrom sklearn.datasets import load_irisimport matplotlib.pyplot as pltimport numpy as npX, y = load_iris(return_X_y=True)sam
2020-11-09 16:58:15 224
原创 OvR逻辑回归多分类算法
OvR在二分类逻辑回归的基础上,采用One vs Rest的方法进行多分类。最终分类由概率最高的OvR决定。在二分类实验中,会发现对versicolor的分类准确性和覆盖率很差,对virginica的分类也不是很理想,只有对setosa的分类很准。采用OvR综合决策后,分类准确率极大提升,正确率达到95%左右。# Author: Daniel Geng# In this code, let's change the method to Gradient descent. We start from s
2020-11-06 09:44:58 1287
原创 PCA主成分分析及其实现
原理通过高维向低维投影实现降维,通过评估信息损失实现维度的选择。sk-learn实现# Author: Daniel Gengimport csvfrom sklearn.preprocessing import StandardScalerfrom sklearn.decomposition import PCAimport numpy as npimport matplotlib.pyplot as pltimport pandas as pddef ImportData(file
2020-11-04 18:42:50 534
原创 逻辑回归及其Numpy实现
逻辑回归原理插入手写算法图片Python实现# Author: Daniel Geng# In this code, let's change the method to Gradient descent. We start from single feature.import csvimport numpy as npimport matplotlib.pyplot as plimport randomimport scipy.special# Import Iris raw da
2020-11-03 08:45:16 522
原创 梯度下降法与单变量、多变量线性回归
梯度下降法求解线性回归单变量线性回归单变量线性回归这一次首先从单变量线性回归开始,仍以房价预测作为例子。首先回顾理论基础——最小化代价函数,如下。```python# Author: Daniel Geng# In this code, let's change the method to Gradient descent. We start from single feature.import csvimport numpy as npimport matplotlib.pyplo
2020-10-29 19:15:56 362
原创 正规方程法求解多变量线性回归最优解
正规方程法求解多变量线性回归最优解正规方程法关于正规方程求解的数学推导原理参加另一篇博文和吴恩达的机器学习公开课,blog如下,本文直接使用结论:https://blog.csdn.net/weixin_39449570/article/details/78520543关于梯度下降法和正规方程法的使用场景参加吴恩达机器学习公开课,此处截图如下。另外采用正规方程法无需进行Feature值的归一化。正规方程法的Numpy实现案例1 - 房价预测数据集:HousePrices - https://
2020-10-23 18:46:33 1659
原创 配置Numpy环境
配置Numpy环境环境版本信息在Pycharm venv环境中安装包在Python解释器中安装包环境版本信息Python: 3.8IDE: Pycharm 2020.2.1numpy: 1.19.2pip: 20.2.4scipy: 1.5.3matplotlib: 3.3.2在Pycharm venv环境中安装包以scipy为例,下载对应版本(Python3.8, windows 64位)。进入Pycharm Terminal, 输入命令:pip install C:\Users\64
2020-10-22 10:58:50 1077
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人