Last active
September 28, 2015 06:34
-
-
Save mronian/2903cf1c27e5ef42dbf0 to your computer and use it in GitHub Desktop.
Q6b ML Assignment 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = importdata('breastCancer.csv',','); | |
[n,m] = size(data); | |
epsilon = 1e-1; | |
%x(1:n,1:m-1) = 0; | |
y(1:n,1:1) = 0; | |
a = 0.1; | |
%t(1:n,1:1) = 0; | |
w_old = zeros(m-1,1); | |
t = data(:,1); | |
x = data(:,2:m); | |
for i = 1:n | |
y(i,1) = 1.00/(1+exp(-(x(i,1:m-1)*w_old))); | |
end | |
deltaf = transpose(x)*(y-t); | |
disp(deltaf); | |
j=1; | |
while norm(deltaf)>epsilon && j<20 | |
w_old = w_old-a*deltaf; | |
for i = 1:n | |
y(i,1) = 1.00/(1+exp(-(x(i,1:m-1)*w_old))); | |
end | |
deltaf = transpose(x)*(y-t); | |
j=j+1; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment