![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
机器学习
文章平均质量分 63
Stephenfzp
程序猿
展开
-
Coursera机器学习 week7 assignment
仅供思路参考,代码最好还是自己独立完成。gaussianKernel.m:sim = exp(- sum((x1-x2).^2) / (2*(sigma^2)) );dataset3Params.m:lambda_all = [0.01 0.03 0.1 0.3 1 3 10 30]';len_all = size(lambda_all, 1);erro原创 2016-08-31 10:25:32 · 1938 阅读 · 0 评论 -
Coursera机器学习 week6 assignment
linearRegCostFunction.m:function [J, grad] = linearRegCostFunction(X, y, theta, lambda)%LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear %regression with multiple variables%原创 2016-08-23 16:56:57 · 2033 阅读 · 0 评论 -
Coursera机器学习 week8 assignment
findClosestCentroids.m:K_temp = zeros(K, 1);for i = 1:size(idx, 1) %遍历所有样本 for j = 1:K %遍历所有K值 K_temp(j) = sum(( X(i,:) - centroids(j,:) ).^2); end mini = min(K_temp); %找出最小值 %id原创 2016-09-02 20:42:59 · 2272 阅读 · 0 评论 -
Coursera机器学习 week2 assignment
warmUpExercise.m:A = eye(5);plotData.m:plot(x,y,'rx','markersize',10);xlabel('Population of City in 10,1000s');ylabel('Profit in $10,1000s');computeCost.m:J = (1/(2*m))*sum((原创 2016-09-02 20:50:41 · 1114 阅读 · 0 评论 -
Coursera机器学习 week3 assignment
plotData.m:pos = find(y==1); neg = find(y==0);plot(X(pos, 1), X(pos, 2), 'k+', 'LineWidth', 2, 'Markersize', 8)plot(X(neg, 1), X(neg, 2), 'ko', 'MarkerFaceColor', 'y', 'Markersize', 8)s原创 2016-09-02 20:58:48 · 1696 阅读 · 2 评论 -
Coursera机器学习 week4 assignment
lrCostFunction.m:b = sigmoid(X*theta);J = -(1/m)*( (log(b'))*y + log(1-b')*(1-y) ) + (lambda/(2*m))*(sum(theta.^2)-theta(1)^2);k = X'*(b-y);grad(1) = (1/m)*k(1);long = length(k);k2 = (1/m)原创 2016-09-02 21:01:38 · 1122 阅读 · 0 评论 -
Coursera机器学习 week9 assignment
代码仅供思路参考————>estimateGaussian.m:mu = ( sum(X, 1) )'./m; %(n*1)temp = bsxfun(@minus, X, mu'); %(m*n)sigma2 = ( sum( (temp.^2), 1) )'./m; %(n*1)selectThreshold.m:predictions =原创 2016-09-04 16:45:10 · 1073 阅读 · 0 评论 -
机器学习算法之Logistic Regression算法实现
该代码基本上参考了zouxy09的专栏中的逻辑回归代码,他对于ML一些经典的算法都写得很不错,读后受益匪浅。直接上代码:#-*- coding:utf8 -*-'''逻辑回归1.0Author:Stephen2016.10.6'''from numpy import *import matplotlib.pyplot as pltimport timedef原创 2016-10-07 23:10:15 · 1862 阅读 · 0 评论 -
Coursera机器学习 week5 神经网络的学习 assignment
sigmoidGradient.m:function g = sigmoidGradient(z)%SIGMOIDGRADIENT returns the gradient of the sigmoid function%evaluated at z% g = SIGMOIDGRADIENT(z) computes the gradient of the sigmoid f原创 2016-08-19 17:49:03 · 2676 阅读 · 0 评论