diff stacking_ensembles.py @ 21:14fa42b095c4 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ea12f973df4b97a2691d9e4ce6bf6fae59d57717"
author bgruening
date Sat, 01 May 2021 01:53:41 +0000
parents a5665e1b06b0
children b878e4cdd63a
line wrap: on
line diff
--- a/stacking_ensembles.py	Tue Apr 13 22:52:20 2021 +0000
+++ b/stacking_ensembles.py	Sat May 01 01:53:41 2021 +0000
@@ -8,8 +8,8 @@
 import mlxtend.classifier
 import mlxtend.regressor
 import pandas as pd
-from galaxy_ml.utils import get_cv, get_estimator, get_search_params, load_model
-
+from galaxy_ml.utils import (get_cv, get_estimator, get_search_params,
+                             load_model)
 
 warnings.filterwarnings("ignore")
 
@@ -62,7 +62,9 @@
             with open(meta_path, "rb") as f:
                 meta_estimator = load_model(f)
         else:
-            estimator_json = params["algo_selection"]["meta_estimator"]["estimator_selector"]
+            estimator_json = params["algo_selection"]["meta_estimator"][
+                "estimator_selector"
+            ]
             meta_estimator = get_estimator(estimator_json)
 
     options = params["algo_selection"]["options"]
@@ -89,10 +91,14 @@
         ensemble_estimator = klass(base_estimators, **options)
 
     elif mod == mlxtend.classifier:
-        ensemble_estimator = klass(classifiers=base_estimators, meta_classifier=meta_estimator, **options)
+        ensemble_estimator = klass(
+            classifiers=base_estimators, meta_classifier=meta_estimator, **options
+        )
 
     else:
-        ensemble_estimator = klass(regressors=base_estimators, meta_regressor=meta_estimator, **options)
+        ensemble_estimator = klass(
+            regressors=base_estimators, meta_regressor=meta_estimator, **options
+        )
 
     print(ensemble_estimator)
     for base_est in base_estimators: