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

ZeroDivisionError but only sometimes #13

Open
luga01 opened this issue Aug 15, 2023 · 4 comments
Open

ZeroDivisionError but only sometimes #13

luga01 opened this issue Aug 15, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@luga01
Copy link

luga01 commented Aug 15, 2023

Hello!
Thank you for making this tool available! I have been using it to obtain m-ratio measures from a Pandas DataFrame consisting of the columns ‘Stimuli’, ‘Responses’, ‘Accuracy’, and ‘Confidence’. The confidence scores of the data are discrete integer scores, ranging from 1-6 (nRatings = 6). (All subjects are treated as a single subject.)
image

I am able to use the metad() and the .criterion() method without a problem on this DataFrame.
image

However, when I divide the same dataset up into individual participants and compute the m-ratio for each one, I get a ZeroDivisionError: division by zero, but only after it has successfully computed the m-ratio for several participants.
What I do is create an individual DataFrame for each participant and apply the metad() function to it. This works for a couple of participants and then suddenly turns up with a ZeroDivisionError. I have looked at the DataFrame of the participant for whom I get the error (bottom DataFrame), but cannot spot any difference between it and DataFrames of participants for whom the metad() function does work (top DataFrame).
image

The first DataFrame works, but for the second one I get the error message:
image

Do you have any idea why this might be happening or what can be done to fix it?

Thank you in advance,
Lucas Gappmayr

@LegrandNico LegrandNico added the bug Something isn't working label Sep 25, 2023
@iezqrom
Copy link

iezqrom commented Nov 13, 2023

Thanks a lot for developing this library. I'm having the same issue and was wondering whether there are any updates to resolve this issue, thanks!

@luga01
Copy link
Author

luga01 commented Nov 14, 2023

Thanks a lot for developing this library. I'm having the same issue and was wondering whether there are any updates to resolve this issue, thanks!

Hey. You can try the hmetad() function instead. That one might work. I remember managing to run this function in a conda environment. My code looked like this:

result = hmetad(data = df, nRatings = 6, stimuli = 'Stimuli', accuracy = 'Accuracy',
confidence = 'Confidence', output = 'dataframe', padAmount = 1, padding = True, verbose = 0)

@iezqrom
Copy link

iezqrom commented Dec 19, 2023

Thanks! I ended up using the code from the 'competition' in Matlab (hMeta-d toolbox)... hehe

@LegrandNico
Copy link
Contributor

@luga01 could you send a data frame that reproduces the error?

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

3 participants