% % Take Home Exam: Problem 2 % load MenAndWomen2; %This loads the data into matrix Y % % Create the centers- Is there a natural pair of candidates? % Decide on a width for your Gaussians- Is there an obvious one to try? Centers= %Matrix of centers dd= %Radius for the Gaussian below. % % Separate the data into training and testing sets. % - You might be able to re-use the previous script. % % If the first 7 columns are women, the next men, then call each matrix % WomenTrain, MenTrain respectively for the next part. % % Put the remaining columns in WomenTest, MenTest to test your RBF later. % % Train the RBF % Patterns=[WomenTrain, MenTrain]; % Create ``targets'' for classification: Targets=[ones(1,7), zeros(1,7) zeros(1,7), ones(1,7)]; % % Test the RBF % Patterns=[WomenTest, MenTest]; % Create ``targets'' for classification: Targets=[ones(1,6), zeros(1,6) zeros(1,6), ones(1,6)]; Yout= %The output of the RBF using your current parameters. misclass=0; for j=1:12 [v,idx1]=max(Targets(:,j)); [v,idx2]=max(Yout(:,j)); if idx1~=idx2 misclass=misclass+1; end end %Percent misclassified (will print to command window). misclass=misclass/12