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

Error while running the algorithm #63

Open
TamirEisenstein opened this issue Nov 26, 2024 · 1 comment
Open

Error while running the algorithm #63

TamirEisenstein opened this issue Nov 26, 2024 · 1 comment

Comments

@TamirEisenstein
Copy link

Dear developers,

Thank you for the toolbox!

When trying to run the workshop notebook with its associated SimultaedData.csv file I've been getting the following error during the "Run SuStaIn!" part:

Failed to find pickle file: /Users/ladmin/Downloads/WorkshopOutput/pickle_files/WorkshopOutput_subtype0.pickle. Running SuStaIn model for 0 subtype.
Finding ML solution to 1 cluster problem
Overall ML likelihood is -4738.987014506705
MCMC Iteration: 100%|███████████████████| 10000/10000 [00:02<00:00, 3719.29it/s]
MCMC Iteration: 100%|███████████████████| 10000/10000 [00:02<00:00, 3787.75it/s]
MCMC Iteration: 100%|███████████████████| 10000/10000 [00:02<00:00, 3839.41it/s]
MCMC Iteration: 100%|███████████████████| 10000/10000 [00:02<00:00, 3718.73it/s]

ValueError Traceback (most recent call last)
Cell In[14], line 7
1 samples_sequence,
2 samples_f,
3 ml_subtype,
4 prob_ml_subtype,
5 ml_stage,
6 prob_ml_stage,
----> 7 prob_subtype_stage = sustain_input.run_sustain_algorithm()

File /opt/anaconda3/envs/sustain_env/lib/python3.10/site-packages/pySuStaIn/AbstractSustain.py:186, in AbstractSustain.run_sustain_algorithm(self, plot, plot_format, **kwargs)
178 # max like subtype and stage / subject
179 N_samples = 1000
180 ml_subtype,
181 prob_ml_subtype,
182 ml_stage,
183 prob_ml_stage,
184 prob_subtype,
185 prob_stage,
--> 186 prob_subtype_stage = self.subtype_and_stage_individuals(self.__sustainData, samples_sequence, samples_f, N_samples) #self.subtype_and_stage_individuals(self.__data, samples_sequence, samples_f, N_samples)
187 if not pickle_filepath.exists():
189 if not os.path.exists(self.output_folder):

File /opt/anaconda3/envs/sustain_env/lib/python3.10/site-packages/pySuStaIn/AbstractSustain.py:576, in AbstractSustain.subtype_and_stage_individuals(self, sustainData, samples_sequence, samples_f, N_samples)
573 # if not np.isnan(this_prob_subtype).any()
574 if (np.sum(np.isnan(this_prob_subtype)) == 0):
575 # this_subtype = this_prob_subtype.argmax(
--> 576 this_subtype = np.where(this_prob_subtype == np.max(this_prob_subtype))
578 try:
579 ml_subtype[i] = this_subtype

ValueError: Calling nonzero on 0d arrays is not allowed. Use np.atleast_1d(scalar).nonzero() instead. If the context of this error is of the form arr[nonzero(cond)], just use arr[cond].

Would be grateful for any help!
Tamir

@noxtoby
Copy link
Member

noxtoby commented Dec 2, 2024

Did you try Troubleshooting? Wondering if this might be a numpy version issue (version 1.18 seems to work)

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

No branches or pull requests

2 participants