Giter Site home page Giter Site logo

Comments (10)

chiragnagpal avatar chiragnagpal commented on June 30, 2024 2

aha! yes, either add a small non-zero factor 1e-4 or something like that, or just add a constant value to every time to change the scale to be strictly positive.

from auton-survival.

chiragnagpal avatar chiragnagpal commented on June 30, 2024 1

yeah we use scikit-survival for the underlying metrics computation. Try shuffling your CV folds ? It might help, essentially computing performance for the models requires the same range of times to be present in the training and testing folds, in the case of your dataset the smaller size leads to a fold having times beyond what it has seen in the training set

from auton-survival.

zapaishchykova avatar zapaishchykova commented on June 30, 2024 1

aha, maybe then stratified creation of the folds will make more sense for such small set. Closing this for now, thanks a lot!

from auton-survival.

chiragnagpal avatar chiragnagpal commented on June 30, 2024

HI @zapaishchykova DSM expects all passed times t to be strictly greater than 0. can you check that in your data?

from auton-survival.

zapaishchykova avatar zapaishchykova commented on June 30, 2024

Hi! Here it is:

times = np.quantile(outcomes.time[outcomes.event==1], [0.25, 0.5, 0.6]).tolist()
times
[13.0, 27.0, 35.0]

from auton-survival.

chiragnagpal avatar chiragnagpal commented on June 30, 2024

can you check if there are any zeros in outcomes.time

from auton-survival.

zapaishchykova avatar zapaishchykova commented on June 30, 2024

there are indeed some zeros in the outcomes.time ! Should I replace them with some small value instead?

from auton-survival.

zapaishchykova avatar zapaishchykova commented on June 30, 2024

Some progress, now I get different error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [48], line 18
     16 roc_auc = []
     17 for i, _ in enumerate(times):
---> 18     roc_auc.append(cumulative_dynamic_auc(et_train, et_test, out_risk[:, i], times[i])[0])
     19 for horizon in enumerate(horizons):
     20     print(f"For {horizon[1]} quantile,")

File ~/miniconda3/envs/pycox310/lib/python3.10/site-packages/sksurv/metrics.py:468, in cumulative_dynamic_auc(survival_train, survival_test, estimate, times, tied_tol)
    466 cens = CensoringDistributionEstimator()
    467 cens.fit(survival_train)
--> 468 ipcw = cens.predict_ipcw(survival_test)
    470 # expand arrays to (n_samples, n_times) shape
    471 test_time = numpy.broadcast_to(test_time[:, numpy.newaxis], (n_samples, n_times))

File ~/miniconda3/envs/pycox310/lib/python3.10/site-packages/sksurv/nonparametric.py:448, in CensoringDistributionEstimator.predict_ipcw(self, y)
    445 Ghat = self.predict_proba(time[event])
    447 if (Ghat == 0.0).any():
--> 448     raise ValueError("censoring survival function is zero at one or more time points")
    450 weights = numpy.zeros(time.shape[0])
    451 weights[event] = 1.0 / Ghat

ValueError: censoring survival function is zero at one or more time points

from auton-survival.

chiragnagpal avatar chiragnagpal commented on June 30, 2024

Are you trying to perform Cross Validation? is this a relatively small dataset?

from auton-survival.

zapaishchykova avatar zapaishchykova commented on June 30, 2024

It is a small dataset!
Interestingly, with this dataset using scikit-survival I was also unable to compute ROC with similar looking error

from auton-survival.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.