ntrain=max(size(train_val)); % number of training data
rmse=0;                      % Initialize RMSE to 0
for i = 1:ntrain             % For each training point
	val = train_val(i,1);           % Radius value for this point
	dist=abs(data_val(:,1)-val);    % Computes distance to all points in DATA
	[t,idx]=sort(dist);             % Sort these distances
	y=data_val(idx,2);              % Order the Diagnosis value in DATA set accordingly
	y_predict(i) = y(1);            % This is a 1-NN: pick the first value
	if train_val(i,2) == y(1)       % check if predicted is correct
		rmse = rmse + 1;
	end
end                             % end loop
rmse = 100*rmse/ntrain;    % Compute percent correct
>> figure
>> plot(train_val(:,2),y_predict,'or','LineWidth',1.5);
>> xlabel('Actual diagnostic')
>> ylabel('Predicted diagnostic')
>> title("RMSE = " + rmse);
