ragulpr / wtte-rnn

WTTE-RNN a framework for churn and time to event prediction
MIT License
762 stars 186 forks source link

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

Open taxus13 opened 5 years ago

taxus13 commented 5 years ago

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

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 commented 5 years ago

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)
ragulpr commented 5 years ago

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.

taxus13 commented 5 years ago

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?

ragulpr commented 5 years ago

Done! Sorry for slow response, been afk