Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ele888 lab1 run - graphs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % LAB 1, Bayesian Decision Theory %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Attribute Information for IRIS data: % 1. sepal length in cm % 2. sepal width in cm % 3. petal length in cm % 4. petal width in cm % class label/numeric label: % -- Iris Setosa / 1 % -- Iris Versicolour / 2 % -- Iris Virginica / 3 %% this script will run lab1 experiments.. clear load irisdata.mat %% extract unique labels (class names) labels = unique(irisdata_labels); %% generate numeric labels numericLabels = zeros(size(irisdata_features,1),1); for i = 1:size(labels,1) numericLabels(find(strcmp(labels{i},irisdata_labels)),:)= i; end %% feature distribution of x1 for two classes % figure % % subplot(1,2,1), hist(irisdata_features(find(numericLabels(:)==1),2),100), title('Iris Setosa, sepal width (cm)'); % subplot(1,2,2), hist(irisdata_features(find(numericLabels(:)==2),2),100); title('Iris Veriscolour, sepal width (cm)'); % % figure % % subplot(1,2,1), hist(irisdata_features(find(numericLabels(:)==1),1),100), title('Iris Setosa, sepal length (cm)'); % subplot(1,2,2), hist(irisdata_features(find(numericLabels(:)==2),1),100); title('Iris Veriscolour, sepal length (cm)'); % % figure %for feature Sepal Width % % histogram(irisdata_features(find(numericLabels(:)==1),2),100, 'BinWidth', 0.1, 'FaceColor', 'r'); % hold on; % histogram(irisdata_features(find(numericLabels(:)==2),2),100, 'BinWidth', 0.1, 'FaceColor', 'b'); % % line([3.1 3.1], [0 10], 'LineStyle', '-.', 'Color', 'k') %Line to indicate threshold boundary (Q4) % line([3.3 3.3], [0 10], 'LineStyle', '--', 'Color', 'k') %Line to indicate threshold boundary (Q5) % hold off; % axis ([1.8 4.5 0 10]); % % legend ("Iris Setosa","Iris Versicolour"); % xlabel("Sepal Width (cm)"); % ylabel("Number of Training Data") % title("Graph 1: Iris Sepal Width with threshold boundary line"); % figure %for feature Sepal Length % % histogram(irisdata_features(find(numericLabels(:)==1),1),100, 'BinWidth', 0.1, 'FaceColor', 'r'); % hold on; % histogram(irisdata_features(find(numericLabels(:)==2),1),100, 'BinWidth', 0.1, 'FaceColor', 'b'); % % % line([5.5 5.5], [0 16.5], 'LineStyle', '--', 'Color', 'k') %Line to indicate threshold boundary (Q6) % hold off; % axis ([4.3 7.2 0 16.5]); % % legend ("Iris Setosa","Iris Versicolour"); % xlabel("Sepal Length (cm)"); % ylabel("Number of Training Data") % title("Graph 2: Iris Sepal Length with threshold boundary"); % % % figure % % plot(irisdata_features(find(numericLabels(:)==1),1),irisdata_features(find(numericLabels(:)==1),2),'rs'); title('x_1 vs x_2'); % hold on; % plot(irisdata_features(find(numericLabels(:)==2),1),irisdata_features(find(numericLabels(:)==2),2),'k.'); % axis([4 7 1 5]); % legend("Versicolour","Setosa") % ylabel("Number of Training Samples") % xlabel("Sepal Width (cm)") % title("Training Data for Setosa and Versicolour Irises with Feature: Sepal Length") % %% build training data set for two class comparison % merge feature samples with numeric labels for two class comparison (Iris % Setosa vs. Iris Veriscolour trainingSet = [irisdata_features(1:100,:) numericLabels(1:100,1) ]; %% Lab1 experiments (include here) for x = [3.3, 4.4, 5.0, 5.7, 6.3] %x = [2 6; 4.4 3; 5 3.5; 5.3 2; 5.5 2.5; 6.6 3.5; 4.5 6.1] lab1(x,trainingSet) end
run
|
edit
|
history
|
help
0
Bitfield and Union in C - strange results
lab5!
ele709 lab 3.2
150113_CribaErastotenes
CO Assignment 1 Question 1
dynamic memory allocation.c
UserDefinedDataType_pointer1
709 lab 3.1
mapOfIndia
data types and printf