.. currentmodule:: fastcan .. _unsupervised: ============================== Unsupervised feature selection ============================== We can use :class:`FastCan` to do unsupervised feature selection. The basic idea of unsupervised feature selection is to use the learned features, like PCA (principal component analysis), or the hand-crafted features, like Fourier transform, as the targets and to select the features which are most correlated with the targets. In PCA cases, the unsupervised application of :class:`FastCan` tries to select features, which maximize the sum of the squared canonical correlation (SSC) with the principal components (PCs) acquired from PCA of the feature matrix :math:`X` [1]_. See the example below. .. code-block:: python >>> from sklearn.decomposition import PCA >>> from sklearn import datasets >>> from fastcan import FastCan >>> iris = datasets.load_iris() >>> X = iris["data"] >>> pca = PCA(n_components=2) >>> X_pcs = pca.fit_transform(X) >>> selector = FastCan(n_features_to_select=2, verbose=0).fit(X, X_pcs[:, :2]) >>> selector.indices_ array([2, 1], dtype=int32) .. note:: There is no guarantee that this unsupervised :class:`FastCan` will select the optimal subset of the features, which has the highest SSC with PCs. Because :class:`FastCan` selects features in a greedy manner, which may lead to suboptimal results. However, PCA does not take nonlinearity into consideration. To solve the problem, targets (learned features) can be generated by manifold learning [2]_. Then, use :class:`FastCan` to select features, which is the same as the above. .. rubric:: References .. [1] `"Automatic Selection of Optimal Structures for Population-Based Structural Health Monitoring" `_ Wang, T., Worden, K., Wagg, D.J., Cross, E.J., Maguire, A.E., & Lin, W. In: Conference Proceedings of the Society for Experimental Mechanics Series. Springer, Cham. (2023). .. [2] `"Manifold learning-based unsupervised feature selection for structural health monitoring" `_ Wang, T., & Sun, L. Materials Research Proceedings, 50, 82-89, (2025).