From 6aa2d63ff6e5e27b1550164861f64aa3f9a46c8e Mon Sep 17 00:00:00 2001 From: bbayukari Date: Mon, 5 Aug 2024 18:05:10 +0000 Subject: [PATCH] Auto code format --- skscope/utilities.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/skscope/utilities.py b/skscope/utilities.py index 7beb1dd..4cc0494 100644 --- a/skscope/utilities.py +++ b/skscope/utilities.py @@ -31,7 +31,11 @@ def check_y_survival(y_or_event, *args, allow_all_censored=False): if len(args) == 0: y = y_or_event - if not isinstance(y, np.ndarray) or y.dtype.fields is None or len(y.dtype.fields) != 2: + if ( + not isinstance(y, np.ndarray) + or y.dtype.fields is None + or len(y.dtype.fields) != 2 + ): raise ValueError( "y must be a structured array with the first field" " being a binary class event indicator and the second field" @@ -47,7 +51,9 @@ def check_y_survival(y_or_event, *args, allow_all_censored=False): event = check_array(y_event, ensure_2d=False) if not np.issubdtype(event.dtype, np.bool_): - raise ValueError(f"elements of event indicator must be boolean, but found {event.dtype}") + raise ValueError( + f"elements of event indicator must be boolean, but found {event.dtype}" + ) if not (allow_all_censored or np.any(event)): raise ValueError("all samples are censored") @@ -60,7 +66,9 @@ def check_y_survival(y_or_event, *args, allow_all_censored=False): yt = check_array(yt, ensure_2d=False) if not np.issubdtype(yt.dtype, np.number): - raise ValueError(f"time must be numeric, but found {yt.dtype} for argument {i + 2}") + raise ValueError( + f"time must be numeric, but found {yt.dtype} for argument {i + 2}" + ) return_val.append(yt) @@ -195,7 +203,9 @@ def logistic_loss(params): The GIC is calculated using the formula: GIC = 2 * objective_value + effective_params_num * np.log(np.log(train_size)) * np.log(dimensionality) """ - return 2 * objective_value + effective_params_num * np.log(np.log(train_size)) * np.log(dimensionality) + return 2 * objective_value + effective_params_num * np.log( + np.log(train_size) + ) * np.log(dimensionality) def EBIC( @@ -230,7 +240,9 @@ def logistic_loss(params): The E is calculated using the formula: EBIC = 2 * objective_value + effective_params_num * (np.log(train_size) + 2 * np.log(dimensionality)) """ - return 2 * objective_value + effective_params_num * (np.log(train_size) + 2 * np.log(dimensionality)) + return 2 * objective_value + effective_params_num * ( + np.log(train_size) + 2 * np.log(dimensionality) + ) def LinearSIC( @@ -267,6 +279,6 @@ def linear_loss(params): The LinearSIC is calculated using the formula: LinearSIC = train_size * np.log(objective_value) + 2 * effective_params_num * np.log(np.log(train_size)) * np.log(dimensionality) """ - return train_size * np.log(objective_value) + 2 * effective_params_num * np.log(np.log(train_size)) * np.log( - dimensionality - ) + return train_size * np.log(objective_value) + 2 * effective_params_num * np.log( + np.log(train_size) + ) * np.log(dimensionality)