Hello kash,
To perform feature selection using PCA, you can follow the MATLAB code below:
% Center the data
meanFeatures = mean(Features);
centeredFeatures = allFeatures - meanFeatures;
% Perform PCA
[coeff, score, ~, ~, explained] = pca(centeredFeatures);
% Select the number of principal components to retain (e.g., 95% variance)
cumulativeVariance = cumsum(explained);
numComponents = find(cumulativeVariance >= 95, 1);
% Reduce dimensionality
reducedFeatures = score(:, 1:numComponents);
You can further use Euclidean distance to compare the query features with the stored features, and identify the closest matches