diff model_validation.xml @ 12:2c1851992069 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit d00173591e4a783a4c1cb2664e4bb192ab5414f7
author bgruening
date Fri, 17 Aug 2018 12:30:18 -0400
parents e4ab6b0bdf37
children badd86b9ce24
line wrap: on
line diff
--- a/model_validation.xml	Tue Aug 07 05:48:38 2018 -0400
+++ b/model_validation.xml	Fri Aug 17 12:30:18 2018 -0400
@@ -16,22 +16,16 @@
         <configfile name="sklearn_model_validation_script">
             <![CDATA[
 import sys
+import os
 import json
 import pandas
-import re
-import ast
-import pickle
 import numpy as np
-import sklearn.feature_selection
 from sklearn import preprocessing, model_selection, svm, linear_model, ensemble, naive_bayes, tree, neighbors
 from sklearn.pipeline import Pipeline
 
-@COLUMNS_FUNCTION@
-@GET_ESTIMATOR_FUNCTION@
-@FEATURE_SELECTOR_FUNCTION@
-@SAFE_EVAL_FUNCTION@
-@GET_CV_FUNCTION@
+execfile("$__tool_directory__/utils.py")
 
+safe_eval = SafeEval()
 
 input_json_path = sys.argv[1]
 with open(input_json_path, "r") as param_handler:
@@ -74,8 +68,9 @@
 
 options = params["model_validation_functions"]["options"]
 options['cv'] = get_cv( options['cv'] )
-if 'scoring' in options and options['scoring'] == '':
-    options['scoring'] = None
+options['n_jobs'] = N_JOBS
+if 'scoring' in options:
+    options['scoring'] = get_scoring(options['scoring'])
 if 'pre_dispatch' in options and options['pre_dispatch'] == '':
     options['pre_dispatch'] = None
 
@@ -175,7 +170,7 @@
                 <section name="options" title="Other Options" expanded="false">
                     <!--groups-->
                     <expand macro="model_validation_common_options"/>
-                    <expand macro="scoring"/>
+                    <expand macro="scoring_selection"/>
                     <!--fit_params-->
                     <expand macro="pre_dispatch"/>
                 </section>
@@ -204,7 +199,7 @@
                 <section name="options" title="Other Options" expanded="false">
                     <!--groups-->
                     <expand macro="model_validation_common_options"/>
-                    <expand macro="scoring"/>
+                    <expand macro="scoring_selection"/>
                     <!--fit_params-->
                     <expand macro="pre_dispatch"/>
                 </section>
@@ -215,7 +210,7 @@
                     <!--groups-->
                     <expand macro="model_validation_common_options"/>
                     <param argument="train_sizes" type="text" value="np.linspace(0.1, 1.0, 5)" label="train_sizes" help="Relative or absolute numbers of training examples that will be used to generate the learning curve"/>
-                    <expand macro="scoring"/>
+                    <expand macro="scoring_selection"/>
                     <param argument="exploit_incremental_learning" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolfalse" checked="false" label="exploit_incremental_learning" help="Whether to apply incremental learning to speed up fitting of the estimator if supported"/>
                     <expand macro="pre_dispatch"/>
                     <expand macro="shuffle" checked="false" label="shuffle" help="Whether to shuffle training data before taking prefixes"/>
@@ -232,7 +227,7 @@
                 <section name="options" title="Other Options" expanded="false">
                     <!--groups-->
                     <expand macro="model_validation_common_options"/>
-                    <expand macro="scoring"/>
+                    <expand macro="scoring_selection"/>
                     <param name="n_permutations" type="integer" value="100" optional="true" label="n_permutations" help="Number of times to permute y"/>
                     <expand macro="random_state"/>
                 </section>
@@ -249,7 +244,7 @@
                     <param name="param_range" type="text" value="np.logspace(-6, -1, 5)" label="param_range" help="The values of the parameter that will be evaluated."/>
                     <!--groups-->                    
                     <expand macro="model_validation_common_options"/>
-                    <expand macro="scoring"/>
+                    <expand macro="scoring_selection"/>
                     <expand macro="pre_dispatch"/>
                 </section>
                 <param name="return_type" type="select" label="Select a return type">
@@ -320,7 +315,7 @@
             <param name="selected_function" value="validation_curve"/>
             <param name="selected_module" value="svm"/>
             <param name="selected_estimator" value="SVC"/>
-            <param name="text_params" value="'kernel': 'linear'"/>
+            <param name="text_params" value="kernel='linear'"/>
             <param name="infile1" value="regression_X.tabular" ftype="tabular"/>
             <param name="header1" value="true" />
             <param name="selected_column_selector_option" value="all_columns"/>