From b74aff6c38c068f3097a8a9f43215da037a1e9d2 Mon Sep 17 00:00:00 2001 From: jeandut Date: Mon, 12 Aug 2024 15:48:51 +0200 Subject: [PATCH] linting --- fedeca/utils/moments_utils.py | 2 -- fedeca/utils/survival_utils.py | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fedeca/utils/moments_utils.py b/fedeca/utils/moments_utils.py index 2326c785..19f4ffe8 100644 --- a/fedeca/utils/moments_utils.py +++ b/fedeca/utils/moments_utils.py @@ -26,7 +26,6 @@ def compute_uncentered_moment(data, order): NotImplementedError Raised if the data type is not Dataframe nor np.ndarray. """ - if isinstance(data, (pd.DataFrame, pd.Series)): moment = data.select_dtypes(include=np.number).pow(order).mean(skipna=True) elif isinstance(data, np.ndarray): @@ -99,7 +98,6 @@ def aggregation_mean(local_means: List[Any], n_local_samples: List[int]): Any Aggregated mean. Same type of the local means """ - tot_samples = np.nan_to_num(np.copy(n_local_samples[0]), nan=0, copy=False) tot_mean = np.nan_to_num(np.copy(local_means[0]), nan=0, copy=False) for mean, n_sample in zip(local_means[1:], n_local_samples[1:]): diff --git a/fedeca/utils/survival_utils.py b/fedeca/utils/survival_utils.py index 737ed471..12f81851 100644 --- a/fedeca/utils/survival_utils.py +++ b/fedeca/utils/survival_utils.py @@ -1588,8 +1588,9 @@ def build_X_y_function( shared_state={}, global_moments={}, ): - """Build the inputs for a propensity model and for a Cox model as well as y directly - from the output of the opener. + """Build the inputs for a propensity model and for a Cox model and y. + + Does that directly on data from opener. This function 1. uses the event column to inject the censorship information present in the duration column (given in absolute values) @@ -1729,7 +1730,7 @@ def compute_X_y_and_propensity_weights_function( if propensity_model is not None: assert ( treated is not None - ), f"""If you are using a propensity model the Treated + ), """If you are using a propensity model the Treated column should be available""" assert np.all( np.in1d(np.unique(treated.astype("uint8"))[0], [0, 1])