%% Script file for Iris data (linear model) load IrisData; %Download this file from the class website % The data: X represents 150 flowers, each has 4 measurements (150 points % in R^4. % % Y represents the class as (1,0,0), (0,1,0), or (0,0,1), so Y % is also 150 x 3. % Step 1: Use Widrow-Hoff to train. Some initial parameters to try: % learning rate of 0.1, iterations to 500. It is this portion you should % change to get W, b % Step 2: Look at the errors in the classification. The following code % assumes that W is 3 x 4 and b is 3 x 1 (and you trained them in the % previous section). You should not have to change the code: Confuse=zeros(3,3); for j=1:150 yout=W*X(j,:)'+b; Class(j,:)=(yout==max(yout)); [val,idx1]=max(Class(j,:)); [val,idx2]=max(Y(j,:)); Confuse(idx2,idx1)=Confuse(idx2,idx1)+1; end Confuse=Confuse/50;