Invalid dask / python value encountered in arccos

I'm new to python and trying to use dask, but I keep getting RuntimeWarning and don't understand why. Some discernment would be nice.

code:

x2 = da.random.uniform(0.01,0.1,size=1e6,chunks= 1e5)
%time asd2 = da.arccos(x2)

      

this constantly gives me:

C: \ ProgramsPhD \ Anaconda \ lib \ site-packages \ dask \ array \ core.py: 457: RuntimeWarning: Invalid value found in arccos o = func (* args, ** kwargs)

+3


source to share


1 answer


This warning is harmless. Dask.array should define the dtype of the output array, but because it is lazy, it doesn't yet have access to any of the data. To resolve this, it calls np.arccos

on a tiny bit of data. Sometimes this little bit of data is zero, which triggers a NumPy warning.

This is annoying and should be fixed, but it doesn't affect the actual computation.



In [1]: import dask.array as da

In [2]: x2 = da.random.uniform(0.01,0.1,size=1e6,chunks= 1e5)
   ...: %time asd2 = da.arccos(x2)
   ...: 
/home/mrocklin/workspace/dask/dask/array/core.py:476: RuntimeWarning: invalid value encountered in arccos
  o = func(*args, **kwargs)
CPU times: user 5.61 ms, sys: 108 ยตs, total: 5.72 ms
Wall time: 9.66 ms

In [3]: asd2
Out[3]: dask.array<arccos, shape=(1000000,), dtype=float64, chunksize=(100000,)>

In [4]: asd2.compute()
Out[4]: 
array([ 1.48500108,  1.55036626,  1.50620869, ...,  1.52765354,
        1.5051477 ,  1.49203593])

      

+2


source







All Articles