Skip to content

Commit

Permalink
Merge pull request #60 from MStarmans91/development
Browse files Browse the repository at this point in the history
Release version 3.4.3
  • Loading branch information
MStarmans91 committed Jun 2, 2021
2 parents 375e768 + c18cc1a commit a16f8fa
Show file tree
Hide file tree
Showing 106 changed files with 1,427 additions and 796 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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_*
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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=
13 changes: 12 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <http://keepachangelog.com/>`_
and this project adheres to `Semantic Versioning <http://semver.org/>`_

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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# WORC v3.4.2
# WORC v3.4.3
## Workflow for Optimal Radiomics Classification

## Information
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WORC v3.4.2
WORC v3.4.3
===========

Workflow for Optimal Radiomics Classification
Expand Down
12 changes: 4 additions & 8 deletions WORC/WORC.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions WORC/classification/crossval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 8 additions & 0 deletions WORC/classification/fitandscore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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',
Expand Down
Binary file modified WORC/doc/_build/doctrees/autogen/WORC.doctree
Binary file not shown.
Binary file modified WORC/doc/_build/doctrees/autogen/WORC.facade.doctree
Binary file not shown.
Binary file modified WORC/doc/_build/doctrees/autogen/WORC.tools.doctree
Binary file not shown.
Binary file modified WORC/doc/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified WORC/doc/_build/doctrees/static/changelog.doctree
Binary file not shown.
Binary file modified WORC/doc/_build/doctrees/static/configuration.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion WORC/doc/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions WORC/doc/_build/html/_modules/WORC/IOparser/config_WORC.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.IOparser.config_WORC &mdash; WORC 3.4.2 documentation</title>
<title>WORC.IOparser.config_WORC &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.IOparser.config_io_classifier &mdash; WORC 3.4.2 documentation</title>
<title>WORC.IOparser.config_io_classifier &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.IOparser.config_preprocessing &mdash; WORC 3.4.2 documentation</title>
<title>WORC.IOparser.config_preprocessing &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.IOparser.config_segmentix &mdash; WORC 3.4.2 documentation</title>
<title>WORC.IOparser.config_segmentix &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
4 changes: 2 additions & 2 deletions WORC/doc/_build/html/_modules/WORC/IOparser/file_io.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.IOparser.file_io &mdash; WORC 3.4.2 documentation</title>
<title>WORC.IOparser.file_io &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
16 changes: 6 additions & 10 deletions WORC/doc/_build/html/_modules/WORC/WORC.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.WORC &mdash; WORC 3.4.2 documentation</title>
<title>WORC.WORC &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down Expand Up @@ -584,12 +584,7 @@ <h1>Source code for WORC.WORC</h1><div class="highlight"><pre>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;Classification&#39;</span><span class="p">][</span><span class="s1">&#39;fastr&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;True&#39;</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;Classification&#39;</span><span class="p">][</span><span class="s1">&#39;fastr_plugin&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fastr_plugin</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;Classification&#39;</span><span class="p">][</span><span class="s1">&#39;classifiers&#39;</span><span class="p">]</span> <span class="o">=</span>\
<span class="s1">&#39;SVM, SVM, SVM, SVM, SVM, SVM, SVM, SVM, SVM, &#39;</span> <span class="o">+</span>\
<span class="s1">&#39;RF, RF, RF, &#39;</span> <span class="o">+</span>\
<span class="s1">&#39;LR, LR, LR, &#39;</span> <span class="o">+</span>\
<span class="s1">&#39;LDA, LDA, LDA, &#39;</span> <span class="o">+</span>\
<span class="s1">&#39;QDA, QDA, QDA, &#39;</span> <span class="o">+</span>\
<span class="s1">&#39;GaussianNB, GaussianNB, GaussianNB, &#39;</span> <span class="o">+</span>\
<span class="s1">&#39;SVM, RF, LR, LDA, QDA, GaussianNB, &#39;</span> <span class="o">+</span>\
<span class="s1">&#39;AdaBoostClassifier, &#39;</span> <span class="o">+</span>\
<span class="s1">&#39;XGBClassifier&#39;</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;Classification&#39;</span><span class="p">][</span><span class="s1">&#39;max_iter&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;100000&#39;</span>
Expand Down Expand Up @@ -637,7 +632,7 @@ <h1>Source code for WORC.WORC</h1><div class="highlight"><pre>
<span class="c1"># Hyperparameter optimization options</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;HyperOptimization&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;HyperOptimization&#39;</span><span class="p">][</span><span class="s1">&#39;scoring_method&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;f1_weighted&#39;</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;HyperOptimization&#39;</span><span class="p">][</span><span class="s1">&#39;test_size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;0.15&#39;</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;HyperOptimization&#39;</span><span class="p">][</span><span class="s1">&#39;test_size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;0.2&#39;</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;HyperOptimization&#39;</span><span class="p">][</span><span class="s1">&#39;n_splits&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;5&#39;</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;HyperOptimization&#39;</span><span class="p">][</span><span class="s1">&#39;N_iterations&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;1000&#39;</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;HyperOptimization&#39;</span><span class="p">][</span><span class="s1">&#39;n_jobspercore&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;500&#39;</span> <span class="c1"># only relevant when using fastr in classification</span>
Expand Down Expand Up @@ -1147,6 +1142,7 @@ <h1>Source code for WORC.WORC</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">links_C1_test</span><span class="p">[</span><span class="n">label</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">classify</span><span class="o">.</span><span class="n">inputs</span><span class="p">[</span><span class="s1">&#39;features_test&#39;</span><span class="p">][</span><span class="nb">str</span><span class="p">(</span><span class="n">label</span><span class="p">)]</span> <span class="o">&lt;&lt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources_features_test</span><span class="p">[</span><span class="n">label</span><span class="p">]</span><span class="o">.</span><span class="n">output</span>
<span class="bp">self</span><span class="o">.</span><span class="n">links_C1_test</span><span class="p">[</span><span class="n">label</span><span class="p">]</span><span class="o">.</span><span class="n">collapse</span> <span class="o">=</span> <span class="s1">&#39;test&#39;</span>


<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">WORCexceptions</span><span class="o">.</span><span class="n">WORCIOError</span><span class="p">(</span><span class="s2">&quot;Please provide labels.&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
Expand Down Expand Up @@ -1934,7 +1930,7 @@ <h1>Source code for WORC.WORC</h1><div class="highlight"><pre>

<span class="bp">self</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">source_data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sink_data</span><span class="p">,</span> <span class="n">execution_plugin</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fastr_plugin</span><span class="p">,</span> <span class="n">tmpdir</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fastr_tmpdir</span><span class="p">)</span></div>

<div class="viewcode-block" id="WORC.add_evaluation"><a class="viewcode-back" href="../../autogen/WORC.html#WORC.WORC.WORC.add_evaluation">[docs]</a> <span class="k">def</span> <span class="nf">add_evaluation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label_type</span><span class="p">,</span> <span class="n">modus</span><span class="o">=</span><span class="s1">&#39;classification&#39;</span><span class="p">):</span>
<div class="viewcode-block" id="WORC.add_evaluation"><a class="viewcode-back" href="../../autogen/WORC.html#WORC.WORC.WORC.add_evaluation">[docs]</a> <span class="k">def</span> <span class="nf">add_evaluation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label_type</span><span class="p">,</span> <span class="n">modus</span><span class="o">=</span><span class="s1">&#39;binary_classification&#39;</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Add branch for evaluation of performance to network.</span>

<span class="sd"> Note: should be done after build, before set:</span>
Expand Down
4 changes: 2 additions & 2 deletions WORC/doc/_build/html/_modules/WORC/addexceptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.addexceptions &mdash; WORC 3.4.2 documentation</title>
<title>WORC.addexceptions &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.classification.AdvancedSampler &mdash; WORC 3.4.2 documentation</title>
<title>WORC.classification.AdvancedSampler &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.classification.ObjectSampler &mdash; WORC 3.4.2 documentation</title>
<title>WORC.classification.ObjectSampler &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.classification.RankedSVM &mdash; WORC 3.4.2 documentation</title>
<title>WORC.classification.RankedSVM &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.classification.SearchCV &mdash; WORC 3.4.2 documentation</title>
<title>WORC.classification.SearchCV &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WORC.classification.construct_classifier &mdash; WORC 3.4.2 documentation</title>
<title>WORC.classification.construct_classifier &mdash; WORC 3.4.3 documentation</title>



Expand Down Expand Up @@ -62,7 +62,7 @@


<div class="version">
3.4.2
3.4.3
</div>


Expand Down
Loading

0 comments on commit a16f8fa

Please sign in to comment.