- 博客(7)
- 收藏
- 关注
原创 W7编程作业——Support Vector Machines
ex6.m码住|非作业内容|matlab可以直接训练向量机model = svmTrain(X, y, C, @linearKernel, 1e-3, 20);visualizeBoundaryLinear(X, y, model);gaussianKernel.msim=exp(-sum((x1-x2).^2)/(2*sigma^2));dataset3Params.m //最优参数C = [0.01,0.03,0.1,0.3,1,3,10,30];sigma = [0.01,0.03
2021-10-24 16:48:20
1952
原创 W6编程作业——Machine Learning System Design
Regularized Linear Regression and Bias v.s.VariancelinearRegCostFunction.mJ=(1/(2*m))*sum((X*theta-y).^2)+(lambda/(2*m))*(sum(theta.^2)-theta(1).^2);grad=(1/m)*X'*(X*theta-y)+(lambda/m)*theta;grad(1)=grad(1)-(lambda/m)*theta(1);learningCurve.mfor i
2021-10-24 16:35:00
94
原创 W5编程作业——Neural Network Learning
nnCostFunction.m%Part 1: Feedforward the neural network%实际值从向量转成矩阵h=eye(num_labels);y=h(y,:);%标签个数是10,原来y的形状是5000*1,转化变成5000*10了a1=[ones(m,1) X];z2=a1*(Theta1');a2=[ones(m,1) sigmoid(z2)];z3=a2*(Theta2');a3=sigmoid(z3);h=a3;J=(1/m)*sum(sum(-y.*
2021-10-24 16:23:26
136
原创 W4编程作业——Multi-class Classification&Neural Networks
Multi-class ClassificationlrCostFunction.mn=size(theta,1);z=X*theta;J=-(1/m)*sum(y.*log(sigmoid(z))+(1-y).*log(1-sigmoid(z)))+lambda/(2*m)*(theta(2:n)'*theta(2:n));grad(1)=(1/m)*X(:,1)'*(sigmoid(z)-y);grad(2:n)=(1/m)*X(:,2:n)'*(sigmoid(z)-y)+(lambda/
2021-08-24 15:49:22
105
原创 W3编程作业——Logistic Regression
plotData.mpos=find(y==1);neg=find(y==0);plot(X(pos,1),X(pos,2),'k+','LineWidth',2,'MarkerSize',7);plot(X(neg,1),X(neg,2),'ko','MarkerFaceColor','y','MarkerSize',7);sigmoid.mfunction g = sigmoid(z)========================r=size(z,1); %矩阵行数c=size(
2021-08-21 16:20:07
155
原创 W2编程作业——Linear Regression
必做warmUpExercise.mA = eye(5);plotData.mplot(x,y,'rx');axis([4,24,-5,25]);ylabel('Profit in $10,000s');xlabel('Population of City in 10,000s');computeCost.mJ=(1/(2*m))*sum((X*theta-y).^2);gradientDscent.mtheta=theta-(alpha/m)*(X'*(X*theta-y));
2021-08-15 17:40:05
158
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人