plot data points distribution.m
来自「在做2維度樣本分類的過程中,若我們能事先畫出訓練樣本在空間中的分散情形,這將有助」· M 代码 · 共 29 行
M
29 行
clear all;
clc;
%%% load data set %%%
% Parameters: X - Training inputs (initial set of features)
% Y - Training targets or call outputs (class labels)
X=[-1.4901 -0.62512
1.861 -0.34566
0.47681 -1.1841
0.32181 -1.5754
-1.6967 -0.43337]
Y=[-1
1
-1
-1
-1]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
inda=find(Y==1);
indb=find(Y==-1);
plot(X(inda,1),X(inda,2),'ko','MarkerSize',6,'MarkerFaceColor','w')
hold on
plot(X(indb,1),X(indb,2),'ks','MarkerSize',6,'MarkerFaceColor','w')
hold on
xlabel('X first feature');
ylabel('X second feature');
legend('Class1','Class2');
title('Data Points Distribution');
grid on
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?