diff --git a/.gitignore b/.gitignore index 8bfd8033..5e0cbc64 100755 --- a/.gitignore +++ b/.gitignore @@ -132,4 +132,4 @@ WORC/external/* WORC/exampledata/ICCvalues.csv WORC/tests/*.png WORC/tests/*.mat -WORC/tests/WORC_Example_STWStrategyHN_Regression +WORC/tests/WORC_Example_STWStrategyHN_* diff --git a/.travis.yml b/.travis.yml index 5ec250b8..ec684cf8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,13 +52,18 @@ matrix: - fastr trace /tmp/WORC_Example_STWStrategyHN/__sink_data__.json --sinks classification --samples all - fastr trace /tmp/WORC_Example_STWStrategyHN/__sink_data__.json --sinks performance --samples all - fastr trace /tmp/GS/DEBUG_0/tmp/__sink_data__.json --sinks output --samples id_0__0000__0000 - # Change the tutorial script to also run a regression experiment, - # using the previously calculated features + # Also run a regression experiment, using the previously calculated features - rm -r /tmp/GS/DEBUG_0 - python WORC/tests/WORCTutorialSimple_travis_regression.py - fastr trace /tmp/WORC_Example_STWStrategyHN_Regression/__sink_data__.json --sinks classification --samples all - fastr trace /tmp/WORC_Example_STWStrategyHN_Regression/__sink_data__.json --sinks performance --samples all - fastr trace /tmp/GS/DEBUG_0/tmp/__sink_data__.json --sinks output --samples id_0__0000__0000 + # Also run a multiclass experiment, using the previously calculated features + - rm -r /tmp/GS/DEBUG_0 + - python WORC/tests/WORCTutorialSimple_travis_multiclass.py + - fastr trace /tmp/WORC_Example_STWStrategyHN_Multiclass/__sink_data__.json --sinks classification --samples all + - fastr trace /tmp/WORC_Example_STWStrategyHN_Multiclass/__sink_data__.json --sinks performance --samples all + - fastr trace /tmp/GS/DEBUG_0/tmp/__sink_data__.json --sinks output --samples id_0__0000__0000 notifications: slack: secure: ytP+qd6Rx1m1uXYMaN7dFHnFNu+bCIcyugSnAY7BtbumJwCuEt8hbWvQ/sDoAKqxj5VYcnBlTRDn1gjg2t2shs7pBGgjdeZQpQglXyAtN4bz3suSUbQ9/RIwt+RPmbiTXkWQtoZ4q0DotydozKMnq8Cvhdy+d5pMqToER6kMq/WCC+Y/99mmnqO2VrWpvAvP6bBOWDvrk/C4u3y5m3Rp5iE7uAYR3TDTprIW9UNEntDoEYT2T+bidkDRl7DMsi8R4q4s/A6EhZpB4Tnhwz7ama155z77ywdZLhdmk5HJvngXcunVwH4v/l8DbBZU0PqMEJzaRMn/tQCCqjx1/unpyFCv+QuhmP5K4wo17R77jHlcn7SBkdzYr/CKHrilWuShmvOMCckBShpQw3H9PivcI6/G5mVA23tH+gJSQUbzZmBR683x7oQHmnK3g977yD/ufEvV6qME9HFXt3+jIzVEwsUjtJsTV/NsbHlErJfhBp8HJTpq6IRhtKcX9QS1i/APXcYcCSCFJe8tOTLN6xmAKBgONG3XOAvJwfwXbF+rmfjX0x6KMUuD5WmHLjMLhQp0dS00LV7C9s18UkFBgKydqvF2AMPUsbgIGyZ/Vz3v5nz7JiNLDfp0HxQpqAABpdwDHR3/CfuhCDcqzIXAgRgXaFrqCxqoH6OrsgRH6UxUXnM= diff --git a/CHANGELOG b/CHANGELOG index 3def1932..d833c0e1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,8 +6,19 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `_ and this project adheres to `Semantic Versioning `_ +3.4.3 - 2021-06-02 +------------------ + +Fixed +~~~~~ +- SimpleWORC and BasicWORC now support multilabel workflows. +- SimpleWORC and BasicWORC now support use of masks. + +Added +~~~~~~~ +- Unit testing for multilabel workflows. -3.4.2 - Unreleased +3.4.2 - 2021-05-27 ------------------ Fixed diff --git a/README.md b/README.md index 91ff239e..51654616 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# WORC v3.4.2 +# WORC v3.4.3 ## Workflow for Optimal Radiomics Classification ## Information diff --git a/README.rst b/README.rst index 4a0ce852..5d9a902c 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -WORC v3.4.2 +WORC v3.4.3 =========== Workflow for Optimal Radiomics Classification diff --git a/WORC/WORC.py b/WORC/WORC.py index 9e25abe1..aeb33d10 100644 --- a/WORC/WORC.py +++ b/WORC/WORC.py @@ -419,12 +419,7 @@ def defaultconfig(self): config['Classification']['fastr'] = 'True' config['Classification']['fastr_plugin'] = self.fastr_plugin config['Classification']['classifiers'] =\ - 'SVM, SVM, SVM, SVM, SVM, SVM, SVM, SVM, SVM, ' +\ - 'RF, RF, RF, ' +\ - 'LR, LR, LR, ' +\ - 'LDA, LDA, LDA, ' +\ - 'QDA, QDA, QDA, ' +\ - 'GaussianNB, GaussianNB, GaussianNB, ' +\ + 'SVM, RF, LR, LDA, QDA, GaussianNB, ' +\ 'AdaBoostClassifier, ' +\ 'XGBClassifier' config['Classification']['max_iter'] = '100000' @@ -472,7 +467,7 @@ def defaultconfig(self): # Hyperparameter optimization options config['HyperOptimization'] = dict() config['HyperOptimization']['scoring_method'] = 'f1_weighted' - config['HyperOptimization']['test_size'] = '0.15' + config['HyperOptimization']['test_size'] = '0.2' config['HyperOptimization']['n_splits'] = '5' config['HyperOptimization']['N_iterations'] = '1000' config['HyperOptimization']['n_jobspercore'] = '500' # only relevant when using fastr in classification @@ -982,6 +977,7 @@ def build_training(self): self.links_C1_test[label] = self.classify.inputs['features_test'][str(label)] << self.sources_features_test[label].output self.links_C1_test[label].collapse = 'test' + else: raise WORCexceptions.WORCIOError("Please provide labels.") else: @@ -1769,7 +1765,7 @@ def execute(self): self.network.execute(self.source_data, self.sink_data, execution_plugin=self.fastr_plugin, tmpdir=self.fastr_tmpdir) - def add_evaluation(self, label_type, modus='classification'): + def add_evaluation(self, label_type, modus='binary_classification'): """Add branch for evaluation of performance to network. Note: should be done after build, before set: diff --git a/WORC/classification/crossval.py b/WORC/classification/crossval.py index 25061d1a..34c1d7e3 100644 --- a/WORC/classification/crossval.py +++ b/WORC/classification/crossval.py @@ -104,6 +104,7 @@ def random_split_cross_validation(image_features, feature_labels, classes, for n_patient in range(0, classes.shape[1]): for n_label in range(0, classes.shape[0]): classes_temp[n_patient, n_label] = classes[n_label, n_patient] + else: raise ae.WORCKeyError('{} is not a valid modus!').format(modus) diff --git a/WORC/classification/fitandscore.py b/WORC/classification/fitandscore.py index d71ebad4..a91cbee8 100644 --- a/WORC/classification/fitandscore.py +++ b/WORC/classification/fitandscore.py @@ -432,6 +432,7 @@ def fit_and_score(X, y, scoring, X_test = scaler.transform(X_test) del para_estimator['FeatureScaling'] + del para_estimator['FeatureScaling_skip_features'] # Delete the object if we do not need to return it if not return_all: @@ -554,6 +555,11 @@ def fit_and_score(X, y, scoring, else: raise ae.WORCKeyError(f'Model {model} is not known for SelectFromModel. Use Lasso, LR, or RF.') + if len(y_train.shape) >= 2: + # Multilabel or regression. Regression: second dimension has length 1 + if y_train.shape[1] > 1 and model != 'RF': + raise ae.WORCValueError(f'Model {model} is not suitable for multiclass classification. Please use RF or do not use SelectFromModel.') + # Prefit model selectestimator.fit(X_train, y_train) @@ -968,6 +974,8 @@ def delete_cc_para(para): 'RFmin_samples_split', 'RFmax_depth', 'LRpenalty', + 'LR_l1_ratio', + 'LR_solver', 'LRC', 'LDA_solver', 'LDA_shrinkage', diff --git a/WORC/doc/_build/doctrees/autogen/WORC.doctree b/WORC/doc/_build/doctrees/autogen/WORC.doctree index 36f3f783..94e398a8 100644 Binary files a/WORC/doc/_build/doctrees/autogen/WORC.doctree and b/WORC/doc/_build/doctrees/autogen/WORC.doctree differ diff --git a/WORC/doc/_build/doctrees/autogen/WORC.facade.doctree b/WORC/doc/_build/doctrees/autogen/WORC.facade.doctree index 14329baf..0f5863f6 100644 Binary files a/WORC/doc/_build/doctrees/autogen/WORC.facade.doctree and b/WORC/doc/_build/doctrees/autogen/WORC.facade.doctree differ diff --git a/WORC/doc/_build/doctrees/autogen/WORC.tools.doctree b/WORC/doc/_build/doctrees/autogen/WORC.tools.doctree index 061b3403..bab52d65 100644 Binary files a/WORC/doc/_build/doctrees/autogen/WORC.tools.doctree and b/WORC/doc/_build/doctrees/autogen/WORC.tools.doctree differ diff --git a/WORC/doc/_build/doctrees/environment.pickle b/WORC/doc/_build/doctrees/environment.pickle index f758c54a..b108558a 100644 Binary files a/WORC/doc/_build/doctrees/environment.pickle and b/WORC/doc/_build/doctrees/environment.pickle differ diff --git a/WORC/doc/_build/doctrees/static/changelog.doctree b/WORC/doc/_build/doctrees/static/changelog.doctree index 38afcd26..aa515e91 100644 Binary files a/WORC/doc/_build/doctrees/static/changelog.doctree and b/WORC/doc/_build/doctrees/static/changelog.doctree differ diff --git a/WORC/doc/_build/doctrees/static/configuration.doctree b/WORC/doc/_build/doctrees/static/configuration.doctree index ff55fc5f..8043c618 100644 Binary files a/WORC/doc/_build/doctrees/static/configuration.doctree and b/WORC/doc/_build/doctrees/static/configuration.doctree differ diff --git a/WORC/doc/_build/html/.buildinfo b/WORC/doc/_build/html/.buildinfo index f0025061..64323ff1 100644 --- a/WORC/doc/_build/html/.buildinfo +++ b/WORC/doc/_build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 33f10d2ce9bf6d5dcfd26d0fd1e86e7b +config: 1a400459aca376ecf872ea4fb53480b0 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/WORC/doc/_build/html/_modules/WORC/IOparser/config_WORC.html b/WORC/doc/_build/html/_modules/WORC/IOparser/config_WORC.html index a14569a7..ce29ce65 100644 --- a/WORC/doc/_build/html/_modules/WORC/IOparser/config_WORC.html +++ b/WORC/doc/_build/html/_modules/WORC/IOparser/config_WORC.html @@ -8,7 +8,7 @@ - WORC.IOparser.config_WORC — WORC 3.4.2 documentation + WORC.IOparser.config_WORC — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/IOparser/config_io_classifier.html b/WORC/doc/_build/html/_modules/WORC/IOparser/config_io_classifier.html index 0d9af4f9..ae6979dd 100644 --- a/WORC/doc/_build/html/_modules/WORC/IOparser/config_io_classifier.html +++ b/WORC/doc/_build/html/_modules/WORC/IOparser/config_io_classifier.html @@ -8,7 +8,7 @@ - WORC.IOparser.config_io_classifier — WORC 3.4.2 documentation + WORC.IOparser.config_io_classifier — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/IOparser/config_preprocessing.html b/WORC/doc/_build/html/_modules/WORC/IOparser/config_preprocessing.html index c27e9d33..4e11b048 100644 --- a/WORC/doc/_build/html/_modules/WORC/IOparser/config_preprocessing.html +++ b/WORC/doc/_build/html/_modules/WORC/IOparser/config_preprocessing.html @@ -8,7 +8,7 @@ - WORC.IOparser.config_preprocessing — WORC 3.4.2 documentation + WORC.IOparser.config_preprocessing — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/IOparser/config_segmentix.html b/WORC/doc/_build/html/_modules/WORC/IOparser/config_segmentix.html index b6efbde6..7108bf87 100644 --- a/WORC/doc/_build/html/_modules/WORC/IOparser/config_segmentix.html +++ b/WORC/doc/_build/html/_modules/WORC/IOparser/config_segmentix.html @@ -8,7 +8,7 @@ - WORC.IOparser.config_segmentix — WORC 3.4.2 documentation + WORC.IOparser.config_segmentix — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/IOparser/file_io.html b/WORC/doc/_build/html/_modules/WORC/IOparser/file_io.html index b09f3219..2c0f0ab7 100644 --- a/WORC/doc/_build/html/_modules/WORC/IOparser/file_io.html +++ b/WORC/doc/_build/html/_modules/WORC/IOparser/file_io.html @@ -8,7 +8,7 @@ - WORC.IOparser.file_io — WORC 3.4.2 documentation + WORC.IOparser.file_io — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/WORC.html b/WORC/doc/_build/html/_modules/WORC/WORC.html index b512b18b..9990b420 100644 --- a/WORC/doc/_build/html/_modules/WORC/WORC.html +++ b/WORC/doc/_build/html/_modules/WORC/WORC.html @@ -8,7 +8,7 @@ - WORC.WORC — WORC 3.4.2 documentation + WORC.WORC — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
@@ -584,12 +584,7 @@

Source code for WORC.WORC

         config['Classification']['fastr'] = 'True'
         config['Classification']['fastr_plugin'] = self.fastr_plugin
         config['Classification']['classifiers'] =\
-            'SVM, SVM, SVM, SVM, SVM, SVM, SVM, SVM, SVM, ' +\
-            'RF, RF, RF, ' +\
-            'LR, LR, LR, ' +\
-            'LDA, LDA, LDA, ' +\
-            'QDA, QDA, QDA, ' +\
-            'GaussianNB, GaussianNB, GaussianNB, ' +\
+            'SVM, RF, LR, LDA, QDA, GaussianNB, ' +\
             'AdaBoostClassifier, ' +\
             'XGBClassifier'
         config['Classification']['max_iter'] = '100000'
@@ -637,7 +632,7 @@ 

Source code for WORC.WORC

         # Hyperparameter optimization options
         config['HyperOptimization'] = dict()
         config['HyperOptimization']['scoring_method'] = 'f1_weighted'
-        config['HyperOptimization']['test_size'] = '0.15'
+        config['HyperOptimization']['test_size'] = '0.2'
         config['HyperOptimization']['n_splits'] = '5'
         config['HyperOptimization']['N_iterations'] = '1000'
         config['HyperOptimization']['n_jobspercore'] = '500'  # only relevant when using fastr in classification
@@ -1147,6 +1142,7 @@ 

Source code for WORC.WORC

                             self.links_C1_test[label] = self.classify.inputs['features_test'][str(label)] << self.sources_features_test[label].output
                             self.links_C1_test[label].collapse = 'test'
 
+
             else:
                 raise WORCexceptions.WORCIOError("Please provide labels.")
         else:
@@ -1934,7 +1930,7 @@ 

Source code for WORC.WORC

 
         self.network.execute(self.source_data, self.sink_data, execution_plugin=self.fastr_plugin, tmpdir=self.fastr_tmpdir)
-
[docs] def add_evaluation(self, label_type, modus='classification'): +
[docs] def add_evaluation(self, label_type, modus='binary_classification'): """Add branch for evaluation of performance to network. Note: should be done after build, before set: diff --git a/WORC/doc/_build/html/_modules/WORC/addexceptions.html b/WORC/doc/_build/html/_modules/WORC/addexceptions.html index 8724bda4..6ea3064d 100644 --- a/WORC/doc/_build/html/_modules/WORC/addexceptions.html +++ b/WORC/doc/_build/html/_modules/WORC/addexceptions.html @@ -8,7 +8,7 @@ - WORC.addexceptions — WORC 3.4.2 documentation + WORC.addexceptions — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/AdvancedSampler.html b/WORC/doc/_build/html/_modules/WORC/classification/AdvancedSampler.html index bb0b2570..7408c95f 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/AdvancedSampler.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/AdvancedSampler.html @@ -8,7 +8,7 @@ - WORC.classification.AdvancedSampler — WORC 3.4.2 documentation + WORC.classification.AdvancedSampler — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/ObjectSampler.html b/WORC/doc/_build/html/_modules/WORC/classification/ObjectSampler.html index 70ee7457..fb08b036 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/ObjectSampler.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/ObjectSampler.html @@ -8,7 +8,7 @@ - WORC.classification.ObjectSampler — WORC 3.4.2 documentation + WORC.classification.ObjectSampler — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/RankedSVM.html b/WORC/doc/_build/html/_modules/WORC/classification/RankedSVM.html index e65a8523..e9a7dae8 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/RankedSVM.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/RankedSVM.html @@ -8,7 +8,7 @@ - WORC.classification.RankedSVM — WORC 3.4.2 documentation + WORC.classification.RankedSVM — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/SearchCV.html b/WORC/doc/_build/html/_modules/WORC/classification/SearchCV.html index c080ac63..9fcd0385 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/SearchCV.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/SearchCV.html @@ -8,7 +8,7 @@ - WORC.classification.SearchCV — WORC 3.4.2 documentation + WORC.classification.SearchCV — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/construct_classifier.html b/WORC/doc/_build/html/_modules/WORC/classification/construct_classifier.html index a91f836c..a6642d40 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/construct_classifier.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/construct_classifier.html @@ -8,7 +8,7 @@ - WORC.classification.construct_classifier — WORC 3.4.2 documentation + WORC.classification.construct_classifier — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/createfixedsplits.html b/WORC/doc/_build/html/_modules/WORC/classification/createfixedsplits.html index de4e1ff2..9d111ccd 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/createfixedsplits.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/createfixedsplits.html @@ -8,7 +8,7 @@ - WORC.classification.createfixedsplits — WORC 3.4.2 documentation + WORC.classification.createfixedsplits — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/crossval.html b/WORC/doc/_build/html/_modules/WORC/classification/crossval.html index 0c547ace..2b0a9074 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/crossval.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/crossval.html @@ -8,7 +8,7 @@ - WORC.classification.crossval — WORC 3.4.2 documentation + WORC.classification.crossval — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
@@ -269,6 +269,7 @@

Source code for WORC.classification.crossval

for n_patient in range(0, classes.shape[1]):
                     for n_label in range(0, classes.shape[0]):
                         classes_temp[n_patient, n_label] = classes[n_label, n_patient]
+
             else:
                 raise ae.WORCKeyError('{} is not a valid modus!').format(modus)
 
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/estimators.html b/WORC/doc/_build/html/_modules/WORC/classification/estimators.html
index ff0758df..69f1d45a 100644
--- a/WORC/doc/_build/html/_modules/WORC/classification/estimators.html
+++ b/WORC/doc/_build/html/_modules/WORC/classification/estimators.html
@@ -8,7 +8,7 @@
   
   
   
-  WORC.classification.estimators — WORC 3.4.2 documentation
+  WORC.classification.estimators — WORC 3.4.3 documentation
   
 
   
@@ -62,7 +62,7 @@
             
             
               
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/fitandscore.html b/WORC/doc/_build/html/_modules/WORC/classification/fitandscore.html index 4a58ef1f..f4d639c4 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/fitandscore.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/fitandscore.html @@ -8,7 +8,7 @@ - WORC.classification.fitandscore — WORC 3.4.2 documentation + WORC.classification.fitandscore — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
@@ -597,6 +597,7 @@

Source code for WORC.classification.fitandscore

< X_test = scaler.transform(X_test) del para_estimator['FeatureScaling'] + del para_estimator['FeatureScaling_skip_features'] # Delete the object if we do not need to return it if not return_all: @@ -719,6 +720,11 @@

Source code for WORC.classification.fitandscore

< else: raise ae.WORCKeyError(f'Model {model} is not known for SelectFromModel. Use Lasso, LR, or RF.') + if len(y_train.shape) >= 2: + # Multilabel or regression. Regression: second dimension has length 1 + if y_train.shape[1] > 1 and model != 'RF': + raise ae.WORCValueError(f'Model {model} is not suitable for multiclass classification. Please use RF or do not use SelectFromModel.') + # Prefit model selectestimator.fit(X_train, y_train) @@ -1133,6 +1139,8 @@

Source code for WORC.classification.fitandscore

< 'RFmin_samples_split', 'RFmax_depth', 'LRpenalty', + 'LR_l1_ratio', + 'LR_solver', 'LRC', 'LDA_solver', 'LDA_shrinkage', diff --git a/WORC/doc/_build/html/_modules/WORC/classification/metrics.html b/WORC/doc/_build/html/_modules/WORC/classification/metrics.html index 249ebde5..7f960555 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/metrics.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/metrics.html @@ -8,7 +8,7 @@ - WORC.classification.metrics — WORC 3.4.2 documentation + WORC.classification.metrics — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/parameter_optimization.html b/WORC/doc/_build/html/_modules/WORC/classification/parameter_optimization.html index fe3f54d3..fb17b7d1 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/parameter_optimization.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/parameter_optimization.html @@ -8,7 +8,7 @@ - WORC.classification.parameter_optimization — WORC 3.4.2 documentation + WORC.classification.parameter_optimization — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/classification/trainclassifier.html b/WORC/doc/_build/html/_modules/WORC/classification/trainclassifier.html index 2b7377cf..bf3adfd2 100644 --- a/WORC/doc/_build/html/_modules/WORC/classification/trainclassifier.html +++ b/WORC/doc/_build/html/_modules/WORC/classification/trainclassifier.html @@ -8,7 +8,7 @@ - WORC.classification.trainclassifier — WORC 3.4.2 documentation + WORC.classification.trainclassifier — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/detectors/detectors.html b/WORC/doc/_build/html/_modules/WORC/detectors/detectors.html index 36b2a40e..b420e204 100644 --- a/WORC/doc/_build/html/_modules/WORC/detectors/detectors.html +++ b/WORC/doc/_build/html/_modules/WORC/detectors/detectors.html @@ -8,7 +8,7 @@ - WORC.detectors.detectors — WORC 3.4.2 documentation + WORC.detectors.detectors — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/exampledata/datadownloader.html b/WORC/doc/_build/html/_modules/WORC/exampledata/datadownloader.html index d6f3c75a..5854d271 100644 --- a/WORC/doc/_build/html/_modules/WORC/exampledata/datadownloader.html +++ b/WORC/doc/_build/html/_modules/WORC/exampledata/datadownloader.html @@ -8,7 +8,7 @@ - WORC.exampledata.datadownloader — WORC 3.4.2 documentation + WORC.exampledata.datadownloader — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/featureprocessing/Imputer.html b/WORC/doc/_build/html/_modules/WORC/featureprocessing/Imputer.html index fc0e437d..c4f2363c 100644 --- a/WORC/doc/_build/html/_modules/WORC/featureprocessing/Imputer.html +++ b/WORC/doc/_build/html/_modules/WORC/featureprocessing/Imputer.html @@ -8,7 +8,7 @@ - WORC.featureprocessing.Imputer — WORC 3.4.2 documentation + WORC.featureprocessing.Imputer — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/featureprocessing/Relief.html b/WORC/doc/_build/html/_modules/WORC/featureprocessing/Relief.html index 0a653930..4add0057 100644 --- a/WORC/doc/_build/html/_modules/WORC/featureprocessing/Relief.html +++ b/WORC/doc/_build/html/_modules/WORC/featureprocessing/Relief.html @@ -8,7 +8,7 @@ - WORC.featureprocessing.Relief — WORC 3.4.2 documentation + WORC.featureprocessing.Relief — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/featureprocessing/SelectGroups.html b/WORC/doc/_build/html/_modules/WORC/featureprocessing/SelectGroups.html index 06082e39..e2cfa1e9 100644 --- a/WORC/doc/_build/html/_modules/WORC/featureprocessing/SelectGroups.html +++ b/WORC/doc/_build/html/_modules/WORC/featureprocessing/SelectGroups.html @@ -8,7 +8,7 @@ - WORC.featureprocessing.SelectGroups — WORC 3.4.2 documentation + WORC.featureprocessing.SelectGroups — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/featureprocessing/SelectIndividuals.html b/WORC/doc/_build/html/_modules/WORC/featureprocessing/SelectIndividuals.html index 749ece2c..f428b473 100644 --- a/WORC/doc/_build/html/_modules/WORC/featureprocessing/SelectIndividuals.html +++ b/WORC/doc/_build/html/_modules/WORC/featureprocessing/SelectIndividuals.html @@ -8,7 +8,7 @@ - WORC.featureprocessing.SelectIndividuals — WORC 3.4.2 documentation + WORC.featureprocessing.SelectIndividuals — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/featureprocessing/StatisticalTestFeatures.html b/WORC/doc/_build/html/_modules/WORC/featureprocessing/StatisticalTestFeatures.html index fde8914b..26d45990 100644 --- a/WORC/doc/_build/html/_modules/WORC/featureprocessing/StatisticalTestFeatures.html +++ b/WORC/doc/_build/html/_modules/WORC/featureprocessing/StatisticalTestFeatures.html @@ -8,7 +8,7 @@ - WORC.featureprocessing.StatisticalTestFeatures — WORC 3.4.2 documentation + WORC.featureprocessing.StatisticalTestFeatures — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
@@ -273,7 +273,7 @@

Source code for WORC.featureprocessing.StatisticalTestFeatures

header = list() subheader = list() for i_name in label_name: - header.append(str(i_name[0])) + header.append(str(i_name)) header.append('') header.append('') header.append('') diff --git a/WORC/doc/_build/html/_modules/WORC/featureprocessing/StatisticalTestThreshold.html b/WORC/doc/_build/html/_modules/WORC/featureprocessing/StatisticalTestThreshold.html index 8e6c55d5..9ad3840e 100644 --- a/WORC/doc/_build/html/_modules/WORC/featureprocessing/StatisticalTestThreshold.html +++ b/WORC/doc/_build/html/_modules/WORC/featureprocessing/StatisticalTestThreshold.html @@ -8,7 +8,7 @@ - WORC.featureprocessing.StatisticalTestThreshold — WORC 3.4.2 documentation + WORC.featureprocessing.StatisticalTestThreshold — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/featureprocessing/VarianceThreshold.html b/WORC/doc/_build/html/_modules/WORC/featureprocessing/VarianceThreshold.html index 21eb34d3..0ad6b596 100644 --- a/WORC/doc/_build/html/_modules/WORC/featureprocessing/VarianceThreshold.html +++ b/WORC/doc/_build/html/_modules/WORC/featureprocessing/VarianceThreshold.html @@ -8,7 +8,7 @@ - WORC.featureprocessing.VarianceThreshold — WORC 3.4.2 documentation + WORC.featureprocessing.VarianceThreshold — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/plotting/compute_CI.html b/WORC/doc/_build/html/_modules/WORC/plotting/compute_CI.html index e66a8eb6..1affdc67 100644 --- a/WORC/doc/_build/html/_modules/WORC/plotting/compute_CI.html +++ b/WORC/doc/_build/html/_modules/WORC/plotting/compute_CI.html @@ -8,7 +8,7 @@ - WORC.plotting.compute_CI — WORC 3.4.2 documentation + WORC.plotting.compute_CI — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/plotting/linstretch.html b/WORC/doc/_build/html/_modules/WORC/plotting/linstretch.html index c09ed18b..0e20769f 100644 --- a/WORC/doc/_build/html/_modules/WORC/plotting/linstretch.html +++ b/WORC/doc/_build/html/_modules/WORC/plotting/linstretch.html @@ -8,7 +8,7 @@ - WORC.plotting.linstretch — WORC 3.4.2 documentation + WORC.plotting.linstretch — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/plotting/plot_ROC.html b/WORC/doc/_build/html/_modules/WORC/plotting/plot_ROC.html index 5988eda7..c32b0b4d 100644 --- a/WORC/doc/_build/html/_modules/WORC/plotting/plot_ROC.html +++ b/WORC/doc/_build/html/_modules/WORC/plotting/plot_ROC.html @@ -8,7 +8,7 @@ - WORC.plotting.plot_ROC — WORC 3.4.2 documentation + WORC.plotting.plot_ROC — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
@@ -776,6 +776,10 @@

Source code for WORC.plotting.plot_ROC

     if label_type is None:
         # Assume we want to have the first key
         label_type = prediction.keys()[0]
+    elif len(label_type.split(',')) != 1:
+        # Multiclass, just take the prediction label
+        label_type = prediction.keys()[0]
+
     N_1 = len(prediction[label_type].Y_train[0])
     N_2 = len(prediction[label_type].Y_test[0])
 
diff --git a/WORC/doc/_build/html/_modules/WORC/plotting/plot_barchart.html b/WORC/doc/_build/html/_modules/WORC/plotting/plot_barchart.html
index 341cdcdc..977cbaaf 100644
--- a/WORC/doc/_build/html/_modules/WORC/plotting/plot_barchart.html
+++ b/WORC/doc/_build/html/_modules/WORC/plotting/plot_barchart.html
@@ -8,7 +8,7 @@
   
   
   
-  WORC.plotting.plot_barchart — WORC 3.4.2 documentation
+  WORC.plotting.plot_barchart — WORC 3.4.3 documentation
   
 
   
@@ -62,7 +62,7 @@
             
             
               
- 3.4.2 + 3.4.3
@@ -232,7 +232,11 @@

Source code for WORC.plotting.plot_barchart

     if label_type is None:
         label_type = keys[0]
 
-    prediction = prediction[label_type]
+    try:
+        prediction = prediction[label_type]
+    except KeyError:
+        # Multiclass reroute
+        prediction = prediction[keys[0]]
 
     # Extract the parameter settings:
     parameters = dict()
diff --git a/WORC/doc/_build/html/_modules/WORC/plotting/plot_images.html b/WORC/doc/_build/html/_modules/WORC/plotting/plot_images.html
index 1e73883e..0bf577ea 100644
--- a/WORC/doc/_build/html/_modules/WORC/plotting/plot_images.html
+++ b/WORC/doc/_build/html/_modules/WORC/plotting/plot_images.html
@@ -8,7 +8,7 @@
   
   
   
-  WORC.plotting.plot_images — WORC 3.4.2 documentation
+  WORC.plotting.plot_images — WORC 3.4.3 documentation
   
 
   
@@ -62,7 +62,7 @@
             
             
               
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/plotting/plot_ranked_scores.html b/WORC/doc/_build/html/_modules/WORC/plotting/plot_ranked_scores.html index 8048a6f1..46eef16b 100644 --- a/WORC/doc/_build/html/_modules/WORC/plotting/plot_ranked_scores.html +++ b/WORC/doc/_build/html/_modules/WORC/plotting/plot_ranked_scores.html @@ -8,7 +8,7 @@ - WORC.plotting.plot_ranked_scores — WORC 3.4.2 documentation + WORC.plotting.plot_ranked_scores — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
@@ -285,7 +285,6 @@

Source code for WORC.plotting.plot_ranked_scores

# Read the inputs prediction = pd.read_hdf(estimator) - label_type = prediction.keys()[0] # NOTE: Assume we want to have the first key # Determine the predicted score per patient print('Determining score per patient.') @@ -435,49 +434,107 @@

Source code for WORC.plotting.plot_ranked_scores

scores = dict() truths = dict() - y_truths_flat = flatten_object(y_truths) - y_scores_flat = flatten_object(y_scores) - PIDs_scores_flat = flatten_object(PIDs_scores) + def aggregate_scores(y_truths_in, y_scores_in, PIDs_scores_in): + y_truths_flat = flatten_object(y_truths_in) + y_scores_flat = flatten_object(y_scores_in) + PIDs_scores_flat = flatten_object(PIDs_scores_in) + + for yt, ys, pid in zip(y_truths_flat, y_scores_flat, PIDs_scores_flat): + if pid not in scores.keys(): + # No scores yet for patient, create list + scores[pid] = list() + truths[pid] = yt + scores[pid].append(ys) + + # Take the mean for each patient and rank them + scores_means = {pid: np.mean(scores[pid]) for pid in scores.keys()} + + # Rank according to mean scores + ranking = np.argsort(list(scores_means.values())) + ranked_PIDs = [list(scores_means.keys())[r] for r in ranking] + + ranked_mean_scores = [scores_means[r] for r in ranked_PIDs] + ranked_scores = [scores[r] for r in ranked_PIDs] + ranked_truths = [truths[r] for r in ranked_PIDs] + return ranked_PIDs, ranked_truths, ranked_mean_scores, ranked_scores + + # Gather ground truth for each pid + pid_truths = dict() + for y, p in zip(y_truths, PIDs_scores): + for k, v in zip(p, y): + pid_truths[k] = v + + if len(label_type.split(',')) != 1: + # Multiclass + ranked_PIDs = dict() + ranked_truths = dict() + ranked_mean_scores = dict() + ranked_scores = dict() + total_scores = list() + means = list() + for lnum, label in enumerate(label_type.split(',')): + # Select only values for this label + y_truths_thislabel = np.asarray(y_truths)[:, :, lnum] + y_scores_thislabel = np.asarray(y_scores)[:, :, lnum] + + # Rank the patients and scores + ranked_PIDs_label, ranked_truths_label, ranked_mean_scores_label, ranked_scores_label =\ + aggregate_scores(y_truths_thislabel, y_scores_thislabel, PIDs_scores) + + ranked_PIDs[label] = ranked_PIDs_label + ranked_truths[label] = ranked_truths_label + ranked_mean_scores[label] = ranked_mean_scores_label + ranked_scores[label] = ranked_scores_label + + means.append(f"Mean_{label}") + total_scores.extend([f"Score_{label}_{i}" for i in range(max([len(score) for score in ranked_scores_label]))]) + + # Write output to csv + unique_pids = list(set(flatten_object(PIDs_scores))) + # FIXME: bug in scores, so only give the means + if output_csv is not None: + print("Writing output scores to CSV.") + header = ['PatientID', 'TrueLabel', 'Predicted'] + means #+ total_scores - for yt, ys, pid in zip(y_truths_flat, y_scores_flat, PIDs_scores_flat): - if pid not in scores.keys(): - # No scores yet for patient, create list - scores[pid] = list() - truths[pid] = yt - scores[pid].append(ys) - - # Take the mean for each patient and rank them - scores_means = dict() - maxlen = 0 - for pid in scores.keys(): - scores_means[pid] = np.mean(scores[pid]) - if len(scores[pid]) > maxlen: - maxlen = len(scores[pid]) + with open(output_csv, 'w') as csv_file: + writer = csv.writer(csv_file) + writer.writerow(header) - ranking = np.argsort(list(scores_means.values())) - ranked_PIDs = [list(scores_means.keys())[r] for r in ranking] + for pid in unique_pids: + pid_means = list() + pid_truth = pid_truths[pid] + pid_scores = list() + for lnum, label in enumerate(label_type.split(',')): + p_index = ranked_PIDs[label].index(pid) + pid_means.append(ranked_mean_scores[label][p_index]) + pid_scores.extend(ranked_scores[label][p_index]) - ranked_mean_scores = [scores_means[r] for r in ranked_PIDs] - ranked_scores = [scores[r] for r in ranked_PIDs] - ranked_truths = [truths[r] for r in ranked_PIDs] + towrite = [pid, str(pid_truth), np.argmax(pid_means)] + pid_means #+ pid_scores + writer.writerow(towrite) - # Write output to csv - if output_csv is not None: - print("Writing output scores to CSV.") - header = ['PatientID', 'TrueLabel', 'Probability'] - for i in range(0, maxlen): - header.append('Score' + str(i+1)) + else: + # Single Label + ranked_PIDs, ranked_truths, ranked_mean_scores, ranked_scores =\ + aggregate_scores(y_truths, y_scores, PIDs_scores) + + # Write output to csv + maxlen = max([len(score) for score in scores.values()]) + if output_csv is not None: + print("Writing output scores to CSV.") + header = ['PatientID', 'TrueLabel', 'Probability'] + for i in range(0, maxlen): + header.append('Score' + str(i+1)) - with open(output_csv, 'w') as csv_file: - writer = csv.writer(csv_file) - writer.writerow(header) + with open(output_csv, 'w') as csv_file: + writer = csv.writer(csv_file) + writer.writerow(header) - for pid, truth, smean, scores in zip(ranked_PIDs, ranked_truths, ranked_mean_scores, ranked_scores): - towrite = [str(pid), str(truth), str(smean)] - for s in scores: - towrite.append(str(s)) + for pid, truth, smean, scores in zip(ranked_PIDs, ranked_truths, ranked_mean_scores, ranked_scores): + towrite = [str(pid), str(truth), str(smean)] + for s in scores: + towrite.append(str(s)) - writer.writerow(towrite) + writer.writerow(towrite) return ranked_mean_scores, ranked_truths, ranked_PIDs
@@ -545,7 +602,7 @@

Source code for WORC.plotting.plot_ranked_scores

ensemble=ensemble, output_csv=output_csv) elif scores == 'percentages': - if prediction[label_type].config['CrossValidation']['Type'] == 'LOO': + if prediction[prediction.keys()[0]].config['CrossValidation']['Type'] == 'LOO': print('Cannot rank percentages for LOO, returning dummies.') ranked_scores = ranked_truths = ranked_PIDs = [] with open(output_csv, 'w') as csv_file: @@ -563,35 +620,41 @@

Source code for WORC.plotting.plot_ranked_scores

raise WORCKeyError(message) if output_zip is not None or output_itk is not None: - # Rerank the scores split per ground truth class: negative for 0, positive for 1 - ranked_scores_temp = list() - for l, p in zip(ranked_truths, ranked_scores): - if l == 0: - ranked_scores_temp.append(-p) - else: - ranked_scores_temp.append(p) - - ranked_scores = ranked_scores_temp - ranking = np.argsort(ranked_scores) - ranked_scores = [ranked_scores[r] for r in ranking] - ranked_truths = [ranked_truths[r] for r in ranking] - ranked_PIDs = [ranked_PIDs[r] for r in ranking] + # FIXME: check for multilabel by checking type + if type(ranked_scores) == list(): + # Rerank the scores split per ground truth class: negative for 0, positive for 1 + ranked_scores_temp = list() + for l, p in zip(ranked_truths, ranked_scores): + if l == 0: + ranked_scores_temp.append(-p) + else: + ranked_scores_temp.append(p) - # Convert to lower to later on overcome matching errors - ranked_PIDs = [i.lower() for i in ranked_PIDs] + ranked_scores = ranked_scores_temp + ranking = np.argsort(ranked_scores) + ranked_scores = [ranked_scores[r] for r in ranking] + ranked_truths = [ranked_truths[r] for r in ranking] + ranked_PIDs = [ranked_PIDs[r] for r in ranking] - if images: - plot_ranked_images(pinfo=pinfo, - label_type=label_type, - images=images, - segmentations=segmentations, - ranked_truths=ranked_truths, - ranked_scores=ranked_scores, - ranked_PIDs=ranked_PIDs, - output_zip=output_zip, - output_itk=output_itk, - scores=scores)
+ # Convert to lower to later on overcome matching errors + ranked_PIDs = [i.lower() for i in ranked_PIDs] + if images: + plot_ranked_images(pinfo=pinfo, + label_type=label_type, + images=images, + segmentations=segmentations, + ranked_truths=ranked_truths, + ranked_scores=ranked_scores, + ranked_PIDs=ranked_PIDs, + output_zip=output_zip, + output_itk=output_itk, + scores=scores) + else: + # Make dummy + if output_zip is not None: + zipfile.ZipFile(output_zip, + 'w', zipfile.ZIP_DEFLATED, allowZip64=True)
[docs]def example(): case = 'MESFIB' @@ -692,7 +755,12 @@

Source code for WORC.plotting.plot_ranked_scores

ranked_scores=ranked_scores, ranked_PIDs=ranked_PIDs, output_zip=output_zip, - scores=scores)
+ scores=scores) + else: + # Make dummy + if output_zip is not None: + zipfile.ZipFile(output_zip, + 'w', zipfile.ZIP_DEFLATED, allowZip64=True)
if __name__ == '__main__': diff --git a/WORC/doc/_build/html/_modules/WORC/plotting/scatterplot.html b/WORC/doc/_build/html/_modules/WORC/plotting/scatterplot.html index 3e4d5d96..e8c4be28 100644 --- a/WORC/doc/_build/html/_modules/WORC/plotting/scatterplot.html +++ b/WORC/doc/_build/html/_modules/WORC/plotting/scatterplot.html @@ -8,7 +8,7 @@ - WORC.plotting.scatterplot — WORC 3.4.2 documentation + WORC.plotting.scatterplot — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/processing/ExtractNLargestBlobsn.html b/WORC/doc/_build/html/_modules/WORC/processing/ExtractNLargestBlobsn.html index f565344f..9e845400 100644 --- a/WORC/doc/_build/html/_modules/WORC/processing/ExtractNLargestBlobsn.html +++ b/WORC/doc/_build/html/_modules/WORC/processing/ExtractNLargestBlobsn.html @@ -8,7 +8,7 @@ - WORC.processing.ExtractNLargestBlobsn — WORC 3.4.2 documentation + WORC.processing.ExtractNLargestBlobsn — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/processing/classes.html b/WORC/doc/_build/html/_modules/WORC/processing/classes.html index 18cea5d9..d5926857 100644 --- a/WORC/doc/_build/html/_modules/WORC/processing/classes.html +++ b/WORC/doc/_build/html/_modules/WORC/processing/classes.html @@ -8,7 +8,7 @@ - WORC.processing.classes — WORC 3.4.2 documentation + WORC.processing.classes — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/processing/label_processing.html b/WORC/doc/_build/html/_modules/WORC/processing/label_processing.html index 021457f9..b0e6bb8c 100644 --- a/WORC/doc/_build/html/_modules/WORC/processing/label_processing.html +++ b/WORC/doc/_build/html/_modules/WORC/processing/label_processing.html @@ -8,7 +8,7 @@ - WORC.processing.label_processing — WORC 3.4.2 documentation + WORC.processing.label_processing — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/CalcFeatures_test.html b/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/CalcFeatures_test.html index 24d11ac5..2786ef8d 100644 --- a/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/CalcFeatures_test.html +++ b/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/CalcFeatures_test.html @@ -8,7 +8,7 @@ - WORC.resources.fastr_tests.CalcFeatures_test — WORC 3.4.2 documentation + WORC.resources.fastr_tests.CalcFeatures_test — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/elastix_test.html b/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/elastix_test.html index 96eccd95..83b37df0 100644 --- a/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/elastix_test.html +++ b/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/elastix_test.html @@ -8,7 +8,7 @@ - WORC.resources.fastr_tests.elastix_test — WORC 3.4.2 documentation + WORC.resources.fastr_tests.elastix_test — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/segmentix_test.html b/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/segmentix_test.html index b3ae104d..711a6cd1 100644 --- a/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/segmentix_test.html +++ b/WORC/doc/_build/html/_modules/WORC/resources/fastr_tests/segmentix_test.html @@ -8,7 +8,7 @@ - WORC.resources.fastr_tests.segmentix_test — WORC 3.4.2 documentation + WORC.resources.fastr_tests.segmentix_test — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/tools/Elastix.html b/WORC/doc/_build/html/_modules/WORC/tools/Elastix.html index 5955d50d..e7cdbede 100644 --- a/WORC/doc/_build/html/_modules/WORC/tools/Elastix.html +++ b/WORC/doc/_build/html/_modules/WORC/tools/Elastix.html @@ -8,7 +8,7 @@ - WORC.tools.Elastix — WORC 3.4.2 documentation + WORC.tools.Elastix — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
diff --git a/WORC/doc/_build/html/_modules/WORC/tools/Evaluate.html b/WORC/doc/_build/html/_modules/WORC/tools/Evaluate.html index b21014c8..c5b8f9a5 100644 --- a/WORC/doc/_build/html/_modules/WORC/tools/Evaluate.html +++ b/WORC/doc/_build/html/_modules/WORC/tools/Evaluate.html @@ -8,7 +8,7 @@ - WORC.tools.Evaluate — WORC 3.4.2 documentation + WORC.tools.Evaluate — WORC 3.4.3 documentation @@ -62,7 +62,7 @@
- 3.4.2 + 3.4.3
@@ -190,7 +190,7 @@

Source code for WORC.tools.Evaluate

 
[docs]class Evaluate(object): """Build a network that evaluates the performance of an estimator.""" -
[docs] def __init__(self, label_type, modus='classification', ensemble=50, +
[docs] def __init__(self, label_type, modus='binary_classification', ensemble=50, scores='percentages', parent=None, features=None, fastr_plugin='LinearExecution', @@ -232,7 +232,7 @@

Source code for WORC.tools.Evaluate

 
[docs] def create_network(self): """Add evaluate components to network.""" # Create all nodes - if self.modus == 'classification': + if self.modus == 'binary_classification': self.node_ROC =\ self.network.create_node('worc/PlotROC:1.0', tool_version='1.0', id='plot_ROC', @@ -257,7 +257,7 @@

Source code for WORC.tools.Evaluate

                                      resources=ResourceLimit(memory='6G'),
                                      step_id='Evaluation')
 
-        if self.modus == 'classification':
+        if 'classification' in self.modus:
             self.node_STest =\
                 self.network.create_node('worc/StatisticalTestFeatures:1.0',
                                          tool_version='1.0',
@@ -294,7 +294,7 @@ 

Source code for WORC.tools.Evaluate

                                      step_id='Evaluation')
 
         # Create sinks
-        if self.modus == 'classification':
+        if self.modus == 'binary_classification':
             self.sink_ROC_PNG =\
                 self.network.create_sink('PNGFile', id='ROC_PNG',
                                          step_id='general_sinks')
@@ -332,7 +332,7 @@ 

Source code for WORC.tools.Evaluate

             self.network.create_sink('CSVFile', id='Hyperparameters_CSV',
                                      step_id='general_sinks')
 
-        if self.modus == 'classification':
+        if 'classification' in self.modus:
             self.sink_STest_CSV =\
                 self.network.create_sink('CSVFile',
                                          id='StatisticalTestFeatures_CSV',
@@ -373,7 +373,7 @@ 

Source code for WORC.tools.Evaluate

                                      step_id='general_sinks')
 
         # Create links to sinks
-        if self.modus == 'classification':
+        if self.modus == 'binary_classification':
             self.sink_ROC_PNG.input = self.node_ROC.outputs['ROC_png']
             self.sink_ROC_Tex.input = self.node_ROC.outputs['ROC_tex']
             self.sink_ROC_CSV.input = self.node_ROC.outputs['ROC_csv']
@@ -390,7 +390,7 @@ 

Source code for WORC.tools.Evaluate

 
         self.sink_Hyperparameters_CSV.input = self.node_Hyperparameters.outputs['output_csv']
 
-        if self.modus == 'classification':
+        if 'classification' in self.modus:
             self.sink_STest_CSV.input = self.node_STest.outputs['output_csv']
             self.sink_STest_PNG.input = self.node_STest.outputs['output_png']
             self.sink_STest_Tex.input = self.node_STest.outputs['output_tex']
@@ -457,7 +457,7 @@ 

Source code for WORC.tools.Evaluate