clear;

[Xl, Yl, Xu, Yu] = loadData(3);
% plotData(Xl, Yl, Xu, Yu);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Kernel/distance:
% 1. linear:
K = kernel([Xl; Xu], [Xl; Xu], 'lin');

% 2. graph-based:
% D = pdist2([Xl; Xu], [Xl; Xu], 'euclidean').^2;
% D = graphConstruct(D, 'k', 7);
% D = Floyd_Warshall(D);
% D = makeConnected(D);
% K = dist2Kernel(D);

% Classifier:
Ypred = kCentroid(K, Yl);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

plotData(Xl, Yl, Xu, Ypred);

err = size(find(Yu ~= Ypred), 1)/size([Xl; Xu], 1)
