scikit-survival 0.6.0 released

Today, I released scikit-survival 0.6.0. This release is long overdue and adds support for NumPy 1.14 and pandas up to 0.23. In addition, the new class sksurv.util.Surv makes it easier to construct a structured array from NumPy arrays, lists, or a pandas data frame. The examples below showcase how to create a structured array for the dependent variable.

First, we can construct a structered array from a list of boolean event indicators and a list of integers for the observed time:

import pandas
from sksurv.util import Surv
y = Surv.from_arrays([True, False, False, True, True], [1, 19, 11, 6, 9])

which equals

y = numpy.array([( True,  1.), (False, 19.), (False, 11.), ( True,  6.),
                 ( True,  9.)], dtype=[('event', '?'), ('time', '<f8')])

Alternatively, we can use a 0/1 valued list for the event indicator:

y = Surv.from_arrays([1, 0, 0, 1, 1], [1, 19, 11, 6, 9])

Finally, if event indicator and observed time are stored in a pandas data frame,
we can just use Surv.from_dataframe and tell it what columns to use:

data = pandas.DataFrame({"some_event": [True, False, False, True, True],
                         "time_of_event": [1, 19, 11, 6, 9]})
y = Surv.from_dataframe("some_event", "time_of_event", data)

The some_event column can also be 0/1 valued, of course.


You can install the latest version via Anaconda (Linux, OSX and Windows):

conda install -c sebp scikit-survival

or via pip:

pip install -U scikit-survival