Change the axis limits of a SVM plot
Show older comments
I trained a SVM classifier using "fitcsvm" and I got the graph shown below when the data was plotted. I want to make it more readable by reducing the range of axis. How to do it? The code I used is given below and the used datasets are attached.
close all;
clear all; load ImageDataSet.csv
load ImageDataSetLabels.csv
load PhotoshopPredict.csv%grp_idx = grp2idx(FeatureLabels);
X = ImageDataSet(1:1763,:);
y = ImageDataSetLabels(1:1763,:);
X_new_data = PhotoshopPredict(1:end,:); %dividing the dataset into training and testing
rand_num = randperm(1763); %training Set
X_train = X(rand_num(1:1410),:);
y_train = y(rand_num(1:1410),:); %testing Set
X_test = X(rand_num(1411:end),:);
y_test = y(rand_num(1411:end),:);%preparing validation set out of training set
c = cvpartition(y_train,'k',5);
SVMModel = fitcsvm(X_train,y_train,'Standardize',true,'KernelFunction','RBF',...
'KernelScale','auto','OutlierFraction',0.05); CVSVMModel = crossval(SVMModel);
classLoss = kfoldLoss(CVSVMModel)
classOrder = SVMModel.ClassNamessv = SVMModel.SupportVectors;
figure
gscatter(X_train(:,1),X_train(:,2),y_train)
hold on
plot(sv(:,1),sv(:,2),'ko','MarkerSize',10)
legend('Resampled','Non','Support Vector')
hold offX_test_w_best_feature =X_test(:,:); [c,score] = predict(SVMModel,X_new_data);
saveCompactModel(SVMModel,'SVM1000Images');

Accepted Answer
More Answers (0)
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

