Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: Multisession implementation does not support discrete index yet #203

Open
2 tasks done
isib462 opened this issue Dec 16, 2024 · 3 comments
Open
2 tasks done
Assignees
Labels
enhancement New feature or request

Comments

@isib462
Copy link

isib462 commented Dec 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

I wonder if it is possible to use discrete labels in the case of multiple-sessions? When test the multi-session mode using discrete label,there is an error.
And if add the code"discrete_label = [arr.astype(float) for arr in discrete_label]", it can run without error(in continuous label mode,I think). So it seems that it cannot apply to discrete labels in multisession? Looking forward to your reply. thank you!

Operating System

Ubuntu22.04

CEBRA version

cebra 0.4.0 pypi_0 pypi

Device type

gpu

Steps To Reproduce

"timesteps1 = 5000
timesteps2 = 3000
neurons1 = 50
neurons2 = 30
out_dim = 8

neural_session1 = np.random.normal(0,1,(timesteps1, neurons1))
neural_session2 = np.random.normal(0,1,(timesteps2, neurons2))
neural_session=[neural_session1, neural_session2]
discrete_label1 = np.random.randint(0,10,(timesteps1, ))
discrete_label2 = np.random.randint(0,10,(timesteps2, ))
discrete_label=[discrete_label1,discrete_label2]
multi_cebra_model_discrete = cebra.CEBRA(model_architecture='offset10-model',
batch_size=512,
learning_rate=3e-4,
temperature=1,
output_dimension=3,
max_iterations=1000,
distance='cosine',
conditional='time_delta',
device='cuda_if_available',
verbose=True,
time_offsets=10)
multi_cebra_model_discrete.fit(neural_session, discrete_label)"

Relevant log output

Traceback (most recent call last):
  File "/home/user/anaconda3/envs/cebra/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3526, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-48-9a160d5da05e>", line 20, in <module>
    multi_cebra_model_discrete.fit(neural_session, discrete_label)
  File "/home/user/anaconda3/envs/cebra/lib/python3.9/site-packages/cebra/integrations/sklearn/cebra.py", line 1193, in fit
    self.partial_fit(X,
  File "/home/user/anaconda3/envs/cebra/lib/python3.9/site-packages/cebra/integrations/sklearn/cebra.py", line 1098, in partial_fit
    self.state_ = self._prepare_fit(X, *y)
  File "/home/user/anaconda3/envs/cebra/lib/python3.9/site-packages/cebra/integrations/sklearn/cebra.py", line 886, in _prepare_fit
    dataset, is_multisession = self._prepare_data(X, y)
  File "/home/user/anaconda3/envs/cebra/lib/python3.9/site-packages/cebra/integrations/sklearn/cebra.py", line 647, in _prepare_data
    dataset = _get_dataset_multi(X, y)
  File "/home/user/anaconda3/envs/cebra/lib/python3.9/site-packages/cebra/integrations/sklearn/cebra.py", line 638, in _get_dataset_multi
    return cebra.data.DatasetCollection(*[
  File "/home/user/anaconda3/envs/cebra/lib/python3.9/site-packages/cebra/data/datasets.py", line 225, in __init__
    raise NotImplementedError(
NotImplementedError: Multisession implementation does not support discrete index yet.

Anything else?

No response

Code of Conduct

@MMathisLab
Copy link
Member

MMathisLab commented Dec 16, 2024

Hi @isib462 thanks for your feature request; indeed this is not currently supported (we don't show this in the paper), but knowing it's useful to a user is helpful for us to prioritize feature requests (or please feel free to implement and we are happy to review your code).

Updated: it's not in the pypi pip install release, but it was added in May 2024; so you can pip install from the main branch and test it

@MMathisLab MMathisLab added the enhancement New feature or request label Dec 16, 2024
@stes
Copy link
Member

stes commented Dec 16, 2024

Hi @isib462 adding to that, we recently merged a feature for this (#135), could you check out whether the latest CEBRA version in the main branch covers your desired usecase?

@MMathisLab
Copy link
Member

to pip install from the main branch pip install "git+https://github.com/AdaptiveMotorControlLab/CEBRA.git"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants