julianspaeth / random-survival-forest

A Random Survival Forest implementation for python inspired by Ishwaran et al. - Easily understandable, adaptable and extendable.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If the survival time is 'float' object

pancratm opened this issue · comments

Hi, I have a question when I want to fit the model.
If the survival time is 'float' object, an error occurs,
TypeError: 'float' object cannot be interpreted as an integer, because in the "RandomSurvivalForest.py", line 46, in fit
self.timeline = range(y.iloc[:, 0].min(), y.iloc[:, 0].max(), 1)
Is there a solution for this?
Thanks.

Same question! Any solution?

Hi,

this was not well implemented, sorry for that!

I see two solutions that you could change in the code:

  1. Quickfix - convert the min and max values to integers: range(int(y.iloc[:, 0].min()), int(y.iloc[:, 0].max()), 1)

or if you want to keep the float timeline values:

  1. Keep floats - np.arange(y.iloc[:, 0].min(), y.iloc[:, 0].max(), step_bettween_min_and_max)

As soon as I have time I will fix and push it. But this could take some time, so for now just exchange the line of code with the solution that suits best for you.