square / pysurvival

Open source package for Survival Analysis modeling
https://www.pysurvival.io/
Apache License 2.0
347 stars 107 forks source link

Issue when setting "use_log = True" in create_risk_groups #27

Open DeliaMarin opened 4 years ago

DeliaMarin commented 4 years ago

The code currently works as follows:

risk = model.predict_risk(X)
    if use_log:
        risk = np.log(risk)

However, if model.predict_risk(X) get inf values, when applying np.log(risk) the values will still being inf. Whereas, if they are caclulated with log from the begining, inf values will be less likely to appear. Maybe use something like

    if use_log:
        risk = model.predict_risk(X, use_log = True)
    else: risk = model.predict_risk(X, use_log = False)