Skip to content
This repository was archived by the owner on Mar 5, 2024. It is now read-only.
This repository was archived by the owner on Mar 5, 2024. It is now read-only.

ZeroDivisionError: division by zero #16

Closed
@aliechoes

Description

@aliechoes

Hi

thanks for the library and your work.
I am facing a weird problem. I am using the pycombat function. However this is the error that I get repeatedly.

ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-119-bb601998f8f1> in <module>
      1 # run pyComBat
----> 2 df_corrected = pycombat(df_features_compounds.T, 
      3                         metadata["Donor"].tolist())
      4 
      5 

~/.conda/envs/monai/lib/python3.8/site-packages/combat/pycombat.py in pycombat(data, batch, mod, par_prior, prior_plots, mean_only, ref_batch, precision, **kwargs)
    655     NAs = check_NAs(dat)
    656     if not(NAs):
--> 657         B_hat, grand_mean, var_pooled = calculate_mean_var(
    658             design, batches, ref, dat, NAs, ref_batch, n_batches, n_batch, n_array)
    659         stand_mean = calculate_stand_mean(

~/.conda/envs/monai/lib/python3.8/site-packages/combat/pycombat.py in calculate_mean_var(design, batches, ref, dat, NAs, ref_batch, n_batches, n_batch, n_array)
    451     else:
    452         grand_mean = np.dot(np.transpose(
--> 453             [i / n_array for i in n_batches]), B_hat[0:n_batch])
    454     # Calculates the general variance
    455     if not NAs:  # NAs not supported

~/.conda/envs/monai/lib/python3.8/site-packages/combat/pycombat.py in <listcomp>(.0)
    451     else:
    452         grand_mean = np.dot(np.transpose(
--> 453             [i / n_array for i in n_batches]), B_hat[0:n_batch])
    454     # Calculates the general variance
    455     if not NAs:  # NAs not supported

ZeroDivisionError: division by zero

I exactly don't know what to do about it. Would you please help me?

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