Inheritance diagram for nipy.neurospin.eda.dimension_reduction:
This modules contains several classes to perform non-linear dimension reduction. Each class has 2 methods, ‘train’ and ‘test’ - ‘train’ performs the computation of low-simensional data embedding and the information to generalize to new data - ‘test’ computes the embedding for new dsamples of data This is done for - Multi-dimensional scaling - Isompap (knn or eps-neighb implementation) - Locality Preseving projections (LPP) - laplacian embedding (train only)
Future developpements will include some supervised cases, e.g. LDA,LDE and the estimation of the latent dimension, at least in simple cases.
Bertrand Thirion, 2006-2009
Bases: nipy.neurospin.eda.dimension_reduction.NLDR
besides the fields of NDLR, it contains the following ones:
Methods
check_data | |
set_train_data | |
test | |
train |
Check that X has the specified fdim
Set the input array X as the training data of the class
Apply the learnt embedding to the new data x
Parameters : | x: array of shape(nbitems, fdim) :
|
---|---|
Returns : | chart: array of shape (nbitems, rdim) : resulting rdim-dimensional represntation : |
training procedure
Parameters : | verbose=0 : verbosity mode |
---|---|
Returns : | chart: resulting rdim-dimensional representation : |
Bases: object
train_data, array the input dataset from which the DR is perfomed fdim=1, int, the input deature dimension rdim=1, int, the reduced feature dimension trained: trained==1 means that the system has been trained
and can generalize
Methods
check_data | |
set_train_data | |
test | |
train |
Check that X has the specified fdim
Set the input array X as the training data of the class
check that X is suitable as test data
set self.trained as 1
Bases: nipy.neurospin.eda.dimension_reduction.NLDR
This class performs PCA-based linear dimension reduction besides the fields of NDLR, it contains the following ones:
Methods
check_data | |
set_train_data | |
test | |
train |
Check that X has the specified fdim
Set the input array X as the training data of the class
Apply the learnt embedding to the new data x
Parameters : | x: array of shape(nbitems, fdim) :
|
---|---|
Returns : | chart: array of shape (nbitems, rdim) : resulting rdim-dimensional represntation : |
training procedure
Parameters : | verbose=0 : verbosity mode |
---|---|
Returns : | chart: resulting rdim-dimensional representation : |
Bases: nipy.neurospin.eda.dimension_reduction.NLDR
besides the fields of NDLR, it contains the following ones:
eps, float eps-ball model used in the knn graph building G : data-representing graph learnt from the training data embedding: array of shape (nbitems,rdim)
this is representation of the training data
Methods
check_data | |
set_train_data | |
test | |
train |
Check that X has the specified fdim
Set the input array X as the training data of the class
Embedding the data conatined in x
Parameters : | x:array of shape(nbitems,fdim) :
verbose=0, bool, verbosity mode : |
---|---|
Returns : | chart: array of shape (nbitems, rdim) :
|
Traing/learning function
Parameters : | eps=1.0, float value of self.eps : p=300, int :
verbose=0 : verbosity mode |
---|---|
Returns : | chart, array of shape (nbLearningSamples, rdim), :
|
Bases: nipy.neurospin.eda.dimension_reduction.NLDR
Besides the fields of NDLR, it contains the following ones:
k : number of neighbors in the knn graph building G : knn graph based on the training data embedding: array of shape (nbitems,rdim)
this is representation of the training data
Methods
check_data | |
set_train_data | |
test | |
train |
Check that X has the specified fdim
Set the input array X as the training data of the class
embed new data into the learnt representation
Parameters : | x array of shape(nbitems,fdim) :
verbose=0, bool, verbosity mode : |
---|---|
Returns : | chart, array of shape (nbitems, rdim) :
|
Training function
Parameters : | k=1, int, k in the knn system : p=300, int, number points used in the low dimensional approximation : verbose=0, bool, verbosity mode : |
---|---|
Returns : | chart, array of shape (nbLearningSamples, rdim) :
|
Bases: nipy.neurospin.eda.dimension_reduction.NLDR
besides the fields of NDLR, it contains the following ones:
k, int number of neighbors in the knn graph building G, graph lerant on the training data embedding: array of shape (nbitems,rdim)
this is representation of the training data
Methods
check_data | |
set_train_data | |
test | |
train |
Check that X has the specified fdim
Set the input array X as the training data of the class
check that X is suitable as test data
learning function
Parameters : | k=1, int k in the knn system : verbose=0, bool, verbosity mode : |
---|---|
Returns : | chart: array of shape (nblearningSamples, rdim) :
|
Bases: nipy.neurospin.eda.dimension_reduction.NLDR
besides the fields of NDLR, it contains the following ones:
k, int, number of neighbors in the knn graph building G, graph learnt based on the training data embedding: array of shape (nbitems,rdim)
this is representation of the training data
Methods
check_data | |
set_train_data | |
test | |
train |
Check that X has the specified fdim
Set the input array X as the training data of the class
Function to generalize the embedding to new data
Parameters : | x: array of shape(nbitems,fdim) :
verbose=0, bool, verbosity mode : |
---|---|
Returns : | chart,array of shape (nbitems,rdim) :
|
Learning function
Parameters : | k=1, int, k in the knn system : verbose=0, bool, verbosity mode : |
---|---|
Returns : | chart, array of shape (nblearningSamples, rdim) :
|
Canonical corelation analysis of two matrices
Parameters : | X array of shape (nbitem,p) : Y array of shape (nbitem,q) : eps=1.e-15, float is a small biasing constant :
|
---|---|
Returns : | ccs, array of shape(min(n,p,q) the canonical correlations : |
Considering the rows of X (and Y=X) as vectors, compute the distance matrix between each pair of vector
Parameters : | X, array of shape (n1,p) : Y=None, array of shape (n2,p) :
|
---|---|
Returns : | ED, array fo shape(n1, n2) : |
returns a dim-dimensional MDS representation of the rows of X using an Euclidian metric
Laplacian Embedding of the data returns the dim-dimensional LE of the graph G
Parameters : | G, nipy.neurospin.graph.WeightedGraph instance that represents the data : dim=1, int, number of dimensions : verbose=0, verbosity level : maxiter=1000, int, maximum number of iterations of the algorithm : |
---|---|
Returns : | chart, array of shape(G.V,dim) : |
Laplacian Embedding of the data returns the dim-dimensional LE of the graph G
Parameters : | G, nipy.neurospin.graph.WeightedGraph instance that represents the data : dim=1, int number of dimensions : verbose=0, verbosity level : maxiter=1000, maximum number of iterations of the algorithm : |
---|---|
Returns : | chart, array of shape(G.V,dim), the resulting embedding : |
Compute the Locality preserving projector of the data
Parameters : | G, nipy.neurospin.graph.WeightedGraph instance that represents the data : X, array of shape (G.V, input_dim) related input dataset : dim=1, int, representation dimensions : verbose=0, bool verbosity level : maxiter=1000, int, maximum number of iterations of the algorithm : |
---|---|
Returns : | proj, array of shape(X.shape[0],dim) : |
A simple check of the Isometry: look whether the output distance match the intput distances for nseeds points
Returns : | a scaling factor between the proposed and the true metrics : |
---|
r = infer_latent_dim(X, verbose=0) Infer the latent dimension of an aray assuming data+gaussian noise mixture
Parameters : | array X, data whose deimsnionhas to be inferred : verbose=0, int, verbosity level : maxr=-1, int, maximum dimension that can be achieved :
|
---|---|
Returns : | r, int, the inferred dimension : |
Isomapping of the data return the dim-dimensional ISOMAP chart that best represents the graph G
Parameters : | G : nipy.neurospin.graph.WeightedGraph instance that represents the data dim=1, int number of dimensions : p=300, int nystrom reduction of the problem : verbose = 0: verbosity level : |
---|---|
Returns : | chart, array of shape(nbitem, dim), :
proj, array of shape (nbitem, dim) :
scaling, array of shape (dim) :
offset, array of shape (nbitem) :
seed, array of shape (p): :
|
graph symmetric normalization; moiover, the normalizing vector is returned NB : this is now in the C graph lib.
Multi-dimensional scaling, i.e. derivation of low dimensional representations from distance matrices.
Parameters : | dm, array of shape(nbitem, nbitem), the input distance matrix : dim=1: the dimension of the desired representation : verbose=0: verbosity level : |
---|---|
Returns : | chart, array of shape(nbitem, dim), :
embedding_direction, array of shape (nbitem, dim) :
scaling, array of shape (dim) :
offset, array of shape (nbitem) :
|
Embedding new data based on a previous mds computation
Parameters : | dm, array of shape(nb_test_item, nb_train_item), :
embedding_direction, array of shape (nb_train_item, dim) :
scaling, array of shape (dim) :
offset, array of shape (nbitem) :
|
---|---|
Returns : | chart, array of shape(nb_test_item, dim), :
|
Compute the embedding parameters to perform the embedding of some data given a distance matrix
Parameters : | dm, array of shape(nbitem, nbitem), the input distance matrix : dim=1: the dimension of the desired representation : verbose=0: verbosity level : |
---|---|
Returns : | embedding_direction, array of shape (nbitem, dim) :
scaling, array of shape (dim) :
offset, array of shape (nbitem) :
|
Create a graph of the knn in the geodesic sense, given an input graph G
Sample nbitem=1000 point from a swiss roll
Returns : | x array of shape (nbitem,3) the 3D embedding : u array of shape (nbitem,2) the intrinsic coordinates : |
---|