Input/Output

Comparison of two embeddings.

Decription

Quantification of local similarity across two maps or embeddings, such as PCA and t-SNE. To compare the embedding of samples in two different maps using a scale dependent similarity measure. For a pair of maps X and Y, we compare the sets of the, respectively, kx and ky nearest neighbours of each sample.

param mapX

Mapping of first embedding.

type mapX

numpy array

param data2

Mapping of second embedding.

type data2

numpy array

param nn

number of neirest neighbor to compare between the two maps. This can be set based on the smalles class size or the aveage class size. The default is 250.

type nn

integer, optional

param n_steps

The number of evaluation steps until reaching nn, optional. If higher, the resolution becomes lower and vice versa. The default is 5.

type n_steps

integer

param verbose

print messages. The default is 3.

type verbose

integer, optional

returns
  • scores : array with the scores across various nearest neighbors (nn).

  • nn : nearest neighbors

  • n_steps : The number of evaluation steps until reaching nn.

rtype

dict()

Examples

>>> # Load data
>>> X, y = flameplot.import_example()
>>>
>>> # Compute embeddings
>>> embed_pca = decomposition.TruncatedSVD(n_components=50).fit_transform(X)
>>> embed_tsne = manifold.TSNE(n_components=2, init='pca').fit_transform(X)
>>>
>>> # Compare PCA vs. tSNE
>>> scores = flameplot.compare(embed_pca, embed_tsne, n_steps=25)
>>>
>>> # plot PCA vs. tSNE
>>> fig = flameplot.plot(scores, xlabel='PCA', ylabel='tSNE')
>>>

References

Plot

Make plot.

param out

output of the compare() function.

type out

dict

param cmap

colormap. The default is ‘jet’.

type cmap

string, optional

rtype

fig.