Mercurial > repos > bgruening > sklearn_model_validation
comparison model_validation.xml @ 12:86b57b062f96 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit d00173591e4a783a4c1cb2664e4bb192ab5414f7
| author | bgruening |
|---|---|
| date | Fri, 17 Aug 2018 12:24:20 -0400 |
| parents | 61844bce4115 |
| children | 10a9e2a63464 |
comparison
equal
deleted
inserted
replaced
| 11:61844bce4115 | 12:86b57b062f96 |
|---|---|
| 14 <configfiles> | 14 <configfiles> |
| 15 <inputs name="inputs" /> | 15 <inputs name="inputs" /> |
| 16 <configfile name="sklearn_model_validation_script"> | 16 <configfile name="sklearn_model_validation_script"> |
| 17 <![CDATA[ | 17 <![CDATA[ |
| 18 import sys | 18 import sys |
| 19 import os | |
| 19 import json | 20 import json |
| 20 import pandas | 21 import pandas |
| 21 import re | |
| 22 import ast | |
| 23 import pickle | |
| 24 import numpy as np | 22 import numpy as np |
| 25 import sklearn.feature_selection | |
| 26 from sklearn import preprocessing, model_selection, svm, linear_model, ensemble, naive_bayes, tree, neighbors | 23 from sklearn import preprocessing, model_selection, svm, linear_model, ensemble, naive_bayes, tree, neighbors |
| 27 from sklearn.pipeline import Pipeline | 24 from sklearn.pipeline import Pipeline |
| 28 | 25 |
| 29 @COLUMNS_FUNCTION@ | 26 execfile("$__tool_directory__/utils.py") |
| 30 @GET_ESTIMATOR_FUNCTION@ | 27 |
| 31 @FEATURE_SELECTOR_FUNCTION@ | 28 safe_eval = SafeEval() |
| 32 @SAFE_EVAL_FUNCTION@ | |
| 33 @GET_CV_FUNCTION@ | |
| 34 | |
| 35 | 29 |
| 36 input_json_path = sys.argv[1] | 30 input_json_path = sys.argv[1] |
| 37 with open(input_json_path, "r") as param_handler: | 31 with open(input_json_path, "r") as param_handler: |
| 38 params = json.load(param_handler) | 32 params = json.load(param_handler) |
| 39 | 33 |
| 72 ) | 66 ) |
| 73 y=y.ravel() | 67 y=y.ravel() |
| 74 | 68 |
| 75 options = params["model_validation_functions"]["options"] | 69 options = params["model_validation_functions"]["options"] |
| 76 options['cv'] = get_cv( options['cv'] ) | 70 options['cv'] = get_cv( options['cv'] ) |
| 77 if 'scoring' in options and options['scoring'] == '': | 71 options['n_jobs'] = N_JOBS |
| 78 options['scoring'] = None | 72 if 'scoring' in options: |
| 73 options['scoring'] = get_scoring(options['scoring']) | |
| 79 if 'pre_dispatch' in options and options['pre_dispatch'] == '': | 74 if 'pre_dispatch' in options and options['pre_dispatch'] == '': |
| 80 options['pre_dispatch'] = None | 75 options['pre_dispatch'] = None |
| 81 | 76 |
| 82 pipeline_steps = [] | 77 pipeline_steps = [] |
| 83 | 78 |
| 173 <when value="cross_validate"> | 168 <when value="cross_validate"> |
| 174 <expand macro="estimator_selector_all" /> | 169 <expand macro="estimator_selector_all" /> |
| 175 <section name="options" title="Other Options" expanded="false"> | 170 <section name="options" title="Other Options" expanded="false"> |
| 176 <!--groups--> | 171 <!--groups--> |
| 177 <expand macro="model_validation_common_options"/> | 172 <expand macro="model_validation_common_options"/> |
| 178 <expand macro="scoring"/> | 173 <expand macro="scoring_selection"/> |
| 179 <!--fit_params--> | 174 <!--fit_params--> |
| 180 <expand macro="pre_dispatch"/> | 175 <expand macro="pre_dispatch"/> |
| 181 </section> | 176 </section> |
| 182 <param name="return_type" type="select" label="Select a return type"> | 177 <param name="return_type" type="select" label="Select a return type"> |
| 183 <option value="test_score" selected="true">test_score</option> | 178 <option value="test_score" selected="true">test_score</option> |
| 202 <when value="cross_val_score"> | 197 <when value="cross_val_score"> |
| 203 <expand macro="estimator_selector_all" /> | 198 <expand macro="estimator_selector_all" /> |
| 204 <section name="options" title="Other Options" expanded="false"> | 199 <section name="options" title="Other Options" expanded="false"> |
| 205 <!--groups--> | 200 <!--groups--> |
| 206 <expand macro="model_validation_common_options"/> | 201 <expand macro="model_validation_common_options"/> |
| 207 <expand macro="scoring"/> | 202 <expand macro="scoring_selection"/> |
| 208 <!--fit_params--> | 203 <!--fit_params--> |
| 209 <expand macro="pre_dispatch"/> | 204 <expand macro="pre_dispatch"/> |
| 210 </section> | 205 </section> |
| 211 </when> | 206 </when> |
| 212 <when value="learning_curve"> | 207 <when value="learning_curve"> |
| 213 <expand macro="estimator_selector_all" /> | 208 <expand macro="estimator_selector_all" /> |
| 214 <section name="options" title="Other Options" expanded="false"> | 209 <section name="options" title="Other Options" expanded="false"> |
| 215 <!--groups--> | 210 <!--groups--> |
| 216 <expand macro="model_validation_common_options"/> | 211 <expand macro="model_validation_common_options"/> |
| 217 <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"/> | 212 <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"/> |
| 218 <expand macro="scoring"/> | 213 <expand macro="scoring_selection"/> |
| 219 <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"/> | 214 <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"/> |
| 220 <expand macro="pre_dispatch"/> | 215 <expand macro="pre_dispatch"/> |
| 221 <expand macro="shuffle" checked="false" label="shuffle" help="Whether to shuffle training data before taking prefixes"/> | 216 <expand macro="shuffle" checked="false" label="shuffle" help="Whether to shuffle training data before taking prefixes"/> |
| 222 <expand macro="random_state"/> | 217 <expand macro="random_state"/> |
| 223 </section> | 218 </section> |
| 230 <when value="permutation_test_score"> | 225 <when value="permutation_test_score"> |
| 231 <expand macro="estimator_selector_all" /> | 226 <expand macro="estimator_selector_all" /> |
| 232 <section name="options" title="Other Options" expanded="false"> | 227 <section name="options" title="Other Options" expanded="false"> |
| 233 <!--groups--> | 228 <!--groups--> |
| 234 <expand macro="model_validation_common_options"/> | 229 <expand macro="model_validation_common_options"/> |
| 235 <expand macro="scoring"/> | 230 <expand macro="scoring_selection"/> |
| 236 <param name="n_permutations" type="integer" value="100" optional="true" label="n_permutations" help="Number of times to permute y"/> | 231 <param name="n_permutations" type="integer" value="100" optional="true" label="n_permutations" help="Number of times to permute y"/> |
| 237 <expand macro="random_state"/> | 232 <expand macro="random_state"/> |
| 238 </section> | 233 </section> |
| 239 <param name="return_type" type="select" label="Select a return type"> | 234 <param name="return_type" type="select" label="Select a return type"> |
| 240 <option value="score" selected="true">score</option> | 235 <option value="score" selected="true">score</option> |
| 247 <section name="options" title="Other Options" expanded="false"> | 242 <section name="options" title="Other Options" expanded="false"> |
| 248 <param name="param_name" type="text" value="gamma" label="param_name" help="Name of the parameter that will be varied"/> | 243 <param name="param_name" type="text" value="gamma" label="param_name" help="Name of the parameter that will be varied"/> |
| 249 <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."/> | 244 <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."/> |
| 250 <!--groups--> | 245 <!--groups--> |
| 251 <expand macro="model_validation_common_options"/> | 246 <expand macro="model_validation_common_options"/> |
| 252 <expand macro="scoring"/> | 247 <expand macro="scoring_selection"/> |
| 253 <expand macro="pre_dispatch"/> | 248 <expand macro="pre_dispatch"/> |
| 254 </section> | 249 </section> |
| 255 <param name="return_type" type="select" label="Select a return type"> | 250 <param name="return_type" type="select" label="Select a return type"> |
| 256 <option value="train_scores" selected="true">train_scores</option> | 251 <option value="train_scores" selected="true">train_scores</option> |
| 257 <option value="test_scores">test_scores</option> | 252 <option value="test_scores">test_scores</option> |
| 318 </test> | 313 </test> |
| 319 <test> | 314 <test> |
| 320 <param name="selected_function" value="validation_curve"/> | 315 <param name="selected_function" value="validation_curve"/> |
| 321 <param name="selected_module" value="svm"/> | 316 <param name="selected_module" value="svm"/> |
| 322 <param name="selected_estimator" value="SVC"/> | 317 <param name="selected_estimator" value="SVC"/> |
| 323 <param name="text_params" value="'kernel': 'linear'"/> | 318 <param name="text_params" value="kernel='linear'"/> |
| 324 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> | 319 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> |
| 325 <param name="header1" value="true" /> | 320 <param name="header1" value="true" /> |
| 326 <param name="selected_column_selector_option" value="all_columns"/> | 321 <param name="selected_column_selector_option" value="all_columns"/> |
| 327 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> | 322 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> |
| 328 <param name="header2" value="true" /> | 323 <param name="header2" value="true" /> |
