Skip to content

divide by zero warnings in LearnerND #8

Open
@basnijholt

Description

@basnijholt

(original issue on GitLab)

opened by Joseph Weston (@jbweston) at 2018-12-12T10:57:01.525Z

jbw@broadway adaptive-evaluation ((HEAD detached at v0.7.0)) $ python
Python 3.6.5 | packaged by conda-forge | (default, Apr  6 2018, 13:39:56) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import adaptive
>>> import numpy as np
>>> adaptive.__version__
'0.7.0'
>>> np.__version__
'1.15.2'
>>> def f(xy):
...     return 1
... 
>>> learner = adaptive.LearnerND(f, ((-1, 1), (-1, 1)))
>>> adaptive.runner.simple(learner, lambda l: l.npoints >= 100)
/home/jbw/work/code/2017/adaptive-evaluation/adaptive/learner/learnerND.py:524: RuntimeWarning: divide by zero encountered in long_scalars
  scale_multiplier = 1 / self._scale
/home/jbw/work/code/2017/adaptive-evaluation/adaptive/learner/learnerND.py:543: RuntimeWarning: invalid value encountered in long_scalars
  scale_factor = np.max(np.nan_to_num(self._scale / self._old_scale))

I guess we should explicitly set the places where _scale is zero to have an infinite multiplier?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions