SpectralEmbedding

class ibex.sklearn.manifold.SpectralEmbedding(n_components=2, affinity='nearest_neighbors', gamma=None, random_state=None, eigen_solver=None, n_neighbors=None, n_jobs=1)

Bases: sklearn.manifold.spectral_embedding_.SpectralEmbedding, ibex._base.FrameMixin

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Spectral embedding for non-linear dimensionality reduction.

Forms an affinity matrix given by the specified function and applies spectral decomposition to the corresponding graph laplacian. The resulting transformation is given by the value of the eigenvectors for each data point.

Note : Laplacian Eigenmaps is the actual algorithm implemented here.

Read more in the User Guide.

n_components : integer, default: 2
The dimension of the projected subspace.
affinity : string or callable, default : “nearest_neighbors”
How to construct the affinity matrix.
  • ‘nearest_neighbors’ : construct affinity matrix by knn graph
  • ‘rbf’ : construct affinity matrix by rbf kernel
  • ‘precomputed’ : interpret X as precomputed affinity matrix
  • callable : use passed in function as affinity the function takes in data matrix (n_samples, n_features) and return affinity matrix (n_samples, n_samples).
gamma : float, optional, default : 1/n_features
Kernel coefficient for rbf kernel.
random_state : int, RandomState instance or None, optional, default: None
A pseudo random number generator used for the initialization of the lobpcg eigenvectors. If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random. Used when solver == ‘amg’.
eigen_solver : {None, ‘arpack’, ‘lobpcg’, or ‘amg’}
The eigenvalue decomposition strategy to use. AMG requires pyamg to be installed. It can be faster on very large, sparse problems, but may also lead to instabilities.
n_neighbors : int, default : max(n_samples/10 , 1)
Number of nearest neighbors for nearest_neighbors graph building.
n_jobs : int, optional (default = 1)
The number of parallel jobs to run. If -1, then the number of jobs is set to the number of CPU cores.
embedding_ : array, shape = (n_samples, n_components)
Spectral embedding of the training matrix.
affinity_matrix_ : array, shape = (n_samples, n_samples)
Affinity_matrix constructed from samples or precomputed.
fit(X, y=None)[source]

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Fit the model from data in X.

X : array-like, shape (n_samples, n_features)

Training vector, where n_samples is the number of samples and n_features is the number of features.

If affinity is “precomputed” X : array-like, shape (n_samples, n_samples), Interpret X as precomputed adjacency graph computed from samples.

Y: Ignored.

self : object
Returns the instance itself.
fit_transform(X, y=None)[source]

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Fit the model from data in X and transform X.

X : array-like, shape (n_samples, n_features)

Training vector, where n_samples is the number of samples and n_features is the number of features.

If affinity is “precomputed” X : array-like, shape (n_samples, n_samples), Interpret X as precomputed adjacency graph computed from samples.

Y: Ignored.

X_new : array-like, shape (n_samples, n_components)