diff search_model_validation.py @ 27:8e49f26b14d3 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ba6a47bdf76bbf4cb276206ac1a8cbf61332fd16"
author bgruening
date Fri, 13 Sep 2019 12:10:41 -0400
parents 9bb505eafac9
children 64b771b1471a
line wrap: on
line diff
--- a/search_model_validation.py	Fri Aug 09 07:06:17 2019 -0400
+++ b/search_model_validation.py	Fri Sep 13 12:10:41 2019 -0400
@@ -213,6 +213,16 @@
     with open(inputs, 'r') as param_handler:
         params = json.load(param_handler)
 
+    # conflict param checker
+    if params['outer_split']['split_mode'] == 'nested_cv' \
+            and params['save'] != 'nope':
+        raise ValueError("Save best estimator is not possible for nested CV!")
+
+    if not (params['search_schemes']['options']['refit']) \
+            and params['save'] != 'nope':
+        raise ValueError("Save best estimator is not possible when refit "
+                         "is False!")
+
     params_builder = params['search_schemes']['search_params_builder']
 
     with open(infile_estimator, 'rb') as estimator_handler:
@@ -542,7 +552,6 @@
             del main_est.validation_data
             if getattr(main_est, 'data_generator_', None):
                 del main_est.data_generator_
-                del main_est.data_batch_generator
 
         with open(outfile_object, 'wb') as output_handler:
             pickle.dump(best_estimator_, output_handler,