From e7b815f4043e06b7162a8730ac391616eb920766 Mon Sep 17 00:00:00 2001 From: lawlite19 <849451478@qq.com> Date: Tue, 2 Jan 2018 11:21:08 +0800 Subject: [PATCH 01/11] =?UTF-8?q?:memo:=20svm=E5=8F=AF=E8=A7=86=E5=8C=96?= =?UTF-8?q?=E8=BE=B9=E7=95=8Cfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SVM/SVM_scikit-learn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SVM/SVM_scikit-learn.py b/SVM/SVM_scikit-learn.py index 3cdbb6a..43ba3df 100644 --- a/SVM/SVM_scikit-learn.py +++ b/SVM/SVM_scikit-learn.py @@ -46,7 +46,7 @@ def plot_decisionBoundary(X,y,model,class_='linear'): if class_=='linear': w = model.coef_ b = model.intercept_ - xp = np.linspace(np.min(X[:,0]),np.max(X[:,1]),100) + xp = np.linspace(np.min(X[:,0]),np.max(X[:,0]),100) yp = -(w[0,0]*xp+b)/w[0,1] plt.plot(xp,yp,'b-',linewidth=2.0) plt.show() From 0fe8d2e80db49ef529b3f3b9a1cdbda7cff7460f Mon Sep 17 00:00:00 2001 From: lawlite19 <849451478@qq.com> Date: Thu, 4 Jan 2018 18:54:06 +0800 Subject: [PATCH 02/11] :memo: fix an error of NN --- NeuralNetwok/NeuralNetwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NeuralNetwok/NeuralNetwork.py b/NeuralNetwok/NeuralNetwork.py index f728212..7929ad7 100644 --- a/NeuralNetwok/NeuralNetwork.py +++ b/NeuralNetwok/NeuralNetwork.py @@ -205,7 +205,7 @@ def checkGradient(Lambda = 0): initial_Theta1 = debugInitializeWeights(input_layer_size,hidden_layer_size); initial_Theta2 = debugInitializeWeights(hidden_layer_size,num_labels) X = debugInitializeWeights(input_layer_size-1,m) - y = 1+np.transpose(np.mod(np.arange(1,m+1), num_labels))# 初始化y + y = np.transpose(np.mod(np.arange(1,m+1), num_labels))# 初始化y y = y.reshape(-1,1) nn_params = np.vstack((initial_Theta1.reshape(-1,1),initial_Theta2.reshape(-1,1))) #展开theta From 202ff3b0c04203fb9e74856d597f0318dbc825bc Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 4 Jan 2018 12:22:59 +0100 Subject: [PATCH 03/11] Modernize Python 2 code to get ready for Python 3 --- AnomalyDetection/AnomalyDetection.py | 5 +-- K-Means/K-Menas.py | 15 +++++---- LinearRegression/LinearRegression.py | 7 ++-- .../LinearRegression_scikit-learn.py | 9 ++--- LogisticRegression/LogisticRegression.py | 5 +-- .../LogisticRegression_OneVsAll.py | 3 +- ...ogisticRegression_OneVsAll_scikit-learn.py | 3 +- .../LogisticRegression_scikit-learn.py | 33 +++++++++---------- 8 files changed, 43 insertions(+), 37 deletions(-) diff --git a/AnomalyDetection/AnomalyDetection.py b/AnomalyDetection/AnomalyDetection.py index 31bfa48..13f74a7 100644 --- a/AnomalyDetection/AnomalyDetection.py +++ b/AnomalyDetection/AnomalyDetection.py @@ -1,6 +1,7 @@ #-*- coding: utf-8 -*- # Author: Bob # Date: 2016.12.22 +from __future__ import print_function import numpy as np from matplotlib import pyplot as plt from scipy import io as spio @@ -25,8 +26,8 @@ def anomalyDetection_example(): yval = data['yval'] # y=1代表异常 pval = multivariateGaussian(Xval, mu, sigma2) # 计算CV上的概率密度值 epsilon,F1 = selectThreshold(yval,pval) # 选择最优的epsilon临界值 - print u'在CV上得到的最好的epsilon是:%e'%epsilon - print u'对应的F1Score值为:%f'%F1 + print(u'在CV上得到的最好的epsilon是:%e'%epsilon) + print(u'对应的F1Score值为:%f'%F1) outliers = np.where(p Date: Thu, 4 Jan 2018 12:33:24 +0100 Subject: [PATCH 04/11] # -*- coding: utf-8 -*- --- .../LogisticRegression_scikit-learn.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/LogisticRegression/LogisticRegression_scikit-learn.py b/LogisticRegression/LogisticRegression_scikit-learn.py index d7f4a89..200abbb 100644 --- a/LogisticRegression/LogisticRegression_scikit-learn.py +++ b/LogisticRegression/LogisticRegression_scikit-learn.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import StandardScaler from sklearn.cross_validation import train_test_split @@ -8,32 +10,32 @@ def logisticRegression(): X = data[:,0:-1] y = data[:,-1] - # ����Ϊѵ�����Ͳ��Լ� + # 划分为训练集和测试集 x_train,x_test,y_train,y_test = train_test_split(X,y,test_size=0.2) - # ��һ�� + # 归一化 scaler = StandardScaler() scaler.fit(x_train) x_train = scaler.fit_transform(x_train) x_test = scaler.fit_transform(x_test) - #�߼��ع� + # 逻辑回归 model = LogisticRegression() model.fit(x_train,y_train) - # Ԥ�� + # 预测 predict = model.predict(x_test) right = sum(predict == y_test) - predict = np.hstack((predict.reshape(-1,1),y_test.reshape(-1,1))) # ��Ԥ��ֵ����ʵֵ����һ�飬�ù۲� + predict = np.hstack((predict.reshape(-1,1),y_test.reshape(-1,1))) # 将预测值和真实值放在一块,好观察 print(predict) - print('���Լ�׼ȷ�ʣ�%f%%'%(right*100.0/predict.shape[0])) #�����ڲ��Լ��ϵ�׼ȷ�� + print('测试集准确率:%f%%'%(right*100.0/predict.shape[0])) # 计算在测试集上的准确度 -# ����txt��csv�ļ� +# 加载txt和csv文件 def loadtxtAndcsv_data(fileName,split,dataType): return np.loadtxt(fileName,delimiter=split,dtype=dataType) -# ����npy�ļ� +# 加载npy文件 def loadnpy_data(fileName): return np.load(fileName) From d8bd5f1f1ad4170336332205519daca9b52d2ac4 Mon Sep 17 00:00:00 2001 From: lawlite19 <849451478@qq.com> Date: Mon, 12 Mar 2018 11:23:20 +0800 Subject: [PATCH 05/11] =?UTF-8?q?:bug:=20fix=E5=BC=82=E5=B8=B8=E6=A3=80?= =?UTF-8?q?=E6=B5=8BF1Score=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AnomalyDetection/AnomalyDetection.py | 16 ++++++++-------- readme.md | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/AnomalyDetection/AnomalyDetection.py b/AnomalyDetection/AnomalyDetection.py index 31bfa48..642b452 100644 --- a/AnomalyDetection/AnomalyDetection.py +++ b/AnomalyDetection/AnomalyDetection.py @@ -15,9 +15,9 @@ def anomalyDetection_example(): plt.show() '''多元高斯分布函数,并可视化拟合的边界''' mu,sigma2 = estimateGaussian(X) # 参数估计(求均值和方差) - #print mu,sigma2 + #print (mu,sigma2) p = multivariateGaussian(X,mu,sigma2) # 多元高斯分布函数 - #print p + #print (p) visualizeFit(X,mu,sigma2) # 显示图像 '''选择异常点(在交叉验证CV上训练得到最好的epsilon)''' @@ -25,8 +25,8 @@ def anomalyDetection_example(): yval = data['yval'] # y=1代表异常 pval = multivariateGaussian(Xval, mu, sigma2) # 计算CV上的概率密度值 epsilon,F1 = selectThreshold(yval,pval) # 选择最优的epsilon临界值 - print u'在CV上得到的最好的epsilon是:%e'%epsilon - print u'对应的F1Score值为:%f'%F1 + print (u'在CV上得到的最好的epsilon是:%e'%epsilon) + print (u'对应的F1Score值为:%f'%F1) outliers = np.where(p Date: Wed, 16 May 2018 09:53:34 +0800 Subject: [PATCH 06/11] =?UTF-8?q?fix=20=E6=A2=AF=E5=BA=A6=E4=B8=8B?= =?UTF-8?q?=E9=99=8D=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index f0ffee1..a982f17 100644 --- a/readme.md +++ b/readme.md @@ -105,7 +105,7 @@ def computerCost(X,y,theta): - 假设函数`f(x)` - 泰勒展开:`f(x+△x)=f(x)+f'(x)*△x+o(△x)` - 令:`△x=-α*f'(x)` ,即负梯度方向乘以一个很小的步长`α` - - 将`△x`代入泰勒展开式中:`f(x+x)=f(x)-α*[f'(x)]²+o(△x)` + - 将`△x`代入泰勒展开式中:`f(x+△x)=f(x)-α*[f'(x)]²+o(△x)` - 可以看出,`α`是取得很小的正数,`[f'(x)]²`也是正数,所以可以得出:`f(x+△x)<=f(x)` - 所以沿着**负梯度**放下,函数在减小,多维情况一样。 - 实现代码 From eb27bf95cfc2e82e83f255870a8f2e8717416aec Mon Sep 17 00:00:00 2001 From: lawlite <849451478@qq.com> Date: Sat, 29 Sep 2018 00:34:27 +0800 Subject: [PATCH 07/11] :memo: some updates --- .../LogisticRegression_scikit-learn.py | 3 +- SVM/SVM_scikit-learn.py | 84 +++++++++---------- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/LogisticRegression/LogisticRegression_scikit-learn.py b/LogisticRegression/LogisticRegression_scikit-learn.py index 200abbb..2630453 100644 --- a/LogisticRegression/LogisticRegression_scikit-learn.py +++ b/LogisticRegression/LogisticRegression_scikit-learn.py @@ -2,7 +2,8 @@ from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import StandardScaler -from sklearn.cross_validation import train_test_split +# from sklearn.cross_validation import train_test_split # 0.18版本之后废弃 +from sklearn.model_selection import train_test_split import numpy as np def logisticRegression(): diff --git a/SVM/SVM_scikit-learn.py b/SVM/SVM_scikit-learn.py index 43ba3df..5b81c7c 100644 --- a/SVM/SVM_scikit-learn.py +++ b/SVM/SVM_scikit-learn.py @@ -1,71 +1,69 @@ +#-*- coding: utf-8 -*- import numpy as np from scipy import io as spio from matplotlib import pyplot as plt from sklearn import svm + def SVM(): - '''data1Է''' + '''data1——线性分类''' data1 = spio.loadmat('data1.mat') X = data1['X'] y = data1['y'] y = np.ravel(y) - plot_data(X,y) - - model = svm.SVC(C=1.0,kernel='linear').fit(X,y) # ָ˺ΪԺ˺ - plot_decisionBoundary(X, y, model) # ߽߱ - '''data2Է''' + plot_data(X, y) + + model = svm.SVC(C=1.0, kernel='linear').fit(X, y) # 指定核函数为线性核函数 + plot_decisionBoundary(X, y, model) # 画决策边界 + '''data2——非线性分类''' data2 = spio.loadmat('data2.mat') X = data2['X'] y = data2['y'] y = np.ravel(y) - plt = plot_data(X,y) + plt = plot_data(X, y) plt.show() - - model = svm.SVC(gamma=100).fit(X,y) # gammaΪ˺ϵֵԽϵԽ - plot_decisionBoundary(X, y, model,class_='notLinear') # ߽߱ - - - -# ͼ -def plot_data(X,y): - plt.figure(figsize=(10,8)) - pos = np.where(y==1) # ҵy=1λ - neg = np.where(y==0) # ҵy=0λ - p1, = plt.plot(np.ravel(X[pos,0]),np.ravel(X[pos,1]),'ro',markersize=8) - p2, = plt.plot(np.ravel(X[neg,0]),np.ravel(X[neg,1]),'g^',markersize=8) + + model = svm.SVC(gamma=100).fit(X, y) # gamma为核函数的系数,值越大拟合的越好 + plot_decisionBoundary(X, y, model, class_='notLinear') # 画决策边界 + + +# 作图 +def plot_data(X, y): + plt.figure(figsize=(10, 8)) + pos = np.where(y == 1) # 找到y=1的位置 + neg = np.where(y == 0) # 找到y=0的位置 + p1, = plt.plot(np.ravel(X[pos, 0]), np.ravel(X[pos, 1]), 'ro', markersize=8) + p2, = plt.plot(np.ravel(X[neg, 0]), np.ravel(X[neg, 1]), 'g^', markersize=8) plt.xlabel("X1") plt.ylabel("X2") - plt.legend([p1,p2],["y==1","y==0"]) + plt.legend([p1, p2], ["y==1", "y==0"]) return plt - -# ߽߱ -def plot_decisionBoundary(X,y,model,class_='linear'): + + +# 画决策边界 +def plot_decisionBoundary(X, y, model, class_='linear'): plt = plot_data(X, y) - - # Ա߽ - if class_=='linear': + + # 线性边界 + if class_ == 'linear': w = model.coef_ b = model.intercept_ - xp = np.linspace(np.min(X[:,0]),np.max(X[:,0]),100) - yp = -(w[0,0]*xp+b)/w[0,1] - plt.plot(xp,yp,'b-',linewidth=2.0) + xp = np.linspace(np.min(X[:, 0]), np.max(X[:, 0]), 100) + yp = -(w[0, 0] * xp + b) / w[0, 1] + plt.plot(xp, yp, 'b-', linewidth=2.0) plt.show() - else: # Ա߽ - x_1 = np.transpose(np.linspace(np.min(X[:,0]),np.max(X[:,0]),100).reshape(1,-1)) - x_2 = np.transpose(np.linspace(np.min(X[:,1]),np.max(X[:,1]),100).reshape(1,-1)) - X1,X2 = np.meshgrid(x_1,x_2) + else: # 非线性边界 + x_1 = np.transpose(np.linspace(np.min(X[:, 0]), np.max(X[:, 0]), 100).reshape(1, -1)) + x_2 = np.transpose(np.linspace(np.min(X[:, 1]), np.max(X[:, 1]), 100).reshape(1, -1)) + X1, X2 = np.meshgrid(x_1, x_2) vals = np.zeros(X1.shape) for i in range(X1.shape[1]): - this_X = np.hstack((X1[:,i].reshape(-1,1),X2[:,i].reshape(-1,1))) - vals[:,i] = model.predict(this_X) - - plt.contour(X1,X2,vals,[0,1],color='blue') + this_X = np.hstack((X1[:, i].reshape(-1, 1), X2[:, i].reshape(-1, 1))) + vals[:, i] = model.predict(this_X) + + plt.contour(X1, X2, vals, [0, 1], color='blue') plt.show() - if __name__ == "__main__": - SVM() - - - \ No newline at end of file + SVM() \ No newline at end of file From 4f71b0cd8ada920a78a07b20b502b4e3e16d245e Mon Sep 17 00:00:00 2001 From: lawlite <849451478@qq.com> Date: Sat, 29 Sep 2018 10:04:46 +0800 Subject: [PATCH 08/11] fix logisticRegression_scikit-learn.py --- .gitignore | 2 ++ LogisticRegression/LogisticRegression_scikit-learn.py | 2 +- readme.md | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae945fa --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +venv/ diff --git a/LogisticRegression/LogisticRegression_scikit-learn.py b/LogisticRegression/LogisticRegression_scikit-learn.py index 2630453..37905cf 100644 --- a/LogisticRegression/LogisticRegression_scikit-learn.py +++ b/LogisticRegression/LogisticRegression_scikit-learn.py @@ -16,7 +16,7 @@ def logisticRegression(): # 归一化 scaler = StandardScaler() - scaler.fit(x_train) + # scaler.fit(x_train) x_train = scaler.fit_transform(x_train) x_test = scaler.fit_transform(x_test) diff --git a/readme.md b/readme.md index a982f17..5a29ac6 100644 --- a/readme.md +++ b/readme.md @@ -313,7 +313,6 @@ import numpy as np ``` # 归一化 scaler = StandardScaler() - scaler.fit(x_train) x_train = scaler.fit_transform(x_train) x_test = scaler.fit_transform(x_test) ``` From 5aeddce19286640becfcded59faf589453eba89e Mon Sep 17 00:00:00 2001 From: lawlite <849451478@qq.com> Date: Wed, 7 Nov 2018 15:56:47 +0800 Subject: [PATCH 09/11] :memo: fix catalog of readme --- readme.md | 127 +++++++++++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/readme.md b/readme.md index 5a29ac6..421901b 100644 --- a/readme.md +++ b/readme.md @@ -3,73 +3,72 @@ [![MIT license](https://img.shields.io/dub/l/vibe-d.svg)](https://github.com/lawlite19/MachineLearning_Python/blob/master/LICENSE) - ## 目录 * [机器学习算法Python实现](#机器学习算法python实现) - * [一、线性回归](#一-线性回归) - * [1、代价函数](#1-代价函数) - * [2、梯度下降算法](#2-梯度下降算法) - * [3、均值归一化](#3-均值归一化) - * [4、最终运行结果](#4-最终运行结果) - * [5、使用scikit-learn库中的线性模型实现](#5-使用scikit-learn库中的线性模型实现) - * [二、逻辑回归](#二-逻辑回归) - * [1、代价函数](#1-代价函数) - * [2、梯度](#2-梯度) - * [3、正则化](#3-正则化) - * [4、S型函数(即)](#4-s型函数即) - * [5、映射为多项式](#5-映射为多项式) - * [6、使用的优化方法](#6-使用的优化方法) - * [7、运行结果](#7-运行结果) - * [8、使用scikit-learn库中的逻辑回归模型实现](#8-使用scikit-learn库中的逻辑回归模型实现) + * [一、线性回归](#一线性回归) + * [1、代价函数](#1代价函数) + * [2、梯度下降算法](#2梯度下降算法) + * [3、均值归一化](#3均值归一化) + * [4、最终运行结果](#4最终运行结果) + * [5、使用scikit-learn库中的线性模型实现](#5使用scikit-learn库中的线性模型实现) + * [二、逻辑回归](#二逻辑回归) + * [1、代价函数](#1代价函数) + * [2、梯度](#2梯度) + * [3、正则化](#3正则化) + * [4、S型函数(即)](#4s型函数即) + * [5、映射为多项式](#5映射为多项式) + * [6、使用的优化方法](#6使用的优化方法) + * [7、运行结果](#7运行结果) + * [8、使用scikit-learn库中的逻辑回归模型实现](#8使用scikit-learn库中的逻辑回归模型实现) * [逻辑回归_手写数字识别_OneVsAll](#逻辑回归_手写数字识别_onevsall) - * [1、随机显示100个数字](#1-随机显示100个数字) - * [2、OneVsAll](#2-onevsall) - * [3、手写数字识别](#3-手写数字识别) - * [4、预测](#4-预测) - * [5、运行结果](#5-运行结果) - * [6、使用scikit-learn库中的逻辑回归模型实现](#6-使用scikit-learn库中的逻辑回归模型实现) - * [三、BP神经网络](#三-bp神经网络) - * [1、神经网络model](#1-神经网络model) - * [2、代价函数](#2-代价函数) - * [3、正则化](#3-正则化) - * [4、反向传播BP](#4-反向传播bp) - * [5、BP可以求梯度的原因](#5-bp可以求梯度的原因) - * [6、梯度检查](#6-梯度检查) - * [7、权重的随机初始化](#7-权重的随机初始化) - * [8、预测](#8-预测) - * [9、输出结果](#9-输出结果) - * [四、SVM支持向量机](#四-svm支持向量机) - * [1、代价函数](#1-代价函数) - * [2、Large Margin](#2-large-margin) - * [3、SVM Kernel(核函数)](#3-svm-kernel核函数) - * [4、使用中的模型代码](#4-使用中的模型代码) - * [5、运行结果](#5-运行结果) - * [五、K-Means聚类算法](#五-k-means聚类算法) - * [1、聚类过程](#1-聚类过程) - * [2、目标函数](#2-目标函数) - * [3、聚类中心的选择](#3-聚类中心的选择) - * [4、聚类个数K的选择](#4-聚类个数k的选择) - * [5、应用——图片压缩](#5-应用图片压缩) - * [6、使用scikit-learn库中的线性模型实现聚类](#6-使用scikit-learn库中的线性模型实现聚类) - * [7、运行结果](#7-运行结果) - * [六、PCA主成分分析(降维)](#六-pca主成分分析降维) - * [1、用处](#1-用处) - * [2、2D-->1D,nD-->kD](#2-2d-1dnd-kd) - * [3、主成分分析PCA与线性回归的区别](#3-主成分分析pca与线性回归的区别) - * [4、PCA降维过程](#4-pca降维过程) - * [5、数据恢复](#5-数据恢复) - * [6、主成分个数的选择(即要降的维度)](#6-主成分个数的选择即要降的维度) - * [7、使用建议](#7-使用建议) - * [8、运行结果](#8-运行结果) - * [9、使用scikit-learn库中的PCA实现降维](#9-使用scikit-learn库中的pca实现降维) - * [七、异常检测 Anomaly Detection](#七-异常检测-anomaly-detection) - * [1、高斯分布(正态分布)](#1-高斯分布正态分布) - * [2、异常检测算法](#2-异常检测算法) - * [3、评价的好坏,以及的选取](#3-评价的好坏以及的选取) - * [4、选择使用什么样的feature(单元高斯分布)](#4-选择使用什么样的feature单元高斯分布) - * [5、多元高斯分布](#5-多元高斯分布) - * [6、单元和多元高斯分布特点](#6-单元和多元高斯分布特点) - * [7、程序运行结果](#7-程序运行结果) + * [1、随机显示100个数字](#1随机显示100个数字) + * [2、OneVsAll](#2onevsall) + * [3、手写数字识别](#3手写数字识别) + * [4、预测](#4预测) + * [5、运行结果](#5运行结果) + * [6、使用scikit-learn库中的逻辑回归模型实现](#6使用scikit-learn库中的逻辑回归模型实现) + * [三、BP神经网络](#三bp神经网络) + * [1、神经网络model](#1神经网络model) + * [2、代价函数](#2代价函数) + * [3、正则化](#3正则化) + * [4、反向传播BP](#4反向传播bp) + * [5、BP可以求梯度的原因](#5bp可以求梯度的原因) + * [6、梯度检查](#6梯度检查) + * [7、权重的随机初始化](#7权重的随机初始化) + * [8、预测](#8预测) + * [9、输出结果](#9输出结果) + * [四、SVM支持向量机](#四svm支持向量机) + * [1、代价函数](#1代价函数) + * [2、Large Margin](#2large-margin) + * [3、SVM Kernel(核函数)](#3svm-kernel核函数) + * [4、使用中的模型代码](#4使用中的模型代码) + * [5、运行结果](#5运行结果) + * [五、K-Means聚类算法](#五k-means聚类算法) + * [1、聚类过程](#1聚类过程) + * [2、目标函数](#2目标函数) + * [3、聚类中心的选择](#3聚类中心的选择) + * [4、聚类个数K的选择](#4聚类个数k的选择) + * [5、应用——图片压缩](#5应用图片压缩) + * [6、使用scikit-learn库中的线性模型实现聚类](#6使用scikit-learn库中的线性模型实现聚类) + * [7、运行结果](#7运行结果) + * [六、PCA主成分分析(降维)](#六pca主成分分析降维) + * [1、用处](#1用处) + * [2、2D-->1D,nD-->kD](#22d-1dnd-kd) + * [3、主成分分析PCA与线性回归的区别](#3主成分分析pca与线性回归的区别) + * [4、PCA降维过程](#4pca降维过程) + * [5、数据恢复](#5数据恢复) + * [6、主成分个数的选择(即要降的维度)](#6主成分个数的选择即要降的维度) + * [7、使用建议](#7使用建议) + * [8、运行结果](#8运行结果) + * [9、使用scikit-learn库中的PCA实现降维](#9使用scikit-learn库中的pca实现降维) + * [七、异常检测 Anomaly Detection](#七异常检测-anomaly-detection) + * [1、高斯分布(正态分布)](#1高斯分布正态分布) + * [2、异常检测算法](#2异常检测算法) + * [3、评价的好坏,以及的选取](#3评价的好坏以及的选取) + * [4、选择使用什么样的feature(单元高斯分布)](#4选择使用什么样的feature单元高斯分布) + * [5、多元高斯分布](#5多元高斯分布) + * [6、单元和多元高斯分布特点](#6单元和多元高斯分布特点) + * [7、程序运行结果](#7程序运行结果) ## 一、[线性回归](/LinearRegression) - [全部代码](/LinearRegression/LinearRegression.py) From fc954f68d8b2d89ed4463308873ebce0d22ddaa2 Mon Sep 17 00:00:00 2001 From: lawlite <849451478@qq.com> Date: Wed, 7 Nov 2018 16:01:44 +0800 Subject: [PATCH 10/11] :memo: fix catalog of readme --- readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 421901b..9624fc3 100644 --- a/readme.md +++ b/readme.md @@ -17,7 +17,7 @@ * [3、正则化](#3正则化) * [4、S型函数(即)](#4s型函数即) * [5、映射为多项式](#5映射为多项式) - * [6、使用的优化方法](#6使用的优化方法) + * [6、使用的优化方法](#6使用scipy的优化方法) * [7、运行结果](#7运行结果) * [8、使用scikit-learn库中的逻辑回归模型实现](#8使用scikit-learn库中的逻辑回归模型实现) * [逻辑回归_手写数字识别_OneVsAll](#逻辑回归_手写数字识别_onevsall) @@ -41,7 +41,7 @@ * [1、代价函数](#1代价函数) * [2、Large Margin](#2large-margin) * [3、SVM Kernel(核函数)](#3svm-kernel核函数) - * [4、使用中的模型代码](#4使用中的模型代码) + * [4、使用中的模型代码](#4使用scikit-learn中的svm模型代码) * [5、运行结果](#5运行结果) * [五、K-Means聚类算法](#五k-means聚类算法) * [1、聚类过程](#1聚类过程) @@ -53,7 +53,7 @@ * [7、运行结果](#7运行结果) * [六、PCA主成分分析(降维)](#六pca主成分分析降维) * [1、用处](#1用处) - * [2、2D-->1D,nD-->kD](#22d-1dnd-kd) + * [2、2D-->1D,nD-->kD](#22d--1dnd--kd) * [3、主成分分析PCA与线性回归的区别](#3主成分分析pca与线性回归的区别) * [4、PCA降维过程](#4pca降维过程) * [5、数据恢复](#5数据恢复) @@ -62,9 +62,9 @@ * [8、运行结果](#8运行结果) * [9、使用scikit-learn库中的PCA实现降维](#9使用scikit-learn库中的pca实现降维) * [七、异常检测 Anomaly Detection](#七异常检测-anomaly-detection) - * [1、高斯分布(正态分布)](#1高斯分布正态分布) + * [1、高斯分布(正态分布)](#1高斯分布正态分布gaussian-distribution) * [2、异常检测算法](#2异常检测算法) - * [3、评价的好坏,以及的选取](#3评价的好坏以及的选取) + * [3、评价的好坏,以及的选取](#3评价px的好坏以及ε的选取) * [4、选择使用什么样的feature(单元高斯分布)](#4选择使用什么样的feature单元高斯分布) * [5、多元高斯分布](#5多元高斯分布) * [6、单元和多元高斯分布特点](#6单元和多元高斯分布特点) From f8d02fd9fb2bb8268076cc7d30ae86c49988caf7 Mon Sep 17 00:00:00 2001 From: lawlite <849451478@qq.com> Date: Wed, 16 Dec 2020 15:49:22 +0800 Subject: [PATCH 11/11] Create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..4b16f59 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']