sebp / scikit-survival

Survival analysis built on top of scikit-learn
GNU General Public License v3.0
1.14k stars 216 forks source link

Can't instantiate abstract class GradientBoostingSurvivalAnalysis with abstract methods _encode_y, _get_loss #440

Closed scuri-patrick closed 8 months ago

scuri-patrick commented 8 months ago

Describe the bug

Getting error while initiating GradientBoostingSurvivalAnalysis

Code Sample to Reproduce the Bug

from sksurv.ensemble import (
    GradientBoostingSurvivalAnalysis,
)
model = GradientBoostingSurvivalAnalysis()

Expected Results Work as all the other models in sksurv

Actual Results

TypeError Traceback (most recent call last) Cell In[36], line 4 1 from sksurv.ensemble import ( 2 GradientBoostingSurvivalAnalysis, 3 ) ----> 4 model = GradientBoostingSurvivalAnalysis()

TypeError: Can't instantiate abstract class GradientBoostingSurvivalAnalysis with abstract methods _encode_y, _get_loss

Versions Please execute the following snippet and paste the output below.

import sksurv; sksurv.show_versions()
SYSTEM
------
Platform          : Linux-5.15.0-1045-azure-x86_64-with-glibc2.31
Python version    : CPython <module 'platform' from '/anaconda/envs/uc2_pat/lib/python3.10/platform.py'>
Python interpreter: /anaconda/envs/uc2_pat/bin/python

DEPENDENCIES
------------
scikit-survival   : 0.22.2
scikit-learn      : 1.4.1.post1
numpy             : 1.26.4
scipy             : 1.12.0
pandas            : 2.2.1
numexpr           : 2.9.0
ecos              : 2.0.13
osqp              : 0.6.5
joblib            : 1.3.2
matplotlib        : 3.8.3
pytest            : None
sphinx            : None
Cython            : None
pip               : 24.0
setuptools        : 69.1.1
sebp commented 8 months ago

scikit-learn 1.4 isn't support yet (see issue #436).

You need to downgrade to scikit-learn 1.3 or wait for a new release of scikit-survival that supports scikit-learn 1.4, which will probably be available this week.