Categories &

Functions List

Function Reference: fsulaplacian

statistics: idx = fsulaplacian (X)

statistics: idx = fsulaplacian (X, name, value)

statistics: [idx, scores] = fsulaplacian (…)

Rank features for unsupervised learning by their Laplacian scores.

idx = fsulaplacian (X) ranks the features, the columns of the matrix X, by how well they keep the local structure of the observations, its rows: a feature ranks high when observations close to each other have close values of it. idx is a row vector of column indices, from the most important feature to the least; features of equal score keep their order. X is a real matrix of type double or single, and a row holding a NaN value is left out.

[idx, scores] = fsulaplacian (…) also returns the score of each feature, a row vector in the order of the columns, so that scores(idx) is in decreasing order. A larger score marks a more important feature. A constant feature scores 0.

The observations are the nodes of a similarity graph. Each is joined to its k nearest neighbors, and to every other observation as near as the kth, by distance in X, two observations being joined when either is a neighbor of the other; each is also joined to itself. An edge between observations at distance d has weight S = exp (-(d / sigma)^2), sigma being the kernel scale, so an observation’s edge to itself has weight 1, and observations not joined have similarity 0. With D the diagonal matrix of the row sums of S, each feature x is centered on its mean weighted by D, and its score is x' S x / x' D x. He, Cai and Niyogi define the Laplacian score as 1 minus this score, so the ranking is theirs, from their smallest Laplacian score.

The following Name-Value pairs are supported:

NameValue
'Distance'The distance between observations: 'euclidean', the default, 'seuclidean', 'mahalanobis', 'cityblock', 'minkowski', 'chebychev', 'cosine', 'correlation', 'hamming', 'jaccard' or 'spearman', as computed by pdist2, or a function handle D2 = distfun (ZI, ZJ) returning the distances from the row ZI to each row of ZJ.
'P'The exponent of the 'minkowski' distance, a positive scalar. The default is 2.
'Cov'The covariance matrix of the 'mahalanobis' distance, positive definite. The default is the covariance of the rows of X without NaN values.
'Scale'The scale of each feature for the 'seuclidean' distance, a vector of nonnegative values. The default is the standard deviation of each column of X, its NaN values left out.
'NumNeighbors'The number of nearest neighbors k, a positive integer. The default is ceil (log (n)) for n observations; more than n - 1 joins every observation.
'KernelScale'The kernel scale sigma, a positive scalar, or 'auto' for the median distance between observations, taken over a random thousand of them when there are more. 'auto' takes the 'euclidean' or 'seuclidean' distance only. The default is 1.
'Similarity'A symmetric n-by-n matrix of similarities between the observations, full or sparse, used as given in place of the graph, without the edges of each observation to itself unless it holds them. No other option may be given with it, and X may then hold no NaN value.

The option names are not case sensitive but must be given in full.

MATLAB builds the same graph, though its documentation states neither the edges of each observation to itself nor the rounding of the number of neighbors; both are as measured on R2024a. For 'auto', R2024a documents a heuristic that subsamples and varies from one call to the next, so no value of it is matched.

Reference: X. He, D. Cai and P. Niyogi, "Laplacian Score for Feature Selection", Advances in Neural Information Processing Systems 18, 2005.

See also: fscmrmr, fsrmrmr, relieff, sequentialfs, spectralcluster

Source Code: fsulaplacian