data=readtable("cancer_data.csv");
train=readtable("cancer_training.csv");
test=readtable("cancer_test.csv");
data.Diagnosis=categorical(data.Diagnosis); % Transform diagnosis into categorical variable
data.Diagnosis=renamecats(data.Diagnosis,{'B','M'},{'0','1'}); Recast "B" to "0" and "M" to "1"
data.Diagnosis=str2double(string(data.Diagnosis)); convert string to number
train.Diagnosis=categorical(train.Diagnosis);
train.Diagnosis=renamecats(train.Diagnosis,{'B','M'},{'0','1'});
train.Diagnosis=str2double(string(train.Diagnosis));
test.Diagnosis=categorical(test.Diagnosis);
test.Diagnosis=renamecats(test.Diagnosis,{'B','M'},{'0','1'});
test.Diagnosis=str2double(string(test.Diagnosis));
data_val=[data.Radius data.Diagnosis];
train_val=[train.Radius train.Diagnosis];
test_val=[test.Radius test.Diagnosis];
figure
plot(data_val(:,1),data_val(:,2),'ok','LineWidth',0.5);
hold on
plot(train_val(:,1),train_val(:,2),'ob','LineWidth',1.5);
plot(test_val(:,1),test_val(:,2),'or','LineWidth',1.5);
xlabel('Radius')
ylabel('Diagnosis (0:Begnin, 1:Malignant')
ylabel('Diagnosis (0:Benign, 1:Malignant')
legend('Data','Train','Test')
