Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nr_of_processes issues #81

Open
blemasso opened this issue Sep 5, 2023 · 2 comments
Open

nr_of_processes issues #81

blemasso opened this issue Sep 5, 2023 · 2 comments

Comments

@blemasso
Copy link

blemasso commented Sep 5, 2023

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'

@RLeenings
Copy link
Collaborator

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

@blemasso
Copy link
Author

Hi,

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

Benjamin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants