leaspy.io.data.individual_data

Classes

IndividualData

Container for an individual's data

Module Contents

class IndividualData(idx)

Container for an individual’s data

Parameters:
idxIDType

Unique ID

Attributes:
idxIDType

Unique ID

timepointsnp.ndarray[float, 1D]

Timepoints associated with the observations

observationsnp.ndarray[float, 2D]

Observed data points. Shape is (n_timepoints, n_features)

cofactorsDict[FeatureType, Any]

Cofactors in the form {cofactor_name: cofactor_value}

event_time: Float

Time of an event, if the event is censored, the time correspond to the last patient observation

event_bool: bool

Boolean to indicate if an event is censored or not: 1 observed, 0 censored

Parameters:

idx (leaspy.utils.typing.IDType)

idx: leaspy.utils.typing.IDType
timepoints: ndarray = None
observations: ndarray = None
event_time: ndarray | None = None
event_bool: ndarray | None = None
cofactors: dict[leaspy.utils.typing.FeatureType, Any]
add_observations(timepoints, observations)

Include new observations and associated timepoints

Parameters:
timepointsarray-like[float, 1D]

Timepoints associated with the observations to include

observationsarray-like[float, 2D]

Observations to include

Raises:
LeaspyDataInputError
Parameters:
Return type:

None

add_event(event_time, event_bool)

Include event time and associated censoring bool

Parameters:
event_timefloat

Time of the event

event_boolfloat

0 if censored (not observed) and 1 if observed

Parameters:
Return type:

None

add_cofactors(cofactors)

Include new cofactors

Parameters:
cofactorsDict[FeatureType, Any]

Cofactors to include, in the form {name: value}

Raises:
LeaspyDataInputError
LeaspyTypeError
Parameters:

cofactors (dict[leaspy.utils.typing.FeatureType, Any])

Return type:

None

to_frame(headers, event_time_name, event_bool_name)
Parameters:
  • headers (list)

  • event_time_name (str)

  • event_bool_name (str)

Return type:

DataFrame