Skip to content

Divide by 0 error #1

@adamilardi

Description

@adamilardi

I haven't looked into the root cause yet but here is the data that causes it. It would appear to be the columns with all 0s.

0 0 0 0 1 0
1 0 0 0 0 0
1 0 0 0 0 0
0 0 1 0 0 0
1 0 0 0 0 0
1 0 0 0 0 0
1 0 0 0 0 0
1 0 0 0 0 0
1 0 0 0 0 0
0 0 0 0 1 0

python findDirichletPrior.py -K 6

Loading data
all data loaded into memory
time to load memory: 0.000438928604126
1 Loss: 4.75135269617 , Priors: [0.6, 0.0, 0.2, 0.0, 0.2, 0.0] , Gradient Size: 75.0
Traceback (most recent call last):
File "findDirichletPrior.py", line 94, in
priors = DME.findDirichletPriors(uMatrix, vVector, priors, verbose)
File "/BayesPy/ConjugatePriorTools/dirichletMultinomialEstimation.py", line 155, in findDirichletPriors
trialStep = predictStepUsingHessian(gradient, priors, uMatrix, vVector)
File "/BayesPy/ConjugatePriorTools/dirichletMultinomialEstimation.py", line 111, in predictStepUsingHessian
return getPredictedStep(totalHConst, totalHDiag, gradient)
File "/BayesPy/ConjugatePriorTools/dirichletMultinomialEstimation.py", line 69, in getPredictedStep
numSum += gradient[i] / hDiag[i]
ZeroDivisionError: float division by zero

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions