Mercurial > repos > bgruening > sklearn_model_validation
comparison model_validation.xml @ 9:2593ba492276 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 76583c1fcd9d06a4679cc46ffaee44117b9e22cd
| author | bgruening |
|---|---|
| date | Sat, 04 Aug 2018 12:18:01 -0400 |
| parents | 5f78d3786bfc |
| children | 61844bce4115 |
comparison
equal
deleted
inserted
replaced
| 8:5f78d3786bfc | 9:2593ba492276 |
|---|---|
| 19 import json | 19 import json |
| 20 import pandas | 20 import pandas |
| 21 import ast | 21 import ast |
| 22 import pickle | 22 import pickle |
| 23 import numpy as np | 23 import numpy as np |
| 24 import sklearn.model_selection | 24 import sklearn.feature_selection |
| 25 from sklearn import svm, linear_model, ensemble, preprocessing | 25 from sklearn import preprocessing, model_selection, svm, linear_model, ensemble, naive_bayes, tree, neighbors |
| 26 from sklearn.pipeline import Pipeline | 26 from sklearn.pipeline import Pipeline |
| 27 | 27 |
| 28 @COLUMNS_FUNCTION@ | 28 @COLUMNS_FUNCTION@ |
| 29 | 29 @GET_ESTIMATOR_FUNCTION@ |
| 30 @FEATURE_SELECTOR_FUNCTION@ | 30 @FEATURE_SELECTOR_FUNCTION@ |
| 31 | |
| 31 | 32 |
| 32 input_json_path = sys.argv[1] | 33 input_json_path = sys.argv[1] |
| 33 with open(input_json_path, "r") as param_handler: | 34 with open(input_json_path, "r") as param_handler: |
| 34 params = json.load(param_handler) | 35 params = json.load(param_handler) |
| 35 | 36 |
| 83 my_class = getattr(preprocessing, preprocessor) | 84 my_class = getattr(preprocessing, preprocessor) |
| 84 pipeline_steps.append( ('pre_processor', my_class(**pre_processor_options)) ) | 85 pipeline_steps.append( ('pre_processor', my_class(**pre_processor_options)) ) |
| 85 | 86 |
| 86 ## Set up feature selector and add to pipeline steps. | 87 ## Set up feature selector and add to pipeline steps. |
| 87 if params['feature_selection']['do_feature_selection'] == 'Yes': | 88 if params['feature_selection']['do_feature_selection'] == 'Yes': |
| 88 feature_selector = feature_selector(params['feature_selection']['feature_selection_algorithms']) | 89 feature_selector = feature_selector(params['feature_selection']['fs_algorithm_selector']) |
| 89 pipeline_steps.append( ('feature_selector', feature_selector) ) | 90 pipeline_steps.append( ('feature_selector', feature_selector) ) |
| 90 | 91 |
| 91 ## Set up estimator and add to pipeline. | 92 ## Set up estimator and add to pipeline. |
| 92 estimator=params["model_validation_functions"]["estimator"] | 93 estimator_json = params["model_validation_functions"]['estimator_selector'] |
| 93 if params["model_validation_functions"]["extra_estimator"]["has_estimator"] == 'no': | 94 estimator = get_estimator(estimator_json) |
| 94 estimator = params["model_validation_functions"]["extra_estimator"]["new_estimator"] | |
| 95 estimator = eval(estimator.replace('__dq__', '"').replace("__sq__","'")) | |
| 96 | 95 |
| 97 pipeline_steps.append( ('estimator', estimator) ) | 96 pipeline_steps.append( ('estimator', estimator) ) |
| 98 | 97 |
| 99 pipeline = Pipeline(pipeline_steps) | 98 pipeline = Pipeline(pipeline_steps) |
| 100 | 99 |
| 101 ## Set up validator, run pipeline through validator and return results. | 100 ## Set up validator, run pipeline through validator and return results. |
| 102 | 101 |
| 103 validator = params["model_validation_functions"]["selected_function"] | 102 validator = params["model_validation_functions"]["selected_function"] |
| 104 validator = getattr(sklearn.model_selection, validator) | 103 validator = getattr(model_selection, validator) |
| 105 | 104 |
| 106 selected_function = params["model_validation_functions"]["selected_function"] | 105 selected_function = params["model_validation_functions"]["selected_function"] |
| 107 rval_type = params["model_validation_functions"].get("return_type", None) | 106 rval_type = params["model_validation_functions"].get("return_type", None) |
| 108 | 107 |
| 109 if selected_function == 'cross_validate': | 108 if selected_function == 'cross_validate': |
| 121 elif selected_function == 'validation_curve': | 120 elif selected_function == 'validation_curve': |
| 122 options['param_name'] = 'estimator__' + options['param_name'] | 121 options['param_name'] = 'estimator__' + options['param_name'] |
| 123 options['param_range'] = eval(options['param_range']) | 122 options['param_range'] = eval(options['param_range']) |
| 124 train_scores, test_scores = validator(pipeline, X, y, **options) | 123 train_scores, test_scores = validator(pipeline, X, y, **options) |
| 125 rval = eval(rval_type) | 124 rval = eval(rval_type) |
| 126 elif selected_function == 'GridSearchCV': | |
| 127 param_grid = params["model_validation_functions"]["param_grid"].replace("__sq__","'")\ | |
| 128 .replace('__dq__','"').replace("__oc__", "{").replace("__cc__", "}")\ | |
| 129 .replace("__ob__", "[").replace("__cb__", "]") | |
| 130 param_grid = ast.literal_eval(param_grid) | |
| 131 grid = validator(pipeline, param_grid, **options) | |
| 132 grid.fit(X, y) | |
| 133 rval = getattr(grid, rval_type) | |
| 134 if rval_type in ["best_estimator_", "best_score_", "best_index_"]: | |
| 135 rval = [rval] | |
| 136 else: | 125 else: |
| 137 rval = validator(pipeline, X, y, **options) | 126 rval = validator(pipeline, X, y, **options) |
| 138 | 127 |
| 139 rval = pandas.DataFrame(rval) | 128 rval = pandas.DataFrame(rval) |
| 140 if rval_type and rval_type == "cv_results_": | 129 rval.to_csv(path_or_buf="$outfile", sep='\t', header=False, index=False) |
| 141 rval.to_csv(path_or_buf="$outfile", sep='\t', header=True, index=False) | |
| 142 else: | |
| 143 rval.to_csv(path_or_buf="$outfile", sep='\t', header=False, index=False) | |
| 144 | 130 |
| 145 ]]> | 131 ]]> |
| 146 </configfile> | 132 </configfile> |
| 147 </configfiles> | 133 </configfiles> |
| 148 <inputs> | 134 <inputs> |
| 164 <option value="No" selected="true"/> | 150 <option value="No" selected="true"/> |
| 165 <option value="Yes"/> | 151 <option value="Yes"/> |
| 166 </param> | 152 </param> |
| 167 <when value="No"/> | 153 <when value="No"/> |
| 168 <when value="Yes"> | 154 <when value="Yes"> |
| 169 <expand macro="feature_selection_all"/> | 155 <expand macro="feature_selection_all"> |
| 156 <expand macro="fs_selectfrommodel_no_prefitted"/> | |
| 157 </expand> | |
| 170 </when> | 158 </when> |
| 171 </conditional> | 159 </conditional> |
| 172 <conditional name="model_validation_functions"> | 160 <conditional name="model_validation_functions"> |
| 173 <param name="selected_function" type="select" label="Select a model validation function"> | 161 <param name="selected_function" type="select" label="Select a model validation function"> |
| 174 <option value="GridSearchCV">GridSearchCV - Exhaustive search over specified parameter values for an estimator </option> | |
| 175 <option value="cross_validate">cross_validate - Evaluate metric(s) by cross-validation and also record fit/score times</option> | 162 <option value="cross_validate">cross_validate - Evaluate metric(s) by cross-validation and also record fit/score times</option> |
| 176 <option value="cross_val_predict">cross_val_predict - Generate cross-validated estimates for each input data point</option> | 163 <option value="cross_val_predict">cross_val_predict - Generate cross-validated estimates for each input data point</option> |
| 177 <option value="cross_val_score">cross_val_score - Evaluate a score by cross-validation</option> | 164 <option value="cross_val_score">cross_val_score - Evaluate a score by cross-validation</option> |
| 178 <option value="learning_curve">learning_curve - Learning curve</option> | 165 <option value="learning_curve">learning_curve - Learning curve</option> |
| 179 <option value="permutation_test_score">permutation_test_score - Evaluate the significance of a cross-validated score with permutations</option> | 166 <option value="permutation_test_score">permutation_test_score - Evaluate the significance of a cross-validated score with permutations</option> |
| 180 <option value="validation_curve">validation_curve - Validation curve</option> | 167 <option value="validation_curve">validation_curve - Validation curve</option> |
| 181 </param> | 168 </param> |
| 182 <when value="GridSearchCV"> | |
| 183 <expand macro="estimator_input_no_fit" /> | |
| 184 <param argument="param_grid" type="text" value="[{'feature_selector__k': [3, 5, 7, 9], 'estimator__C': [1, 10, 100, 1000]}]" label="param_grid" help="Dictionary with parameters names (string) as keys and lists of parameter settings to try as values, or a list of such dictionaries, in which case the grids spanned by each dictionary in the list are explored"/> | |
| 185 <section name="options" title="Other Options" expanded="false"> | |
| 186 <expand macro="scoring"/> | |
| 187 <expand macro="model_validation_common_options"/> | |
| 188 <expand macro="pre_dispatch" value="2*n_jobs" help="Controls the number of jobs that get dispatched during parallel execution"/> | |
| 189 <param argument="iid" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="iid" help="Data is identically distributed?"/> | |
| 190 <param argument="refit" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="refit" help="Refit an estimator using the best found parameters on the whole dataset."/> | |
| 191 <!--error_score--> | |
| 192 <param argument="return_train_score" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false" label="return_train_score" help=""/> | |
| 193 </section> | |
| 194 <param name="return_type" type="select" label="Select a return type"> | |
| 195 <option value="cv_results_" selected="true">cv_results_</option> | |
| 196 <option value="best_estimator_">best_estimator_</option> | |
| 197 <option value="best_score_">best_score_</option> | |
| 198 <option value="best_params_">best_params_</option> | |
| 199 <option value="best_index_">best_index_</option> | |
| 200 </param> | |
| 201 </when> | |
| 202 <when value="cross_validate"> | 169 <when value="cross_validate"> |
| 203 <expand macro="estimator_input_no_fit" /> | 170 <expand macro="estimator_selector_all" /> |
| 204 <section name="options" title="Other Options" expanded="false"> | 171 <section name="options" title="Other Options" expanded="false"> |
| 205 <!--groups--> | 172 <!--groups--> |
| 206 <expand macro="model_validation_common_options"/> | 173 <expand macro="model_validation_common_options"/> |
| 207 <expand macro="scoring"/> | 174 <expand macro="scoring"/> |
| 208 <!--fit_params--> | 175 <!--fit_params--> |
| 214 <option value="fit_time">fit_time</option> | 181 <option value="fit_time">fit_time</option> |
| 215 <option value="score_time">score_time</option> | 182 <option value="score_time">score_time</option> |
| 216 </param> | 183 </param> |
| 217 </when> | 184 </when> |
| 218 <when value="cross_val_predict"> | 185 <when value="cross_val_predict"> |
| 219 <expand macro="estimator_input_no_fit" /> | 186 <expand macro="estimator_selector_all" /> |
| 220 <section name="options" title="Other Options" expanded="false"> | 187 <section name="options" title="Other Options" expanded="false"> |
| 221 <!--groups--> | 188 <!--groups--> |
| 222 <expand macro="model_validation_common_options" /> | 189 <expand macro="model_validation_common_options" /> |
| 223 <!--fit_params--> | 190 <!--fit_params--> |
| 224 <expand macro="pre_dispatch" value="2*n_jobs’" help="Controls the number of jobs that get dispatched during parallel execution"/> | 191 <expand macro="pre_dispatch" value="2*n_jobs’" help="Controls the number of jobs that get dispatched during parallel execution"/> |
| 227 <option value="predict_proba">predict_proba</option> | 194 <option value="predict_proba">predict_proba</option> |
| 228 </param> | 195 </param> |
| 229 </section> | 196 </section> |
| 230 </when> | 197 </when> |
| 231 <when value="cross_val_score"> | 198 <when value="cross_val_score"> |
| 232 <expand macro="estimator_input_no_fit" /> | 199 <expand macro="estimator_selector_all" /> |
| 233 <section name="options" title="Other Options" expanded="false"> | 200 <section name="options" title="Other Options" expanded="false"> |
| 234 <!--groups--> | 201 <!--groups--> |
| 235 <expand macro="model_validation_common_options"/> | 202 <expand macro="model_validation_common_options"/> |
| 236 <expand macro="scoring"/> | 203 <expand macro="scoring"/> |
| 237 <!--fit_params--> | 204 <!--fit_params--> |
| 238 <expand macro="pre_dispatch"/> | 205 <expand macro="pre_dispatch"/> |
| 239 </section> | 206 </section> |
| 240 </when> | 207 </when> |
| 241 <when value="learning_curve"> | 208 <when value="learning_curve"> |
| 242 <expand macro="estimator_input_no_fit" /> | 209 <expand macro="estimator_selector_all" /> |
| 243 <section name="options" title="Other Options" expanded="false"> | 210 <section name="options" title="Other Options" expanded="false"> |
| 244 <!--groups--> | 211 <!--groups--> |
| 245 <expand macro="model_validation_common_options"/> | 212 <expand macro="model_validation_common_options"/> |
| 246 <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"/> | 213 <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"/> |
| 247 <expand macro="scoring"/> | 214 <expand macro="scoring"/> |
| 255 <option value="train_scores">train_scores</option> | 222 <option value="train_scores">train_scores</option> |
| 256 <option value="test_scores">test_scores</option> | 223 <option value="test_scores">test_scores</option> |
| 257 </param> | 224 </param> |
| 258 </when> | 225 </when> |
| 259 <when value="permutation_test_score"> | 226 <when value="permutation_test_score"> |
| 260 <expand macro="estimator_input_no_fit" /> | 227 <expand macro="estimator_selector_all" /> |
| 261 <section name="options" title="Other Options" expanded="false"> | 228 <section name="options" title="Other Options" expanded="false"> |
| 262 <!--groups--> | 229 <!--groups--> |
| 263 <expand macro="model_validation_common_options"/> | 230 <expand macro="model_validation_common_options"/> |
| 264 <expand macro="scoring"/> | 231 <expand macro="scoring"/> |
| 265 <param name="n_permutations" type="integer" value="100" optional="true" label="n_permutations" help="Number of times to permute y"/> | 232 <param name="n_permutations" type="integer" value="100" optional="true" label="n_permutations" help="Number of times to permute y"/> |
| 270 <option value="permutation_scores">permutation_scores</option> | 237 <option value="permutation_scores">permutation_scores</option> |
| 271 <option value="pvalue">pvalue</option> | 238 <option value="pvalue">pvalue</option> |
| 272 </param> | 239 </param> |
| 273 </when> | 240 </when> |
| 274 <when value="validation_curve"> | 241 <when value="validation_curve"> |
| 275 <expand macro="estimator_input_no_fit" /> | 242 <expand macro="estimator_selector_all" /> |
| 276 <section name="options" title="Other Options" expanded="false"> | 243 <section name="options" title="Other Options" expanded="false"> |
| 277 <param name="param_name" type="text" value="gamma" label="param_name" help="Name of the parameter that will be varied"/> | 244 <param name="param_name" type="text" value="gamma" label="param_name" help="Name of the parameter that will be varied"/> |
| 278 <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."/> | 245 <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."/> |
| 279 <!--groups--> | 246 <!--groups--> |
| 280 <expand macro="model_validation_common_options"/> | 247 <expand macro="model_validation_common_options"/> |
| 293 <data format="tabular" name="outfile"/> | 260 <data format="tabular" name="outfile"/> |
| 294 </outputs> | 261 </outputs> |
| 295 <tests> | 262 <tests> |
| 296 <test> | 263 <test> |
| 297 <param name="selected_function" value="cross_validate"/> | 264 <param name="selected_function" value="cross_validate"/> |
| 298 <param name="estimator" value="linear_model.LassoCV()"/> | 265 <param name="selected_module" value="linear_model"/> |
| 299 <param name="has_estimator" value="yes"/> | 266 <param name="selected_estimator" value="LassoCV"/> |
| 300 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> | 267 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> |
| 301 <param name="col1" value="1,2,3,4,5"/> | 268 <param name="col1" value="1,2,3,4,5"/> |
| 302 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> | 269 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> |
| 303 <param name="col2" value="6"/> | 270 <param name="col2" value="6"/> |
| 304 <output name="outfile" file="mv_result01.tabular"/> | 271 <output name="outfile" file="mv_result01.tabular"/> |
| 305 </test> | 272 </test> |
| 306 <test> | 273 <test> |
| 307 <param name="selected_function" value="cross_val_predict"/> | 274 <param name="selected_function" value="cross_val_predict"/> |
| 308 <param name="estimator" value="linear_model.LassoCV()"/> | 275 <param name="selected_module" value="linear_model"/> |
| 309 <param name="has_estimator" value="yes"/> | 276 <param name="selected_estimator" value="LassoCV"/> |
| 310 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> | 277 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> |
| 311 <param name="col1" value="1,2,3,4,5"/> | 278 <param name="col1" value="1,2,3,4,5"/> |
| 312 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> | 279 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> |
| 313 <param name="col2" value="6"/> | 280 <param name="col2" value="6"/> |
| 314 <output name="outfile" file="mv_result02.tabular"/> | 281 <output name="outfile" file="mv_result02.tabular"/> |
| 315 </test> | 282 </test> |
| 316 <test> | 283 <test> |
| 317 <param name="selected_function" value="cross_val_score"/> | 284 <param name="selected_function" value="cross_val_score"/> |
| 318 <param name="estimator" value="linear_model.LassoCV()"/> | 285 <param name="selected_module" value="linear_model"/> |
| 319 <param name="has_estimator" value="yes"/> | 286 <param name="selected_estimator" value="LassoCV"/> |
| 320 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> | 287 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> |
| 321 <param name="col1" value="1,2,3,4,5"/> | 288 <param name="col1" value="1,2,3,4,5"/> |
| 322 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> | 289 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> |
| 323 <param name="col2" value="6"/> | 290 <param name="col2" value="6"/> |
| 324 <output name="outfile" file="mv_result03.tabular"/> | 291 <output name="outfile" file="mv_result03.tabular"/> |
| 325 </test> | 292 </test> |
| 326 <test> | 293 <test> |
| 327 <param name="selected_function" value="learning_curve"/> | 294 <param name="selected_function" value="learning_curve"/> |
| 328 <param name="estimator" value="linear_model.LassoCV()"/> | 295 <param name="selected_module" value="linear_model"/> |
| 329 <param name="has_estimator" value="yes"/> | 296 <param name="selected_estimator" value="LassoCV"/> |
| 330 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> | 297 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> |
| 331 <param name="header1" value="true" /> | 298 <param name="header1" value="true" /> |
| 332 <param name="col1" value="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17"/> | 299 <param name="col1" value="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17"/> |
| 333 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> | 300 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> |
| 334 <param name="header2" value="true" /> | 301 <param name="header2" value="true" /> |
| 335 <param name="col2" value="1"/> | 302 <param name="col2" value="1"/> |
| 336 <output name="outfile" file="mv_result04.tabular"/> | 303 <output name="outfile" file="mv_result04.tabular"/> |
| 337 </test> | 304 </test> |
| 338 <test> | 305 <test> |
| 339 <param name="selected_function" value="permutation_test_score"/> | 306 <param name="selected_function" value="permutation_test_score"/> |
| 340 <param name="estimator" value="linear_model.LassoCV()"/> | 307 <param name="selected_module" value="linear_model"/> |
| 341 <param name="has_estimator" value="yes"/> | 308 <param name="selected_estimator" value="LassoCV"/> |
| 342 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> | 309 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> |
| 343 <param name="col1" value="1,2,3,4,5"/> | 310 <param name="col1" value="1,2,3,4,5"/> |
| 344 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> | 311 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> |
| 345 <param name="col2" value="6"/> | 312 <param name="col2" value="6"/> |
| 346 <output name="outfile" file="mv_result05.tabular"/> | 313 <output name="outfile" file="mv_result05.tabular"/> |
| 347 </test> | 314 </test> |
| 348 <test> | 315 <test> |
| 349 <param name="selected_function" value="validation_curve"/> | 316 <param name="selected_function" value="validation_curve"/> |
| 350 <param name="estimator" value="svm.SVC(kernel="linear")"/> | 317 <param name="selected_module" value="svm"/> |
| 351 <param name="has_estimator" value="yes"/> | 318 <param name="selected_estimator" value="SVC"/> |
| 319 <param name="text_params" value="'kernel': 'linear'"/> | |
| 352 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> | 320 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> |
| 353 <param name="header1" value="true" /> | 321 <param name="header1" value="true" /> |
| 354 <param name="selected_column_selector_option" value="all_columns"/> | 322 <param name="selected_column_selector_option" value="all_columns"/> |
| 355 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> | 323 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> |
| 356 <param name="header2" value="true" /> | 324 <param name="header2" value="true" /> |
| 357 <param name="col2" value="1"/> | 325 <param name="col2" value="1"/> |
| 358 <param name="return_type" value="test_scores"/> | 326 <param name="return_type" value="test_scores"/> |
| 359 <output name="outfile" file="mv_result06.tabular"/> | 327 <output name="outfile" file="mv_result06.tabular"/> |
| 360 </test> | 328 </test> |
| 361 <test> | |
| 362 <param name="do_feature_selection" value="Yes"/> | |
| 363 <param name="selected_algorithm" value="SelectKBest"/> | |
| 364 <param name="score_func" value="chi2"/> | |
| 365 <param name="selected_function" value="GridSearchCV"/> | |
| 366 <param name="estimator" value="svm.SVR(kernel="linear")"/> | |
| 367 <param name="has_estimator" value="yes"/> | |
| 368 <param name="param_grid" value="[{'feature_selector__k': [3, 7], 'estimator__C': [1, 100]}]"/> | |
| 369 <param name="return_type" value="best_score_"/> | |
| 370 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> | |
| 371 <param name="header1" value="true" /> | |
| 372 <param name="selected_column_selector_option" value="all_columns"/> | |
| 373 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> | |
| 374 <param name="header2" value="true" /> | |
| 375 <param name="selected_column_selector_option2" value="all_columns"/> | |
| 376 <output name="outfile" > | |
| 377 <assert_contents> | |
| 378 <has_line line="0.7824428015300172" /> | |
| 379 </assert_contents> | |
| 380 </output> | |
| 381 </test> | |
| 382 <test> | |
| 383 <param name="do_pre_processing" value="Yes"/> | |
| 384 <param name="selected_pre_processor" value="RobustScaler"/> | |
| 385 <param name="do_feature_selection" value="Yes"/> | |
| 386 <param name="selected_algorithm" value="SelectKBest"/> | |
| 387 <param name="score_func" value="f_classif"/> | |
| 388 <param name="selected_function" value="GridSearchCV"/> | |
| 389 <param name="estimator" value="svm.SVR(kernel="linear")"/> | |
| 390 <param name="has_estimator" value="yes"/> | |
| 391 <param name="param_grid" value="[{'feature_selector__k': [3, 5, 7, 9], 'estimator__C': [1, 10, 100, 1000]}]"/> | |
| 392 <param name="return_type" value="best_score_"/> | |
| 393 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> | |
| 394 <param name="header1" value="true" /> | |
| 395 <param name="selected_column_selector_option" value="all_columns"/> | |
| 396 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> | |
| 397 <param name="header2" value="true" /> | |
| 398 <param name="selected_column_selector_option2" value="all_columns"/> | |
| 399 <output name="outfile" > | |
| 400 <assert_contents> | |
| 401 <has_line line="0.7938837807353147" /> | |
| 402 </assert_contents> | |
| 403 </output> | |
| 404 </test> | |
| 405 <test> | |
| 406 <param name="do_pre_processing" value="Yes"/> | |
| 407 <param name="selected_pre_processor" value="RobustScaler"/> | |
| 408 <param name="selected_function" value="GridSearchCV"/> | |
| 409 <param name="estimator" value="svm.SVR(kernel="linear")"/> | |
| 410 <param name="has_estimator" value="yes"/> | |
| 411 <param name="param_grid" value="[{'estimator__C': [1, 10, 100, 1000]}]"/> | |
| 412 <param name="return_type" value="best_score_"/> | |
| 413 <param name="infile1" value="regression_X.tabular" ftype="tabular"/> | |
| 414 <param name="header1" value="true" /> | |
| 415 <param name="selected_column_selector_option" value="all_columns"/> | |
| 416 <param name="infile2" value="regression_y.tabular" ftype="tabular"/> | |
| 417 <param name="header2" value="true" /> | |
| 418 <param name="selected_column_selector_option2" value="all_columns"/> | |
| 419 <output name="outfile" > | |
| 420 <assert_contents> | |
| 421 <has_line line="0.7904476204861263" /> | |
| 422 </assert_contents> | |
| 423 </output> | |
| 424 </test> | |
| 425 </tests> | 329 </tests> |
| 426 <help> | 330 <help> |
| 427 <![CDATA[ | 331 <![CDATA[ |
| 428 **What it does** | 332 **What it does** |
| 429 This tool includes model validation functions to evaluate estimator performance in the cross-validation approach. This tool is based on | 333 This tool includes model validation functions to evaluate estimator performance in the cross-validation approach. This tool is based on |
| 430 sklearn.model_selection package. | 334 sklearn.model_selection package. |
| 431 For information about classification metric functions and their parameter settings please refer to `Scikit-learn classification metrics`_. | 335 For information about model validation functions and their parameter settings please refer to `Scikit-learn model_selection`_. |
| 432 | 336 |
| 433 .. _`Scikit-learn classification metrics`: http://scikit-learn.org/stable/modules/model_evaluation.html#classification-metrics | 337 .. _`Scikit-learn model_selection`: http://scikit-learn.org/stable/modules/classes.html#module-sklearn.model_selection |
| 434 ]]> | 338 ]]> |
| 435 </help> | 339 </help> |
| 436 <expand macro="sklearn_citation"/> | 340 <expand macro="sklearn_citation"/> |
| 437 </tool> | 341 </tool> |
