Skip to content

Error while running MixtureSustain #68

Description

@SebastianVol

Hi,

I am currently using the Mixture Sustain and I get the following error:

``
pySuStaIn/AbstractSustain.py:556: RuntimeWarning: invalid value encountered in divide
total_prob_subtype_norm = total_prob_subtype / np.tile(np.sum(total_prob_subtype, 1).reshape(len(total_prob_subtype), 1), (1, N_S))
pySuStaIn/AbstractSustain.py:557: RuntimeWarning: invalid value encountered in divide
total_prob_stage_norm = total_prob_stage / np.tile(np.sum(total_prob_stage, 1).reshape(len(total_prob_stage), 1), (1, nStages + 1)) #removed total_prob_subtype
pySuStaIn/AbstractSustain.py:560: RuntimeWarning: invalid value encountered in divide
total_prob_subtype_stage_norm = total_prob_subtype_stage / np.tile(np.sum(np.sum(total_prob_subtype_stage, 1, keepdims=True), 2).reshape(nSamples, 1, 1),(1, nStages + 1, N_S))


ValueError Traceback (most recent call last)
Cell In[19], line 8
1 #************* run SuStaIn to infer subtype sequences and subjects' subtypes/stages estimates
2 samples_sequence,
3 samples_f,
4 ml_subtype,
5 prob_ml_subtype,
6 ml_stage,
7 prob_ml_stage,
----> 8 prob_subtype_stage = sustain.run_sustain_algorithm(plot=True)

File ~/.conda/envs/sustain_env/lib/python3.8/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 ~/.conda/envs/sustain_env/lib/python3.8/site-packages/pySuStaIn/AbstractSustain.py:590, in AbstractSustain.subtype_and_stage_individuals(self, sustainData, samples_sequence, samples_f, N_samples)
587 except:
588 prob_ml_subtype[i] = this_prob_subtype[this_subtype[0][0]]
--> 590 this_prob_stage = np.squeeze(prob_subtype_stage[i, :, int(ml_subtype[i])])
592 if (np.sum(np.isnan(this_prob_stage)) == 0):
593 # this_stage =
594 this_stage = np.where(this_prob_stage == np.max(this_prob_stage))

ValueError: cannot convert float NaN to integer

``

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions