diff search_model_validation.py @ 1:0fd7d8e90e2a draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ba6a47bdf76bbf4cb276206ac1a8cbf61332fd16"
author bgruening
date Fri, 13 Sep 2019 12:19:45 -0400
parents 1046cf73236b
children c3813c64d678
line wrap: on
line diff
--- a/search_model_validation.py	Fri Aug 09 07:14:22 2019 -0400
+++ b/search_model_validation.py	Fri Sep 13 12:19:45 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,