cox_regression.client

Client module for cox regression

Attributes

logger

Classes

Client

The client class, representing data owning clients in the learning process.

Module Contents

cox_regression.client.logger[source]
class cox_regression.client.Client(pool: tno.mpc.communication.Pool, max_iter: int = 25, server_name: str = 'server')[source]

The client class, representing data owning clients in the learning process. Based on logistic regression client.

pool[source]
server_name = 'server'[source]
log_reg_solver[source]
n_covariates_: int = 0[source]
property stacked_data_: tno.fl.protocols.cox_regression.survival_stacking.DataType[source]

Return the stacked data.

Returns:

the stacked data.

Raises:

ValueError – when stacked data is not set.

property stacked_target_: tno.fl.protocols.cox_regression.survival_stacking.TargetType[source]

Return the stacked target vector.

Returns:

the stacked target vector.

Raises:

ValueError – when stacked target is not set.

property model_: tno.fl.protocols.logistic_regression.client.ModelType[source]

Return the fitted model.

Returns:

the fitted model

Raises:

ValueError – when model is not yet computed.

async run(covariates: tno.fl.protocols.cox_regression.survival_stacking.CovariatesType, times: tno.fl.protocols.cox_regression.survival_stacking.TimesType, events: tno.fl.protocols.cox_regression.survival_stacking.EventsType) → tno.fl.protocols.logistic_regression.client.ModelType[source]

Perform the learning process.

Parameters:
  • covariates – The covariates of the patients. Can have multiple columns.

  • times – The failure/censoring times.

  • events – The event indicators. Should contain boolean values.

Returns:

The resulting model.

async run_time_varying(ids: tno.fl.protocols.cox_regression.survival_stacking.IdsType, covariates: tno.fl.protocols.cox_regression.survival_stacking.CovariatesType, start_times: tno.fl.protocols.cox_regression.survival_stacking.TimesType, end_times: tno.fl.protocols.cox_regression.survival_stacking.TimesType, events: tno.fl.protocols.cox_regression.survival_stacking.EventsType) → tno.fl.protocols.logistic_regression.client.ModelType[source]

Perform the learning process.

Parameters:
  • ids – 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 – The covariates of the patients. Can have multiple columns.

  • start_times – The start time of the interval.

  • end_times – The end time of the interval.

  • events – The event indicators. Should contain boolean values.

Returns:

The resulting model.

async compute_statistics(include_bins: bool = False) → list[dict[str, float]][source]

Compute statistics for each coefficient: standard error, z-value and p-value.

Parameters:

include_bins – Whether to include parameters for the time bins.

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.