watex.analysis.LLE#

watex.analysis.LLE(X, n_components=None, *, return_X=True, n_neighbors=5, **lle_kws)[source]#

Locally Linear Embedding(LLE)

LLE is nonlinear dimensinality reduction based on closest neighbors (c.n).

LLE is another powerfull non linear dimensionality reduction(NLDR) technique. It is Manifold Learning technique that does not rely on projections like PCA. In a nutshell, works by first measurement how each training instance library lineraly relates to its closest neighbors(c.n.), and then looking for a low-dimensional representation of the training set where these local relationships are best preserved (more details shortly).Using LLE yields good resuls especially when makes it particularly good at unrolling twisted manifolds, especially when there is too much noise.

Parameters:
  • X (Ndarray ( M x N matrix where M=m-samples, & N=n-features)) – Training set; Denotes data that is observed at training and prediction time, used as independent variables in learning. When a matrix, each sample may be represented by a feature vector, or a vector of precomputed (dis)similarity with each training sample. X may also not be a matrix, and may require a feature extractor or a pairwise metric to turn it into one before learning a model.

  • n_components (int, optional) – Number of dimension to preserve. If`n_components` is ranged between float 0. to 1., it indicated the number of variance ratio to preserve. If None as default value the number of variance to preserve is 95%.

  • n_neighbors (int, default=5) – Number of neighbors to consider for each point.

  • return_X (bool, default =True ,) – return the train set transformed with most representative varaince ratio.

  • lle_kws (dict,) – Additional keyword arguments passed to sklearn.decomposition.LocallyLinearEmbedding.

Returns:

The transformed training set or the LLE container attributes for plotting purposes.

Return type:

X (NDArray) or LLE object,

References

Gokhan H. Bakir, Jason Wetson and Bernhard Scholkoft, 2004; “Learning to Find Pre-images”;Tubingen, Germany:Max Planck Institute for Biological Cybernetics.

S. Roweis, L.Saul, 2000, Nonlinear Dimensionality Reduction by Loccally Linear Embedding.

Notes

Scikit-Learn used the algorithm based on Kernel Ridge Regression

Example

>>> from watex.analysis.dimensionality import LLE
>>> from watex.datasets import fetch_data
>>> X, _=fetch_data('Bagoue analysed data')
>>> lle_kws ={
...    'n_components': 4,
...    "n_neighbors": 5}
>>> Xtransf=LLE(X,**lle_kws)