fprintf('Loading "abalone.dat"...\n'); load abalone.dat % Load the data set data = abalone; data = data(1:100, :); % Use only the first 100 data feature_n = size(data, 2)-1; % no. of features instance_n = size(data, 1); % no. of instances feature = data(:, 1:feature_n); % feature matrix output = data(:, feature_n+1); % output matrix [a, b] = countele(output); class_n = length(a); % No. of classes fprintf('%g features\n', feature_n); fprintf('%g instances\n', instance_n); fprintf('%g classes\n', class_n); % Plot age distribution %bar(a, b); %xlabel('Age'); %ylabel('Counts'); %title('Age Distribution for the Abalone Data Set'); fprintf('Class 1: %g instances are younger than 10 years\n',... length(find(output<10))); fprintf('Class 2: %g instances are equal to or older than 10 years\n',... length(find(output>=10))); % Modify the data set such that instances younger than 10 years fall % into class 1; all the others into class 2 index1 = find(output<10); output(index1) = 1*ones(size(index1)); index2 = find(output>=10); output(index2) = 2*ones(size(index2)); input_name = str2mat('X1', 'X2', 'X3', 'X4', 'X5', 'X6', 'X7', 'X8');