├── ANN ├── ANNBP2hiddenlayers.m ├── BP.asv ├── BP.m ├── BP2ceng.m ├── RGMYbp.asv ├── RGMYbp.m ├── bpann.m ├── juleiRBF.m ├── rbfann.m ├── readme.md ├── tiduRBF.m ├── zou001.m ├── zou002.asv ├── zou002.m ├── zouwenti.asv ├── zouwenti.m ├── zouwenti2.asv └── zouwenti2.m ├── BOOSTING ├── CUT_lizong.mat ├── CUT_xi.mat ├── C_cart.m ├── adaboost.m ├── adaboost_model.m ├── adaboost_mul.m ├── adaboost_pre.m ├── boostree_model.m ├── boostree_pre.m ├── cart.m ├── clarke.m ├── readme.md ├── test.m └── test1.m ├── Bayes ├── Nav_bayes01.m ├── Nav_bayes_model.m ├── Nav_bayes_pre.m ├── readme.md └── test.m ├── GDescent └── tiduxj.m ├── Ganzhiji ├── perceptron.m ├── readme.md └── test.m ├── KNN └── zlw_KNN.m ├── LogisticR ├── LR01.m ├── LR_model.m ├── LR_pre.m ├── readme.md └── test.m ├── MLR ├── readme.md ├── zbhg.m ├── zlw_MLR.m ├── zlw_MLR0.m ├── zlw_MLR02.m └── zou004.m ├── OSC ├── OSC_PLS.m ├── osc1_mod.m ├── osc2_mod.m ├── osc_pr.m ├── osccalc.m ├── readme.md └── test2.m ├── PCR ├── readme.md ├── zbhg.m ├── zlw_PCR.m ├── zlw_PCR02.m └── zlw_PCR03.m ├── PLS ├── ipls.m ├── p_pls.m ├── pls.m ├── pls0.m ├── pls_mod.m ├── pls_pr.m ├── plskernel_1.m ├── plstoolbox.m ├── readme.md ├── spapls.m ├── test_ZLW.m ├── test_ZLW0.m ├── vippls.m ├── zbhg.m ├── zlw_PLS.m ├── zlw_PLS02.m └── zlw_PLS03.m ├── PSO ├── PSO_K.m ├── fitness.m ├── obf_PSO.m ├── pso.m └── readme.md ├── README.md └── data ├── 本科毕业设计数据.xlsx └── 血糖检测数据_20150930.xlsx /ANN/ANNBP2hiddenlayers.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/ANNBP2hiddenlayers.m -------------------------------------------------------------------------------- /ANN/BP.asv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/BP.asv -------------------------------------------------------------------------------- /ANN/BP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/BP.m -------------------------------------------------------------------------------- /ANN/BP2ceng.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/BP2ceng.m -------------------------------------------------------------------------------- /ANN/RGMYbp.asv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/RGMYbp.asv -------------------------------------------------------------------------------- /ANN/RGMYbp.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/RGMYbp.m -------------------------------------------------------------------------------- /ANN/bpann.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/bpann.m -------------------------------------------------------------------------------- /ANN/juleiRBF.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/juleiRBF.m -------------------------------------------------------------------------------- /ANN/rbfann.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/rbfann.m -------------------------------------------------------------------------------- /ANN/readme.md: -------------------------------------------------------------------------------- 1 | # 人工神经网络(A N N) 2 | 3 | BP(Back Propagation):误差反向传播的多层前馈网络。 4 | 5 | RBF:径向基函数网络,单隐层的三层前向网络。 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ANN/tiduRBF.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/tiduRBF.m -------------------------------------------------------------------------------- /ANN/zou001.m: -------------------------------------------------------------------------------- 1 | 2 | clc;clear;close; 3 | P = [0 1 2 3 4 5 6 7 8 9 11]; 4 | T = [0 1 2 3 4 3 2 1 2 3 4]; 5 | net = newff([0 11],[5 3 1],{'tansig' 'tansig' 'purelin'}); 6 | 7 | 8 | Y = sim(net,P); 9 | plot(P,T,P,Y,'o') 10 | % 11 | % Here the network is trained for 50 epochs. Again the network's 12 | % output is plotted. 13 | % 14 | net.trainParam.epochs = 50; 15 | net = train(net,P,T); 16 | Y = sim(net,P); 17 | plot(P,T,P,Y,'o') -------------------------------------------------------------------------------- /ANN/zou002.asv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/zou002.asv -------------------------------------------------------------------------------- /ANN/zou002.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/zou002.m -------------------------------------------------------------------------------- /ANN/zouwenti.asv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/zouwenti.asv -------------------------------------------------------------------------------- /ANN/zouwenti.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/zouwenti.m -------------------------------------------------------------------------------- /ANN/zouwenti2.asv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/zouwenti2.asv -------------------------------------------------------------------------------- /ANN/zouwenti2.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/ANN/zouwenti2.m -------------------------------------------------------------------------------- /BOOSTING/CUT_lizong.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/CUT_lizong.mat -------------------------------------------------------------------------------- /BOOSTING/CUT_xi.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/CUT_xi.mat -------------------------------------------------------------------------------- /BOOSTING/C_cart.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/C_cart.m -------------------------------------------------------------------------------- /BOOSTING/adaboost.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/adaboost.m -------------------------------------------------------------------------------- /BOOSTING/adaboost_model.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/adaboost_model.m -------------------------------------------------------------------------------- /BOOSTING/adaboost_mul.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/adaboost_mul.m -------------------------------------------------------------------------------- /BOOSTING/adaboost_pre.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/adaboost_pre.m -------------------------------------------------------------------------------- /BOOSTING/boostree_model.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/boostree_model.m -------------------------------------------------------------------------------- /BOOSTING/boostree_pre.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/boostree_pre.m -------------------------------------------------------------------------------- /BOOSTING/cart.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/cart.m -------------------------------------------------------------------------------- /BOOSTING/clarke.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/clarke.m -------------------------------------------------------------------------------- /BOOSTING/readme.md: -------------------------------------------------------------------------------- 1 | # 自适应提升算法(adaboost) 2 | 目前集成学习有bagging、boosting算法,随机森林(RandomForest)是一种bagging的方法; Adaboost、GBDT、XGBoost 都是一种boosting方法。 3 | 4 | # 原理概述 5 | ref:https://my.oschina.net/u/3851199/blog/1941725 6 | 7 | 参考:李航的《统计学习方法》 AdaBoost通过加大分类误差率小的弱分类器的权重, 8 | 使其在表决中起的作用较大,减小分类误差率大的弱分类器的权重,使其在表决中起较小的作用。 9 | -------------------------------------------------------------------------------- /BOOSTING/test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/test.m -------------------------------------------------------------------------------- /BOOSTING/test1.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/BOOSTING/test1.m -------------------------------------------------------------------------------- /Bayes/Nav_bayes01.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/Bayes/Nav_bayes01.m -------------------------------------------------------------------------------- /Bayes/Nav_bayes_model.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/Bayes/Nav_bayes_model.m -------------------------------------------------------------------------------- /Bayes/Nav_bayes_pre.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/Bayes/Nav_bayes_pre.m -------------------------------------------------------------------------------- /Bayes/readme.md: -------------------------------------------------------------------------------- 1 | # 朴素贝叶斯(Naive Bayes) 2 | 优点: 3 | 算法逻辑简单,易于实现(算法思路很简单,只要使用贝叶斯公式转化即可!) 4 | 分类过程中时空开销小(假设特征相互独立,只会涉及到二维存储) 5 | 缺点: 6 | 朴素贝叶斯假设属性之间相互独立,这种假设在实际过程中往往是不成立的。在属性之间相关性越大,分类误差也就越大。 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Bayes/test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/Bayes/test.m -------------------------------------------------------------------------------- /GDescent/tiduxj.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/GDescent/tiduxj.m -------------------------------------------------------------------------------- /Ganzhiji/perceptron.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/Ganzhiji/perceptron.m -------------------------------------------------------------------------------- /Ganzhiji/readme.md: -------------------------------------------------------------------------------- 1 | # 感知机(perception) 2 | 为二分类模型(正负):线性分类模型 3 | 4 | 线性可分时,能收敛;线性不可分时,震荡。 5 | >决策函数:sign(W*X+b);>0为1类,<0为-1类 6 | 7 | # 目标函数 8 | > 最优化问题:minL(w,b)=-累加yi(W*Xi+b) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Ganzhiji/test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/Ganzhiji/test.m -------------------------------------------------------------------------------- /KNN/zlw_KNN.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/KNN/zlw_KNN.m -------------------------------------------------------------------------------- /LogisticR/LR01.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/LogisticR/LR01.m -------------------------------------------------------------------------------- /LogisticR/LR_model.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/LogisticR/LR_model.m -------------------------------------------------------------------------------- /LogisticR/LR_pre.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/LogisticR/LR_pre.m -------------------------------------------------------------------------------- /LogisticR/readme.md: -------------------------------------------------------------------------------- 1 | # 逻辑斯蒂回归(LR) 2 | 为二分类模型(0~1): 实际上是一个sigmoid函数 3 | >y_pre=1/1+e^(b0+b1*x1+b2*x2+……+bp*xp) 4 | 5 | # 目标函数(由极大释然估计得出) 6 | > 最小化 J =(1/sample_num).*sum(-y.*log(y_pre) - (1-y).*log(1-y_pre)) 7 | 8 | 9 | ref:https://blog.csdn.net/zjuPeco/article/details/77165974 10 | -------------------------------------------------------------------------------- /LogisticR/test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/LogisticR/test.m -------------------------------------------------------------------------------- /MLR/readme.md: -------------------------------------------------------------------------------- 1 | # 多元线性回归(MLR) 2 | 多元回归模型: 3 | >y_real=b0+b1*x1+b2*x2+……+bp*xp+e 4 | 5 | 多元回归估计模型: 6 | >y_pre=b0+b1*x1+b2*x2+……+bp*xp 7 | 8 | 采用的是最小二乘估计 9 | >e_i = y_real_i - y_pre_i 10 | > 11 | >op_min(sum((e_i)^2)) 12 | > 13 | >B = (X'*X)\ *X'*Y 14 | 15 | # 逐步回归 16 | 1. 自变量逐个加入建立MLR模型 17 | 2. F检验值判断新增变量是否提高模型效果 18 | 3. 同时逐个剔除贡献小的变量 19 | 4. 最终选定k个变量使得模型最优 20 | 21 | 22 | # F检验、t检验 23 | - F显著性检验模型整体的有效性 24 | 25 | - t检验各个自变量对模型的贡献程度 26 | 27 | -------------------------------------------------------------------------------- /MLR/zbhg.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/MLR/zbhg.m -------------------------------------------------------------------------------- /MLR/zlw_MLR.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/MLR/zlw_MLR.m -------------------------------------------------------------------------------- /MLR/zlw_MLR0.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/MLR/zlw_MLR0.m -------------------------------------------------------------------------------- /MLR/zlw_MLR02.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/MLR/zlw_MLR02.m -------------------------------------------------------------------------------- /MLR/zou004.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/MLR/zou004.m -------------------------------------------------------------------------------- /OSC/OSC_PLS.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/OSC/OSC_PLS.m -------------------------------------------------------------------------------- /OSC/osc1_mod.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/OSC/osc1_mod.m -------------------------------------------------------------------------------- /OSC/osc2_mod.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/OSC/osc2_mod.m -------------------------------------------------------------------------------- /OSC/osc_pr.m: -------------------------------------------------------------------------------- 1 | function [ X ] = osc_pr( x,pr,wr ) 2 | %P_OSC_PR Summary of this function goes here 3 | % Detailed explanation goes here 4 | m=size(pr,2); 5 | for i=1:m 6 | t(:,i)=x*wr(:,i); 7 | x=x-t(:,i)*pr(:,i)'; 8 | end 9 | X=x; 10 | end 11 | 12 | -------------------------------------------------------------------------------- /OSC/osccalc.m: -------------------------------------------------------------------------------- 1 | function [x,nw,np,nt] = osccalc(x,y,nocomp,iter,tol) 2 | %OSCCALC Calculates orthogonal signal correction 3 | % The inputs are the matrix of predictor variables (x) 4 | % and predicted variable(s) (y), scaled as desired, and 5 | % the number of OSC components to calculate (nocomp). 6 | % Optional input variables are the maximum number of 7 | % iterations used in attempting to maximize the variance 8 | % captured by orthogonal component (iter, default = 0), 9 | % and the tolerance on percent of x variance to consider 10 | % in formation of the final w vector (tol, default = 99.9). 11 | % The outputs are the OSC corrected x matrix (nx) and 12 | % the weights (nw), loads (np) and scores(nt) that were 13 | % used in making the correction. Once the calibration is 14 | % done, new (scaled) x data can be corrected by 15 | % newx = x - x*nw*inv(np'*nw)*np'; 16 | % 17 | %I/O: [nx,nw,np,nt] = osccalc(x,y,nocomp,iter,tol); 18 | % 19 | %See also: CROSSVAL 20 | 21 | %Copyright Eigenvector Research, Inc. 1998 22 | %Barry M. Wise, January 23, 1998 23 | 24 | [m,n] = size(x); 25 | nw = zeros(n,nocomp); 26 | np = zeros(n,nocomp); 27 | nt = zeros(m,nocomp); 28 | if nargin < 4 | isempty(iter) 29 | iter = 0; 30 | end 31 | if nargin < 5 | isempty(tol) 32 | tol = 99.9; 33 | end 34 | for i = 1:nocomp 35 | % Calculate the first score vector 36 | [u,s,v] = svds(x,1); 37 | p = v(:,1); 38 | p = p*sign(sum(p)); 39 | told = u(:,1)*s(1); 40 | dif = 1; 41 | k = 0; 42 | while dif > 1e-12 43 | k = k+1; 44 | % Calculate scores from loads 45 | t = x*p/(p'*p); 46 | % Othogonalize t to y 47 | tnew = t - y*inv(y'*y)*y'*t; 48 | % Compute a new loading 49 | pnew = x'*tnew/(tnew'*tnew); 50 | % Check for convergence 51 | dif = norm(tnew-told)/norm(tnew); 52 | % Assign pnew to p 53 | told = tnew; 54 | p = pnew; 55 | if k > iter 56 | dif = 0; 57 | end 58 | end 59 | % Build PLS model relating x to t 60 | nc = rank(x); 61 | [w,ssq] = pls(x,tnew,nc,0); 62 | % Include components as specified by tol on x variance 63 | z = size(find(ssq(:,3) 对数据矩阵进行奇异值分解,获取方差最大的特征值和特征向量。由特征向量和原数据矩阵得到主成分,起到降维作用和消除冗余项。 6 | 7 | # 多项式-主成分回归(p-pcr) 8 | 对PCA主成分进行多项式扩展,再进行线性回归 9 | 10 | # 标准化 11 | PCA之前需要对数据进行标准化,获取主成分需要反标准化。 12 | 13 | -------------------------------------------------------------------------------- /PCR/zbhg.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PCR/zbhg.m -------------------------------------------------------------------------------- /PCR/zlw_PCR.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PCR/zlw_PCR.m -------------------------------------------------------------------------------- /PCR/zlw_PCR02.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PCR/zlw_PCR02.m -------------------------------------------------------------------------------- /PCR/zlw_PCR03.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PCR/zlw_PCR03.m -------------------------------------------------------------------------------- /PLS/ipls.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/ipls.m -------------------------------------------------------------------------------- /PLS/p_pls.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/p_pls.m -------------------------------------------------------------------------------- /PLS/pls.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/pls.m -------------------------------------------------------------------------------- /PLS/pls0.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/pls0.m -------------------------------------------------------------------------------- /PLS/pls_mod.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/pls_mod.m -------------------------------------------------------------------------------- /PLS/pls_pr.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/pls_pr.m -------------------------------------------------------------------------------- /PLS/plskernel_1.m: -------------------------------------------------------------------------------- 1 | function [B b]=plskernel_1(X,Y,A) 2 | [N K]=size(X); 3 | [Nn M]=size(Y); 4 | meanX=mean(X); 5 | meanY=mean(Y); 6 | stdX=std(X); 7 | stdY=std(Y); 8 | 9 | X=zscore(X); 10 | Y=zscore(Y); 11 | 12 | XY=X'*Y; 13 | XX=X'*X; 14 | W=[]; 15 | P=[]; 16 | Q=[]; 17 | R=[]; 18 | for i=1:A 19 | if M==1 20 | w=XY; 21 | else 22 | [C,D]=eig(XY'*XY); 23 | q=C(:,find(diag(D)==max(diag(D)))); 24 | w=(XY*q); 25 | end 26 | w=w/sqrt(w'*w); 27 | r=w; 28 | for j=1:i-1 29 | r=r-(P(:,j)'*w)*R(:,j); 30 | end 31 | tt=(r'*XX*r)+1e-100; 32 | p=(r'*XX)'/tt; 33 | q=(r'*XY)'/tt; 34 | XY=XY-(p*q')*tt; 35 | W=[W w]; 36 | P=[P p]; 37 | Q=[Q q]; 38 | R=[R r]; 39 | end 40 | beta=R*Q'; 41 | B=stdY*beta./(stdX'+1e-20*ones(1,size(X,2))'); 42 | b=meanY-meanX*B; -------------------------------------------------------------------------------- /PLS/plstoolbox.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/plstoolbox.m -------------------------------------------------------------------------------- /PLS/readme.md: -------------------------------------------------------------------------------- 1 | # 偏最小二乘(PLS) 2 | 原理参考书籍:《偏最小二乘回归的线性与非线性方法(书.王惠文)》 3 | 4 | # 多项式-偏最小二乘(p-pls) 5 | 对pls主元进行多项式扩展 6 | 7 | # 连续保持投影(SPA) 8 | 用于筛选自变量 9 | 10 | 参考文献:《基于连续投影算法的土壤总氮近红外特征波长的选取》 11 | 12 | # F检验、t检验 13 | - F显著性检验模型整体的有效性 14 | 15 | - t检验各个自变量对模型的贡献程度 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /PLS/spapls.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/spapls.m -------------------------------------------------------------------------------- /PLS/test_ZLW.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/test_ZLW.m -------------------------------------------------------------------------------- /PLS/test_ZLW0.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/test_ZLW0.m -------------------------------------------------------------------------------- /PLS/vippls.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/vippls.m -------------------------------------------------------------------------------- /PLS/zbhg.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/zbhg.m -------------------------------------------------------------------------------- /PLS/zlw_PLS.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/zlw_PLS.m -------------------------------------------------------------------------------- /PLS/zlw_PLS02.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/zlw_PLS02.m -------------------------------------------------------------------------------- /PLS/zlw_PLS03.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PLS/zlw_PLS03.m -------------------------------------------------------------------------------- /PSO/PSO_K.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PSO/PSO_K.m -------------------------------------------------------------------------------- /PSO/fitness.m: -------------------------------------------------------------------------------- 1 | function result=fitness(x,D) 2 | sum=0; 3 | for i=1:D 4 | sum=sum+x(i)^2; 5 | end 6 | result=sum; -------------------------------------------------------------------------------- /PSO/obf_PSO.m: -------------------------------------------------------------------------------- 1 | function f=obf_PSO(x) 2 | global X nn K_gram; 3 | rbf_var=x; 4 | K=zeros(nn,nn); 5 | for i=1:nn 6 | for j=i:nn 7 | K(i,j) = exp(-norm(X(i,:)-X(j,:))^2/rbf_var); 8 | K(j,i) = K(i,j); 9 | end 10 | end 11 | f=-corr2(K_gram,K); -------------------------------------------------------------------------------- /PSO/pso.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/PSO/pso.m -------------------------------------------------------------------------------- /PSO/readme.md: -------------------------------------------------------------------------------- 1 | # 粒子群优化(PSO) 2 | 一种参数优化算法:通过模拟鸟群觅食过程中的迁徙和群聚行为而提出的一种基于群体智能的全局随机搜索算法 3 | 4 | # 步骤: 5 | Step1:初始化粒子群,包括群体规模clip_image004[1],每个粒子的位置clip_image048和速度clip_image050 6 | 7 | Step2:计算每个粒子的适应度值clip_image052; 8 | 9 | Step3: 对每个粒子,用它的适应度值clip_image052[1]和个体极值clip_image054比较,如果clip_image056 ,则用clip_image058替换掉clip_image054[1]; 10 | 11 | Step4: 对每个粒子,用它的适应度值clip_image058[1]和全局极值clip_image061比较,如果clip_image056[1]则用clip_image052[2]替clip_image061[1]; 12 | 13 | Step5: 根据公式(2-1),(2-2)更新粒子的速度clip_image050[1]和位置clip_image048[1] ; 14 | 15 | Step6: 如果满足结束条件(误差足够好或到达最大循环次数)退出,否则返回Step2。 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## matlab_algorithms 2 | 3 | 之前做过的一些项目和学习积累,基于matlab程序的各种回归、分类算法实现 4 | 5 | --- 6 | - MLR - 多元线性回归 7 | 8 | - PCA - 主成分分析 9 | 10 | - PLS - 偏最小二乘 11 | 12 | - LogisticR - 逻辑斯蒂回归 13 | 14 | - Ganzhiji - 感知机(perception) 15 | 16 | - PSO - 粒子群优化 17 | 18 | - KNN - K_近邻 19 | 20 | - Bayes - 贝叶斯 21 | 22 | - OSC - 正交信号校正 23 | 24 | - GDescent - 梯度下降 25 | 26 | - ANN - 人工神经网络 27 | 28 | - BOOSTING - 提升算法 29 | -------------------------------------------------------------------------------- /data/本科毕业设计数据.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/data/本科毕业设计数据.xlsx -------------------------------------------------------------------------------- /data/血糖检测数据_20150930.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoulala/matlab_algorithms/953951f1cd84ec2fdc1e67eeb733eac15245c2ca/data/血糖检测数据_20150930.xlsx --------------------------------------------------------------------------------