cox_regression.client module¶
Client module for cox regression
- class cox_regression.client.Client(pool, max_iter=25, server_name='server')[source]¶
Bases:
object
The client class, representing data owning clients in the learning process. Based on logistic regression client.
- __init__(pool, max_iter=25, server_name='server')[source]¶
Initializes the client.
- Parameters:
pool (
Pool
) – The communication pool.max_iter (
int
) – The max number of epochsserver_name (
str
) – The name of the server in the communication pool
- async compute_statistics(include_bins=False)[source]¶
Compute statistics for each coefficient: standard error, z-value and p-value.
- Parameters:
include_bins (
bool
) – Whether to include parameters for the time bins.- Return type:
list
[dict
[str
,float
]]- Returns:
A list containing a dictionary for each covariate. The dictionary contains three values: ‘se’ containing the standard error, ‘z’ containing z-value (Wald statistic) ‘p’ containing the p-value.
- property model_: ndarray[tuple[int, ...], dtype[float64]]¶
Return the fitted model.
- Returns:
the fitted model
- Raises:
ValueError – when model is not yet computed.
- async run(covariates, times, events)[source]¶
Perform the learning process.
- Parameters:
covariates (
ndarray
[tuple
[int
,...
],dtype
[floating
[Any
]]]) – The covariates of the patients. Can have multiple columns.times (
ndarray
[tuple
[int
,...
],dtype
[floating
[Any
]]]) – The failure/censoring times.events (
ndarray
[tuple
[int
,...
],dtype
[bool
]]) – The event indicators. Should contain boolean values.
- Return type:
ndarray
[tuple
[int
,...
],dtype
[float64
]]- Returns:
The resulting model.
- async run_time_varying(ids, covariates, start_times, end_times, events)[source]¶
Perform the learning process.
- Parameters:
ids (
ndarray
[tuple
[int
,...
],dtype
[int64
]]) – The patient ids. Can be used to specify time-varying covariates. The id is unique per patient and a patient can have multiple rows. However, a patient id can have only one failure.covariates (
ndarray
[tuple
[int
,...
],dtype
[floating
[Any
]]]) – The covariates of the patients. Can have multiple columns.start_times (
ndarray
[tuple
[int
,...
],dtype
[floating
[Any
]]]) – The start time of the interval.end_times (
ndarray
[tuple
[int
,...
],dtype
[floating
[Any
]]]) – The end time of the interval.events (
ndarray
[tuple
[int
,...
],dtype
[bool
]]) – The event indicators. Should contain boolean values.
- Return type:
ndarray
[tuple
[int
,...
],dtype
[float64
]]- Returns:
The resulting model.
- property stacked_data_: ndarray[tuple[int, ...], dtype[floating[Any]]]¶
Return the stacked data.
- Returns:
the stacked data.
- Raises:
ValueError – when stacked data is not set.
- property stacked_target_: ndarray[tuple[int, ...], dtype[bool]]¶
Return the stacked target vector.
- Returns:
the stacked target vector.
- Raises:
ValueError – when stacked target is not set.