API References

Comparing low vs. high dimensions/embeddings.

flameplot.flameplot.compare(mapX, mapY, nn=250, n_steps=5, verbose=3)

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

flameplot.flameplot.import_example(data='digits', url=None, sep=',')

Import example dataset from github source.

Import one of the few datasets from github source or specify your own download url link.

Parameters
  • data (str) – Name of datasets: ‘digits’

  • url (str) – url link to to dataset.

  • verbose (int, optional) – Print progress to screen. The default is 3. 0: None, 1: ERROR, 2: WARN, 3: INFO (default), 4: DEBUG, 5: TRACE

Returns

Dataset containing mixed features.

Return type

pd.DataFrame()

flameplot.flameplot.plot(out, cmap='jet', xlabel=None, ylabel=None, reverse_cmap=False)

Make plot.

Parameters
  • out (dict) – output of the compare() function.

  • cmap (string, optional) – colormap. The default is ‘jet’.

Return type

fig.

flameplot.flameplot.scatter(Xcoord, Ycoord, **args)

Scatterplot.

Parameters
  • Xcoord (numpy array) – 1D Coordinates.

  • Ycoord (numpy array) – 1D Coordinates.

  • **args (TYPE) – See scatterd for all possible arguments.

Return type

fig.

flameplot.flameplot.wget(url, writepath)