AdaptiveMotorControlLab / CEBRA

Learnable latent embeddings for joint behavioral and neural analysis - Official implementation of CEBRA
https://cebra.ai
Other
875 stars 66 forks source link

Add interactive plots using plotly #82

Closed stes closed 10 months ago

stes commented 10 months ago

Adds plotly integration for better interactive plots in notebooks/demos.

Implemented by @nastya236

Usage example (e.g. in a COLAB notebook):

import cebra
import numpy as np
import cebra.integrations.plotly

data = cebra.datasets.init("rat-hippocampus-single-achilles")

X = np.random.uniform(0, 1, (100, 50))
y = np.random.uniform(0, 10, (100, 5))
cebra_model = cebra.CEBRA(max_iterations=3000, batch_size = 512, verbose = True)
cebra_model.fit(data.neural)

embedding = cebra_model.transform(data.neural)
time = np.arange(len(data))

fig = cebra.integrations.plotly.plot_embedding_interactive(embedding, embedding_labels=data.index[:,0])
fig.show()

Expected output

image


Fix https://github.com/AdaptiveMotorControlLab/CEBRA-dev/pull/747 Fix https://github.com/AdaptiveMotorControlLab/CEBRA-dev/pull/733