wwu-mmll/photonai

nr_of_processes issues

Opened this issue · 2 comments

hi,

I have some difficulty to run my pipeline using the several processes (via the parameters nr_of_processes).
If I try to run the following code with nr_of_processes = 6, I have this error :
and I have to issue if I do not set the parameter nr_of_processes (but I takes much more times :) )

thank you for your help !
Benjamin

code used :

Define hyperpipe

hyperpipe = Hyperpipe('PHOTONAI',
project_folder = project_folder,
optimizer="grid_search",
metrics=['accuracy', 'sensitivity', 'specificity', 'auc','balanced_accuracy'],
best_config_metric='balanced_accuracy',
outer_cv = RepeatedStratifiedKFold(n_splits=6, n_repeats=1, random_state=seed),
inner_cv = RepeatedStratifiedKFold(n_splits=5, n_repeats=1, random_state=seed),
random_seed=seed,
nr_of_processes = 6)

tested_methods = Categorical(['RandomOverSampler'])

hyperpipe += PipelineElement('ImbalancedDataTransformer',
hyperparameters={'method_name': tested_methods}, test_disabled=False)
hyperpipe+=PipelineElement('MinMaxScaler')
hyperpipe += PipelineElement("SelectKBest",
test_disabled=False, k=4)

hyperpipe += PipelineElement("SVC", hyperparameters={'C': FloatRange(0.5, 2), 'kernel': ['linear', 'rbf'], 'random_state':seed}, gamma='scale', max_iter=1000000)

hyperpipe.fit(features, outcome)

error

Finished all outer fold computations.
'NoneType' object has no attribute 'best_config_score'
Traceback (most recent call last):
File "/data_local/data_ssd/lemassob/Code/photonai/venv_photonai/lib/python3.10/site-packages/photonai/base/hyperpipe.py", line 1113, in fit
self._finalize_optimization()
File "/data_local/data_ssd/lemassob/Code/photonai/venv_photonai/lib/python3.10/site-packages/photonai/base/hyperpipe.py", line 882, in _finalize_optimization
MDBHelper.aggregate_metrics_for_outer_folds(self.results.outer_folds, self.optimization.metrics)
File "/data_local/data_ssd/lemassob/Code/photonai/venv_photonai/lib/python3.10/site-packages/photonai/processing/results_structure.py", line 282, in aggregate_metrics_for_outer_folds
folds = [fold.best_config.best_config_score for fold in outer_folds]
File "/data_local/data_ssd/lemassob/Code/photonai/venv_photonai/lib/python3.10/site-packages/photonai/processing/results_structure.py", line 282, in
folds = [fold.best_config.best_config_score for fold in outer_folds]
AttributeError: 'NoneType' object has no attribute 'best_config_score'

Dear Benjamin,
thanks for raising this issue.
Do you run the code in a jupyter/CoLab notebook?

Hi,

No I ran the code directly from a python script (.py).

Benjamin