facade Package

facade Package

basicworc Module

class WORC.facade.basicworc.BasicWORC(**kwargs)[source]

Bases: WORC.facade.simpleworc.SimpleWORC

Facade around the main WORC object for simple interaction.

Based upon the SimpleWORC object, but with additional functionality: - Sources of WORC (e.g. images_train, segmentations_train, …)

can be directly assessed.

Please also see the WORCTutorial Github.

__init__(name='WORC')[source]

Initialize SimpleWORC object.

name: string, default WORC

String to identify name of experiments. Will be used in the temporary files and outputs.

__module__ = 'WORC.facade.basicworc'
execute()[source]

Execute the experiment.

Before executing the actual experiment, this function will first run several validators and check the provided setup to make sure some of the most common made error are caught before running the experiment.

simpleworc Module

class WORC.facade.simpleworc.SimpleWORC(**kwargs)[source]

Bases: object

Facade around the main WORC object for simple interaction.

Please also see the WORCTutorial Github.

__dict__ = mappingproxy({'__module__': 'WORC.facade.simpleworc', '__doc__': 'Facade around the main WORC object for simple interaction.\n\n Please also see the `WORCTutorial Github <https://github.com/MStarmans91/WORCTutorial/>`_.\n ', '__init__': <function SimpleWORC.__init__>, 'features_from_this_directory': <function SimpleWORC.features_from_this_directory>, 'images_from_this_directory': <function SimpleWORC.images_from_this_directory>, 'segmentations_from_this_directory': <function SimpleWORC.segmentations_from_this_directory>, 'labels_from_this_file': <function SimpleWORC.labels_from_this_file>, 'semantics_from_this_file': <function SimpleWORC.semantics_from_this_file>, 'predict_labels': <function SimpleWORC.predict_labels>, '_set_and_validate_estimators': <function SimpleWORC._set_and_validate_estimators>, 'count_num_subjects': <function SimpleWORC.count_num_subjects>, '_validate': <function SimpleWORC._validate>, 'execute': <function SimpleWORC.execute>, 'binary_classification': <function SimpleWORC.binary_classification>, 'regression': <function SimpleWORC.regression>, 'survival': <function SimpleWORC.survival>, 'add_config_overrides': <function SimpleWORC.add_config_overrides>, 'add_evaluation': <function SimpleWORC.add_evaluation>, 'set_tmpdir': <function SimpleWORC.set_tmpdir>, 'set_multicore_execution': <function SimpleWORC.set_multicore_execution>, 'features_from_radiomix_xlsx': <function SimpleWORC.features_from_radiomix_xlsx>, '__dict__': <attribute '__dict__' of 'SimpleWORC' objects>, '__weakref__': <attribute '__weakref__' of 'SimpleWORC' objects>})
__init__(name='WORC')[source]

Initialize SimpleWORC object.

name: string, default WORC

String to identify name of experiments. Will be used in the temporary files and outputs.

__module__ = 'WORC.facade.simpleworc'
__weakref__

list of weak references to the object (if defined)

add_config_overrides(config)[source]

Add manual overrides for the WORC configuration.

For a full list of options, see the WORC Config chapter for allowed options.

config: dictionary

Determine which options to override with which values.

add_evaluation(selected_label=0)[source]

Add the evaluation workflow to the standard WORC workflow.

Adds several evaluation measures, including:

  • Computation of 95% confidence intervals for performance

  • Univariate testing of features

  • ROC curve with confidence bands construction

  • Ranking of patients based on percentage / posterior

  • Decompositions (e.g. PCA, t-SNE)

See the WORC documentation for additional info.

selected_label: integer, default 0

Determine for which of the labels to be predicted the evaluate workflow should be executed.

binary_classification(estimators=None, scoring_method='f1_weighted', coarse=True)[source]

Tell WORC do to a binary classification experiment.

estimators: list

List of strings with names of valid estimators. See the WORC Config chapter for allowed options.

If coarse, only an SVM will be used. If not, the default full config will be used.

scoring_method: string, default f1

Name of the scoring method used to rank the workflows. See the WORC Config chapter for allowed options.

coarse: boolean, default True

Determine whether to do a coarse or full experiment.

count_num_subjects()[source]

Count the number of subjects in the experiment.

execute()[source]

Execute the experiment.

Before executing the actual experiment, this function will first run several validators and check the provided setup to make sure some of the most common made error are caught before running the experiment.

features_from_radiomix_xlsx(feature_file)[source]

Use a feature file which is generated by the OncoRadiomics Radiomix tool.

features_from_this_directory(directory, feature_file_name='features.hdf5', glob='*/', is_training=True)[source]

Use features from a directory as sources in WORC.

SimpleWORC uses a directory glob to look for files meeting the requirements to include, based on the input parameters.

Example: When using “directory = C:UsersMyNameFeatureFolder”, features_from_this_directory will include all features.hdf5 files from all subfolders in the directory.

directory: string

Identifies the root directory in which to search for feature files.

feature_file_name: string, default features.hdf5

Name of the files which will be included. Can include wildcards (*).

glob: string, default */

Identify the search string to be used in the glob. Can include wildcards (*).

is_training: Boolean, default True

Identify whether these features should be used in the training or test dataset.

images_from_this_directory(directory, image_file_name='image.nii.gz', glob='*/', is_training=True)[source]

Use images from a directory as sources in WORC.

SimpleWORC uses a directory glob to look for files meeting the requirements to include, based on the input parameters.

Example: When using “directory = C:UsersMyNameImageFolder”, images_from_this_directory will include all image.nii.gz files from all subfolders in the directory.

directory: string

Identifies the root directory in which to search for image files.

image_file_name: string, default image.nii.gz

Name of the files which will be included. Can include wildcards (*).

glob: string, default */

Identify the search string to be used in the glob. Can include wildcards (*).

is_training: Boolean, default True

Identify whether these images should be used in the training or test dataset.

labels_from_this_file(file_path, is_training=True)[source]

Define which file should be used by WORC to extract the object labels.

Should be a .csv or .txt file: see the WORC user manual for more details on the formatting of this file.

file_path: basestring

Location of the file to be used as label file. Can be a .csv or .txt file.

is_training: Boolean, default True

Identify whether this label file should be used in the training or test dataset.

predict_labels(label_names)[source]

Determine which label(s) to predict in your experiments.

The labels(s) you want to predict should be given in strings and should be included in the header of your labels_from_this_file csv. Note that you therefore first need to use that function to determine which label file to use, and afterwards use this function to select one of the headers / columns containing the actual label.

label_names: list

List of strings containing the label name(s) to predict. For each label, a separate (classification) model will be created, or, if a multilabel experiment is run, a singel multiclass / multilabel classification model

regression(estimators=None, scoring_method='r2', coarse=True)[source]

Tell WORC do to a regression experiment.

estimators: list

List of strings with names of valid estimators. See the WORC Config chapter for allowed options.

If coarse, only SVR will be used. If not, the default full config will be used.

scoring_method: string, default r2

Name of the scoring method used to rank the workflows. See the WORC Config chapter for allowed options.

coarse: boolean, default True

Determine whether to do a coarse or full experiment.

segmentations_from_this_directory(directory, segmentation_file_name='segmentation.nii.gz', glob='*/', is_training=True)[source]

Use segmentations from a directory as sources in WORC.

SimpleWORC uses a directory glob to look for files meeting the requirements to include, based on the input parameters.

Example: When using “directory = C:UsersMyNameSegmentationFolder”, segmentations_from_this_directory will include all segmentation.nii.gz files from all subfolders in the directory.

directory: string

Identifies the root directory in which to search for segmentation files.

segmentation_file_name: string, default segmentation.nii.gz

Name of the files which will be included. Can include wildcards (*).

glob: string, default */

Identify the search string to be used in the glob. Can include wildcards (*).

is_training: Boolean, default True

Identify whether these segmentations should be used in the training or test dataset.

semantics_from_this_file(file_path, is_training=True)[source]

Define which file should be used by WORC to extract the semantic features.

The values in these file can be used as semantic, i.e. non-computational, features in WORC. Should be a .csv file: see the WORC user manual for more details on the formatting of this file.

file_path: basestring

Location of the file to be used as semantics file. Can be a .csv or .txt file.

is_training: Boolean, default True

Identify whether this semantics file should be used in the training or test dataset.

set_multicore_execution()[source]

“Execute experiment in multicore mode.

By default, SimpleWORC executes experiments in LinearExecution mode, meaning that only a single core will be used and jobs are executed in series. When multicore mode is enabled, jobs are parallellized over all available cores, which majorly speeds up the computation.

Note: SimpleWORC has an automatic detector for the BIGR and Cartesius cluster. Hence, on those clusters, do not use the multicore execution, as this will overwrite the changes applied by the detectors.

set_tmpdir(tmpdir)[source]

Set a directory for storing temporary files from the experiment.

If not specified, the default fastr tmpdir is used, see fastr.config.mounts['tmp'] .

survival(estimators, scoring_method, coarse=True)[source]

Tell WORC do to a regression experiment. Not implemented yet.