Mercurial > repos > bgruening > sklearn_searchcv
diff search_model_validation.xml @ 5:9cbb9e9cd074 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2a058459e6daf0486871f93845f00fdb4a4eaca1
author | bgruening |
---|---|
date | Sat, 29 Sep 2018 07:15:30 -0400 |
parents | 924af5cfe4c2 |
children | d4083bfe27d2 |
line wrap: on
line diff
--- a/search_model_validation.xml Thu Aug 23 16:07:47 2018 -0400 +++ b/search_model_validation.xml Sat Sep 29 07:15:30 2018 -0400 @@ -25,8 +25,9 @@ from sklearn import model_selection from sklearn.exceptions import FitFailedWarning -execfile("$__tool_directory__/sk_whitelist.py") -execfile("$__tool_directory__/utils.py", globals()) +with open("$__tool_directory__/sk_whitelist.json", "r") as f: + sk_whitelist = json.load(f) +exec(open("$__tool_directory__/utils.py").read(), globals()) warnings.simplefilter('ignore') @@ -95,19 +96,22 @@ options['pre_dispatch'] = None with open(infile_pipeline, 'rb') as pipeline_handler: - pipeline = SafePickler.load(pipeline_handler) + pipeline = load_model(pipeline_handler) search_params = get_search_params(params_builder) searcher = optimizers(pipeline, search_params, **options) -warnings.simplefilter('always', FitFailedWarning) -with warnings.catch_warnings(record=True) as w: - try: - searcher.fit(X, y) - except ValueError: - pass - for warning in w: - print(repr(warning.message)) +if options['error_score'] == 'raise': + searcher.fit(X, y) +else: + warnings.simplefilter('always', FitFailedWarning) + with warnings.catch_warnings(record=True) as w: + try: + searcher.fit(X, y) + except ValueError: + pass + for warning in w: + print(repr(warning.message)) cv_result = pandas.DataFrame(searcher.cv_results_) cv_result.to_csv(path_or_buf=outfile_result, sep='\t', header=True, index=False) @@ -169,13 +173,33 @@ <param name="infile2" value="regression_y.tabular" ftype="tabular"/> <param name="header2" value="true" /> <param name="selected_column_selector_option2" value="all_columns"/> - <output name="outfile_result" > + <output name="outfile_result"> <assert_contents> - <has_text_matching expression="[^/d]+0.7938837807353147[^/d]+{u'estimator__C': 1, u'preprocessing_2__k': 9}[^/d]+1" /> - <has_text text="0.0"/> + <has_n_columns n="13"/> + <has_text text="0.7938837807353147"/> + <has_text text="{'estimator__C': 1, 'preprocessing_2__k': 9}"/> </assert_contents> </output> </test> + <test expect_failure="true"> + <param name="selected_search_scheme" value="GridSearchCV"/> + <param name="infile_pipeline" value="pipeline01" ftype="zip"/> + <conditional name="search_param_selector"> + <param name="search_p" value="C: [1, 10, 100, 1000]"/> + <param name="selected_param_type" value="final_estimator_p"/> + </conditional> + <conditional name="search_param_selector"> + <param name="search_p" value="k: [-1, 3, 5, 7, 9]"/> + <param name="selected_param_type" value="prep_2_p"/> + </conditional> + <param name="error_score" value="true"/> + <param name="infile1" value="regression_X.tabular" ftype="tabular"/> + <param name="header1" value="true" /> + <param name="selected_column_selector_option" value="all_columns"/> + <param name="infile2" value="regression_y.tabular" ftype="tabular"/> + <param name="header2" value="true" /> + <param name="selected_column_selector_option2" value="all_columns"/> + </test> <test> <param name="selected_search_scheme" value="RandomizedSearchCV"/> <param name="infile_pipeline" value="pipeline01" ftype="zip"/> @@ -372,7 +396,7 @@ <param name="infile2" value="regression_y.tabular" ftype="tabular"/> <param name="header2" value="true" /> <param name="selected_column_selector_option2" value="all_columns"/> - <output name="outfile_estimator" file="searchCV01" compare="sim_size" delta="1"/> + <output name="outfile_estimator" file="searchCV02" compare="sim_size" delta="1"/> </test> <test> <param name="selected_search_scheme" value="GridSearchCV"/> @@ -396,7 +420,7 @@ <output name="outfile_result" > <assert_contents> <has_n_columns n="13" /> - <has_text text="0.05366527890058046"/> + <has_text text="0.09003449195911103"/> </assert_contents> </output> </test>