wtte-rnn icon indicating copy to clipboard operation
wtte-rnn copied to clipboard

AttributeError: module 'numpy' has no attribute 'float128'

Open taxus13 opened this issue 7 years ago • 4 comments

Hi, I was trying to run this example to test WTTE. However, the cell "Format tensor for training" won't execute on my machine:

    C:\Python36\python-3.6.2.amd64\lib\site-packages\wtte\transforms.py in normalize_padded(padded, 
    means, stds, only_nonzero, epsilon)
        527         else:
        528             vals = padded.reshape(n_obs, n_features)
    --> 529         means = np.nanmean(vals, axis=0, keepdims=False, dtype=np.float128)
        530         del vals
        531 

AttributeError: module 'numpy' has no attribute 'float128'

I am using WinPython with

  • Python 3.6.2
  • numpy 1.14.5
  • wtte 1.1.1
  • tensorflow-gpu 1.9.0
  • keras 2.2.0

This issue suggests, that numpy compiled with MKL does not support float128.
The Mailinglist recommends to replace np.float128 with np.longdouble.

I can try to fix this, do you have any PR guidelines?

taxus13 avatar Jul 28 '18 21:07 taxus13

I fixed it here: https://github.com/taxus13/wtte-rnn/tree/bugfix/float-fix-for-mkl

However, some tests are failing:

  1. test_discrete_padded_pipeline: different dtypes int64/int32
  2. test_padded_between (same)
  3. test_censoring_funs_no_time_discrete (AssertionError: not_censored failed)
  4. test_censoring_funs_with_time_discrete (same)

taxus13 avatar Jul 28 '18 21:07 taxus13

Nice catch, did not try with MKL before! None of those test should be affected by your commit so it's a sign that they are failing due to your local environment. What's your pandas version? That could affect 1-2.

Guidelines: Checkout development and submit your PR with changes to that.

ragulpr avatar Jul 30 '18 12:07 ragulpr

I have the most recent pandas 0.23.1

It seems that master is ahead of development and I branched from master. Can you rebase develop on master?

taxus13 avatar Jul 30 '18 15:07 taxus13

Done! Sorry for slow response, been afk

ragulpr avatar Aug 15 '18 15:08 ragulpr