comparison stacking_ensembles.xml @ 2:22560cf810b8 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
author bgruening
date Fri, 09 Aug 2019 08:08:15 -0400
parents fcc5eaaec401
children 3dc6734056e6
comparison
equal deleted inserted replaced
1:6717e5cc4d05 2:22560cf810b8
1 <tool id="sklearn_stacking_ensemble_models" name="Stacking Ensemble Models" version="0.1.0"> 1 <tool id="sklearn_stacking_ensemble_models" name="Stacking Ensemble Models" version="@ENSEMBLE_VERSION@">
2 <description>builds a strong model by stacking multiple algorithms</description> 2 <description>builds a strong model by stacking multiple algorithms</description>
3 <macros> 3 <macros>
4 <import>main_macros.xml</import> 4 <import>main_macros.xml</import>
5 </macros> 5 </macros>
6 <expand macro="python_requirements"/> 6 <expand macro="python_requirements"/>
7 <expand macro="macro_stdio"/> 7 <expand macro="macro_stdio"/>
8 <version_command>echo "$version"</version_command> 8 <version_command>echo "$ENSEMBLE_VERSION"</version_command>
9 <command> 9 <command>
10 <![CDATA[ 10 <![CDATA[
11 #for $i, $base in enumerate($base_est_builder) 11 #for $i, $base in enumerate($base_est_builder)
12 #if $i == 0 12 #if $i == 0
13 #if $base.estimator_selector.selected_module == 'custom_estimator' 13 #if $base.estimator_selector.selected_module == 'custom_estimator'
23 #end for 23 #end for
24 python '$__tool_directory__/stacking_ensembles.py' 24 python '$__tool_directory__/stacking_ensembles.py'
25 --inputs '$inputs' 25 --inputs '$inputs'
26 --outfile '$outfile' 26 --outfile '$outfile'
27 --bases "\$bases" 27 --bases "\$bases"
28 #if $meta_estimator.estimator_selector.selected_module == 'custom_estimator' 28 #if $algo_selection.estimator_type not in ('sklearn.ensemble_VotingClassifier', 'sklearn.ensemble_VotingRegressor')
29 --meta '${meta_estimator.estimator_selector.c_estimator}' 29 #if $algo_selection.meta_estimator.estimator_selector.selected_module == 'custom_estimator'
30 --meta '${algo_selection.meta_estimator.estimator_selector.c_estimator}'
31 #end if
30 #end if 32 #end if
31 #if $get_params 33 #if $get_params
32 --outfile_params '$outfile_params' 34 --outfile_params '$outfile_params'
33 #end if 35 #end if
34 ]]> 36 ]]>
37 <inputs name="inputs" /> 39 <inputs name="inputs" />
38 </configfiles> 40 </configfiles>
39 <inputs> 41 <inputs>
40 <conditional name="algo_selection"> 42 <conditional name="algo_selection">
41 <param name="estimator_type" type="select" label="Choose the stacking ensemble type"> 43 <param name="estimator_type" type="select" label="Choose the stacking ensemble type">
42 <option value="StackingCVClassifier" selected="true">classification -- StackingCVClassifier</option> 44 <option value="sklearn.ensemble_VotingClassifier" selected="true">sklearn.ensemble -- VotingClassifier</option>
43 <option value="StackingClassifier">classification -- StackingClassifier</option> 45 <option value="sklearn.ensemble_VotingRegressor">sklearn.ensemble -- VotingRegressor</option>
44 <option value="StackingCVRegressor">regression -- StackingCVRegressor</option> 46 <option value="mlxtend.classifier_StackingCVClassifier">mlxtend.classifier -- StackingCVClassifier</option>
45 <option value="StackingRegressor">regression -- StackingRegressor</option> 47 <option value="mlxtend.classifier_StackingClassifier">mlxtend.classifier -- StackingClassifier</option>
48 <option value="mlxtend.regressor_StackingCVRegressor">mlxtend.regressor -- StackingCVRegressor</option>
49 <option value="mlxtend.regressor_StackingRegressor">mlxtend.regressor -- StackingRegressor</option>
46 </param> 50 </param>
47 <when value="StackingCVClassifier"> 51 <when value="sklearn.ensemble_VotingClassifier">
52 <expand macro="stacking_voting_weights">
53 <param argument="voting" type="select" help="If ‘hard’, uses predicted class labels for majority rule voting. Else if ‘soft’, predicts the class label based on the argmax of the sums of the predicted probabilities, which is recommended for an ensemble of well-calibrated classifiers.">
54 <option value="hard" selected="true">hard</option>
55 <option value="soft">soft</option>
56 </param>
57 <param argument="flatten_transform" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" help=""/>
58 </expand>
59 </when>
60 <when value="sklearn.ensemble_VotingRegressor">
61 <expand macro="stacking_voting_weights"/>
62 </when>
63 <when value="mlxtend.classifier_StackingCVClassifier">
48 <expand macro="stacking_ensemble_inputs"> 64 <expand macro="stacking_ensemble_inputs">
49 <expand macro="cv_reduced"/> 65 <expand macro="cv_reduced"/>
50 <expand macro="shuffle" label="shuffle"/> 66 <expand macro="shuffle" label="shuffle"/>
51 <expand macro="random_state" default_value="" help_text="Integer number. The seed of the pseudo random number generator to use when shuffling the data."/> 67 <expand macro="random_state" default_value="" help_text="Integer number. The seed of the pseudo random number generator to use when shuffling the data."/>
52 <param argument="use_probas" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false"/> 68 <param argument="use_probas" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false"/>
53 </expand> 69 </expand>
54 </when> 70 <section name="meta_estimator" title="Meta Estimator" expanded="true">
55 <when value="StackingClassifier"> 71 <expand macro="stacking_base_estimator"/>
72 </section>
73 </when>
74 <when value="mlxtend.classifier_StackingClassifier">
56 <expand macro="stacking_ensemble_inputs"> 75 <expand macro="stacking_ensemble_inputs">
57 <param argument="use_probas" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false"/> 76 <param argument="use_probas" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false"/>
58 <param argument="average_probas" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false"/> 77 <param argument="average_probas" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="false"/>
59 </expand> 78 </expand>
60 </when> 79 <section name="meta_estimator" title="Meta Estimator" expanded="true">
61 <when value="StackingCVRegressor"> 80 <expand macro="stacking_base_estimator"/>
81 </section>
82 </when>
83 <when value="mlxtend.regressor_StackingCVRegressor">
62 <expand macro="stacking_ensemble_inputs"> 84 <expand macro="stacking_ensemble_inputs">
63 <expand macro="cv_reduced"/> 85 <expand macro="cv_reduced"/>
64 <!--TODO support group splitters. Hint: `groups` is a fit_param--> 86 <!--TODO support group splitters. Hint: `groups` is a fit_param-->
65 <expand macro="shuffle" label="shuffle"/> 87 <expand macro="shuffle" label="shuffle"/>
66 <expand macro="random_state" default_value="" help_text="Integer number. The seed of the pseudo random number generator to use when shuffling the data."/> 88 <expand macro="random_state" default_value="" help_text="Integer number. The seed of the pseudo random number generator to use when shuffling the data."/>
67 <param argument="refit" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true"/> 89 <param argument="refit" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true"/>
68 </expand> 90 </expand>
69 </when> 91 <section name="meta_estimator" title="Meta Estimator" expanded="true">
70 <when value="StackingRegressor"> 92 <expand macro="stacking_base_estimator"/>
93 </section>
94 </when>
95 <when value="mlxtend.regressor_StackingRegressor">
71 <expand macro="stacking_ensemble_inputs"> 96 <expand macro="stacking_ensemble_inputs">
72 <param argument="refit" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true"/> 97 <param argument="refit" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true"/>
73 </expand> 98 </expand>
99 <section name="meta_estimator" title="Meta Estimator" expanded="true">
100 <expand macro="stacking_base_estimator"/>
101 </section>
74 </when> 102 </when>
75 </conditional> 103 </conditional>
76 <repeat name="base_est_builder" min="1" max="20" title="Base Estimator"> 104 <repeat name="base_est_builder" min="1" max="20" title="Base Estimator">
77 <expand macro="stacking_base_estimator"/> 105 <expand macro="stacking_base_estimator"/>
78 <!--param name="base_estimator" type="data" format="zip,json" label="Select the dataset containing base estimator" help="One estimator at a time."/--> 106 <!--param name="base_estimator" type="data" format="zip,json" label="Select the dataset containing base estimator" help="One estimator at a time."/-->
79 </repeat> 107 </repeat>
80 <!--param name="meta_estimator" type="data" format="zip,json" label="Select the dataset containing the Meta estimator"/--> 108 <!--param name="meta_estimator" type="data" format="zip,json" label="Select the dataset containing the Meta estimator"/-->
81 <section name="meta_estimator" title="Meta Estimator" expanded="true">
82 <expand macro="stacking_base_estimator"/>
83 </section>
84 <param name="get_params" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="Output parameters for searchCV?" 109 <param name="get_params" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="Output parameters for searchCV?"
85 help="Optional. Tunable parameters could be obtained through `estimator_attributes` tool."/> 110 help="Optional. Tunable parameters could be obtained through `estimator_attributes` tool."/>
86 </inputs> 111 </inputs>
87 <outputs> 112 <outputs>
88 <data format="zip" name="outfile" label="${algo_selection.estimator_type} on ${on_string}"/> 113 <data format="zip" name="outfile" label="${algo_selection.estimator_type} on ${on_string}"/>
91 </data> 116 </data>
92 </outputs> 117 </outputs>
93 <tests> 118 <tests>
94 <test> 119 <test>
95 <conditional name="algo_selection"> 120 <conditional name="algo_selection">
96 <param name="estimator_type" value="StackingCVRegressor"/> 121 <param name="estimator_type" value="sklearn.ensemble_VotingClassifier"/>
122 <section name="options">
123 <param name="weights" value="[1, 2]"/>
124 </section>
125 </conditional>
126 <repeat name="base_est_builder">
127 <conditional name="estimator_selector">
128 <param name="selected_module" value="svm"/>
129 <param name="selected_estimator" value="SVC"/>
130 </conditional>
131 </repeat>
132 <repeat name="base_est_builder">
133 <conditional name="estimator_selector">
134 <param name="selected_module" value="xgboost"/>
135 <param name="selected_estimator" value="XGBClassifier"/>
136 </conditional>
137 </repeat>
138 <param name="get_params" value="false"/>
139 <output name="outfile" file="StackingVoting03.zip" compare="sim_size" delta="5"/>
140 </test>
141 <test>
142 <conditional name="algo_selection">
143 <param name="estimator_type" value="mlxtend.regressor_StackingCVRegressor"/>
144 <section name="meta_estimator">
145 <conditional name="estimator_selector">
146 <param name="selected_module" value="custom_estimator"/>
147 <param name="c_estimator" value="LinearRegression01.zip" ftype="zip"/>
148 </conditional>
149 </section>
97 </conditional> 150 </conditional>
98 <repeat name="base_est_builder"> 151 <repeat name="base_est_builder">
99 <conditional name="estimator_selector"> 152 <conditional name="estimator_selector">
100 <param name="selected_module" value="custom_estimator"/> 153 <param name="selected_module" value="custom_estimator"/>
101 <param name="c_estimator" value="RandomForestRegressor01.zip" ftype="zip"/> 154 <param name="c_estimator" value="RandomForestRegressor01.zip" ftype="zip"/>
105 <conditional name="estimator_selector"> 158 <conditional name="estimator_selector">
106 <param name="selected_module" value="custom_estimator"/> 159 <param name="selected_module" value="custom_estimator"/>
107 <param name="c_estimator" value="XGBRegressor01.zip" ftype="zip"/> 160 <param name="c_estimator" value="XGBRegressor01.zip" ftype="zip"/>
108 </conditional> 161 </conditional>
109 </repeat> 162 </repeat>
110 <section name="meta_estimator">
111 <conditional name="estimator_selector">
112 <param name="selected_module" value="custom_estimator"/>
113 <param name="c_estimator" value="LinearRegression01.zip" ftype="zip"/>
114 </conditional>
115 </section>
116 <param name="get_params" value="false"/> 163 <param name="get_params" value="false"/>
117 <output name="outfile" file="StackingCVRegressor01.zip" compare="sim_size" delta="5"/> 164 <output name="outfile" file="StackingCVRegressor01.zip" compare="sim_size" delta="5"/>
118 </test> 165 </test>
119 <test> 166 <test>
120 <conditional name="algo_selection"> 167 <conditional name="algo_selection">
121 <param name="estimator_type" value="StackingCVRegressor"/> 168 <param name="estimator_type" value="mlxtend.regressor_StackingRegressor"/>
169 <section name="meta_estimator">
170 <conditional name="estimator_selector">
171 <param name="selected_module" value="svm"/>
172 <param name="selected_estimator" value="SVR"/>
173 </conditional>
174 </section>
122 </conditional> 175 </conditional>
123 <repeat name="base_est_builder"> 176 <repeat name="base_est_builder">
124 <conditional name="estimator_selector"> 177 <conditional name="estimator_selector">
125 <param name="selected_module" value="custom_estimator"/> 178 <param name="selected_module" value="custom_estimator"/>
126 <param name="c_estimator" value="RandomForestRegressor01.zip" ftype="zip"/> 179 <param name="c_estimator" value="RandomForestRegressor01.zip" ftype="zip"/>
130 <conditional name="estimator_selector"> 183 <conditional name="estimator_selector">
131 <param name="selected_module" value="xgboost"/> 184 <param name="selected_module" value="xgboost"/>
132 <param name="selected_estimator" value="XGBRegressor"/> 185 <param name="selected_estimator" value="XGBRegressor"/>
133 </conditional> 186 </conditional>
134 </repeat> 187 </repeat>
135 <section name="meta_estimator">
136 <conditional name="estimator_selector">
137 <param name="selected_module" value="svm"/>
138 <param name="selected_estimator" value="SVR"/>
139 </conditional>
140 </section>
141 <param name="get_params" value="false"/> 188 <param name="get_params" value="false"/>
142 <output name="outfile" file="StackingCVRegressor02.zip" compare="sim_size" delta="5"/> 189 <output name="outfile" file="StackingRegressor02.zip" compare="sim_size" delta="5"/>
143 </test> 190 </test>
144 </tests> 191 </tests>
145 <help> 192 <help>
146 <![CDATA[ 193 <![CDATA[
147 This tool wrapps Stacking Regression, also called Super Learning, in which different base algorithms train 194 This tool wrapps Stacking Regression, also called Super Learning, in which different base algorithms train