![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
机器学习
Ti_an_Di
这个作者很懒,什么都没留下…
展开
-
Angrew Machine Learning ex1
warmUpExercise.m A = eye(5); computeCost.m / computeCostMulti.m distance = X * theta - y; t = sum(distance .^ 2); m = 2 * m; J = t / m; gradientDescent.m / gradientDescentMulti.m delta =...原创 2018-06-29 13:53:33 · 339 阅读 · 0 评论 -
Angrew Machine Learning ex2
sigmoid.m g = 1 ./ (exp(-z) .+ 1); costFunction.m h = sigmoid(X * theta); grad = X' * (h - y) / m; J = (y' * log(h) + (1 .- y') * log(1 .- h)) / m; J = 0 - J; predict.m p = sigmoid(X * theta) ...原创 2018-06-29 14:02:07 · 268 阅读 · 0 评论 -
Angrew Machine Learning ex4
sigmoidGradient.m t = sigmoid(z); g = t .* (1 .- t); randInitializeWeights.m % Randomly initialize the weights to small values epsilon_init = 0.12; W = rand(L_out, 1 + L_in) * 2 * epsilon_init - ...原创 2018-07-17 12:33:54 · 440 阅读 · 0 评论 -
Angrew Machine Learning ex3
lrCostFunction.m h = sigmoid(X * theta); theta(1,:) = 0; %This is the same with the file 'costFunctionReg.m' of ex2 except this line. %For adding the multi-classification,we should take the ...原创 2018-07-04 19:53:49 · 217 阅读 · 0 评论 -
Angrew Machine Learning ex5
linearRegCostFunction h = X * theta; %Linear Regression doesn't need sigmoid while Logistic Regression need it; theta(1,:) = 0; %This is the same with the file 'costFunctionReg.m' of ex2 except thi...原创 2018-07-19 20:07:01 · 632 阅读 · 0 评论 -
Angrew Machine Learning ex6
gaussianKernel sim = exp(-sum((x1 - x2) .^ 2) / (2 * sigma ^ 2)); dataset3Params rel_vec = [0 0 9999]; val_vec = [0.01 0.03 0.1 0.3 1 3 10 30]; for i = 1:length(val_vec) for j = 1:length(val_v...原创 2018-07-26 21:36:09 · 545 阅读 · 0 评论 -
Angrew Machine Learning ex7
findClosestCentroids for i=1:size(X,1) result = 99999; for j=1:K temp = sum((X(i, :) - centroids(j, :)) .^ 2); if temp < result result = temp; idx(i) = j; end end ...原创 2018-08-04 15:02:04 · 603 阅读 · 0 评论 -
Angrew Machine Learning ex8
estimateGaussian mu = mean(X)'; sigma2 = mean((X - mu') .^ 2); selectThreshold predictions = (pval < epsilon); tp = sum(predictions .* yval); rec = tp / sum(yval); prec = tp / sum(predictions)...原创 2018-08-08 13:21:16 · 608 阅读 · 0 评论