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

parameters.getRandom() fails if parameters are not 1d #169

Open
caglorithm opened this issue Jun 28, 2021 · 0 comments
Open

parameters.getRandom() fails if parameters are not 1d #169

caglorithm opened this issue Jun 28, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@caglorithm
Copy link
Member

from neurolib.utils.parameterSpace import ParameterSpace
shape = 4
pars = [np.random.rand(shape, shape) for i in range(10)]
parameters = ParameterSpace({"p": pars})
parameters.getRandom()

Returns

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-32-1b6c4906dd1f> in <module>
----> 1 parameters.getRandom()

~/Documents/PhD/projects/neurolib/neurolib/utils/parameterSpace.py in getRandom(self, safe)
     97         else:
     98             for key, value in self.parameters.items():
---> 99                 randomPar[key] = np.random.choice(value)
    100         return randomPar
    101 

mtrand.pyx in numpy.random.mtrand.RandomState.choice()

ValueError: a must be 1-dimensional

Needs fix.

@caglorithm caglorithm added the bug Something isn't working label Jun 28, 2021
@caglorithm caglorithm self-assigned this Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant