From b4fe5366a3ce734905486b4b2bf5a990e409e39d Mon Sep 17 00:00:00 2001 From: Francois Caud Date: Thu, 18 Jan 2024 14:51:52 +0100 Subject: [PATCH] updt submission files + setup --- setup.py | 2 +- submissions/sample/estimator.py | 50 +++++++++++++-------------- submissions/starting_kit/estimator.py | 50 +++++++++++++-------------- 3 files changed, 49 insertions(+), 53 deletions(-) diff --git a/setup.py b/setup.py index 9630abd..fda2b7d 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,6 @@ description="RAMP module for the Stroke Segmentation Challenge", author="NPNL", packages=["stroke"], - url="https://github.com/AlexandreHutton/stroke", + url="https://github.com/ramp-kits/stroke_lesions/stroke", license="gpl-3.0", ) diff --git a/submissions/sample/estimator.py b/submissions/sample/estimator.py index cd456c9..73119b7 100644 --- a/submissions/sample/estimator.py +++ b/submissions/sample/estimator.py @@ -3,20 +3,18 @@ class BIDSEstimator(BaseEstimator): - ''' + """ Estimator sample for RAMP stroke lesion segmentation. - ''' + """ def __init__(self): - ''' + """ Initialize estimator values (e.g. starting learning rate) here. - ''' + """ return - def fit(self, - X: np.array, - y: np.array): - ''' + def fit(self, X: np.array, y: np.array): + """ Fit the estimator using the input data (X) and target (y). Assumes that all data is present. Optional. This estimator in particular does nothing. Parameters @@ -29,11 +27,11 @@ def fit(self, Returns ------- None - ''' + """ return def fit_partial(self, X, y): - ''' + """ Fit the estimator using the input data (X) and target (y). Assumes that the inputs represent only a fraction of the data and that it will be called multiple times while using the dataset. I.e., learning rates and adaptive parameters should not be entirely recalculated with each call to this method. Required. @@ -48,14 +46,14 @@ def fit_partial(self, X, y): Returns ------- None - ''' + """ # Apply pre-processing to X # Feed to estimator return def predict_proba(self, X): - ''' + """ Applies the data to the estimator to produce a prediction. The output can be continuous to represent the relative confidence the estimator has in the prediction. Optional. Typically, correct but uncertain predictions are rewarded less. Similarly, incorrect but uncertain predictions @@ -70,25 +68,25 @@ def predict_proba(self, X): ------- np.array Prediction made by the estimator. - ''' + """ y = np.ones(X.shape, dtype=bool) return y def predict(self, X): - ''' - Applies the data to the estimator to produce a prediction. The output type is expected to match the problem. - I.e., classification problems should have categorical predictions. Required. - This estimator always returns 1. - Parameters - ---------- - X : np.array - Data of the form (n_samples, n_channels, *image.shape) + """ + Applies the data to the estimator to produce a prediction. The output type is expected to match the problem. + I.e., classification problems should have categorical predictions. Required. + This estimator always returns 1. + Parameters + ---------- + X : np.array + Data of the form (n_samples, n_channels, *image.shape) - Returns - ------- - np.array - Prediction made by the estimator. - ''' + Returns + ------- + np.array + Prediction made by the estimator. + """ y = np.ones(X.shape, dtype=bool) return y diff --git a/submissions/starting_kit/estimator.py b/submissions/starting_kit/estimator.py index cd456c9..73119b7 100644 --- a/submissions/starting_kit/estimator.py +++ b/submissions/starting_kit/estimator.py @@ -3,20 +3,18 @@ class BIDSEstimator(BaseEstimator): - ''' + """ Estimator sample for RAMP stroke lesion segmentation. - ''' + """ def __init__(self): - ''' + """ Initialize estimator values (e.g. starting learning rate) here. - ''' + """ return - def fit(self, - X: np.array, - y: np.array): - ''' + def fit(self, X: np.array, y: np.array): + """ Fit the estimator using the input data (X) and target (y). Assumes that all data is present. Optional. This estimator in particular does nothing. Parameters @@ -29,11 +27,11 @@ def fit(self, Returns ------- None - ''' + """ return def fit_partial(self, X, y): - ''' + """ Fit the estimator using the input data (X) and target (y). Assumes that the inputs represent only a fraction of the data and that it will be called multiple times while using the dataset. I.e., learning rates and adaptive parameters should not be entirely recalculated with each call to this method. Required. @@ -48,14 +46,14 @@ def fit_partial(self, X, y): Returns ------- None - ''' + """ # Apply pre-processing to X # Feed to estimator return def predict_proba(self, X): - ''' + """ Applies the data to the estimator to produce a prediction. The output can be continuous to represent the relative confidence the estimator has in the prediction. Optional. Typically, correct but uncertain predictions are rewarded less. Similarly, incorrect but uncertain predictions @@ -70,25 +68,25 @@ def predict_proba(self, X): ------- np.array Prediction made by the estimator. - ''' + """ y = np.ones(X.shape, dtype=bool) return y def predict(self, X): - ''' - Applies the data to the estimator to produce a prediction. The output type is expected to match the problem. - I.e., classification problems should have categorical predictions. Required. - This estimator always returns 1. - Parameters - ---------- - X : np.array - Data of the form (n_samples, n_channels, *image.shape) + """ + Applies the data to the estimator to produce a prediction. The output type is expected to match the problem. + I.e., classification problems should have categorical predictions. Required. + This estimator always returns 1. + Parameters + ---------- + X : np.array + Data of the form (n_samples, n_channels, *image.shape) - Returns - ------- - np.array - Prediction made by the estimator. - ''' + Returns + ------- + np.array + Prediction made by the estimator. + """ y = np.ones(X.shape, dtype=bool) return y