comparison ensemble.xml @ 4:3bc536788043 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
author bgruening
date Fri, 16 Feb 2018 09:14:03 -0500
parents a92c5991d959
children 4c2fae2db5d1
comparison
equal deleted inserted replaced
3:efbacdceaa7e 4:3bc536788043
48 estimator.fit(X,y) 48 estimator.fit(X,y)
49 pickle.dump(estimator,open("$outfile_fit", 'w+'), pickle.HIGHEST_PROTOCOL) 49 pickle.dump(estimator,open("$outfile_fit", 'w+'), pickle.HIGHEST_PROTOCOL)
50 50
51 #else: 51 #else:
52 classifier_object = pickle.load(open("$selected_tasks.infile_model", 'r')) 52 classifier_object = pickle.load(open("$selected_tasks.infile_model", 'r'))
53 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=None, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ) 53 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False )
54 prediction = classifier_object.predict(data) 54 prediction = classifier_object.predict(data)
55 prediction_df = pandas.DataFrame(prediction) 55 prediction_df = pandas.DataFrame(prediction)
56 res = pandas.concat([data, prediction_df], axis=1) 56 res = pandas.concat([data, prediction_df], axis=1)
57 res.to_csv(path_or_buf = "$outfile_predict", sep="\t", index=False) 57 res.to_csv(path_or_buf = "$outfile_predict", sep="\t", index=False)
58 #end if 58 #end if
129 <expand macro="random_state"/> 129 <expand macro="random_state"/>
130 </section> 130 </section>
131 </when> 131 </when>
132 </expand> 132 </expand>
133 </inputs> 133 </inputs>
134 <outputs> 134
135 <data format="tabular" name="outfile_predict"> 135 <expand macro="output"/>
136 <filter>selected_tasks['selected_task'] == 'load'</filter> 136
137 </data>
138 <data format="zip" name="outfile_fit">
139 <filter>selected_tasks['selected_task'] == 'train'</filter>
140 </data>
141 </outputs>
142 <tests> 137 <tests>
143 <test> 138 <test>
144 <param name="infile1" value="train.tabular" ftype="tabular"/> 139 <param name="infile1" value="train.tabular" ftype="tabular"/>
145 <param name="infile2" value="train.tabular" ftype="tabular"/> 140 <param name="infile2" value="train.tabular" ftype="tabular"/>
146 <param name="col1" value="1,2,3,4"/> 141 <param name="col1" value="1,2,3,4"/>
152 </test> 147 </test>
153 <test> 148 <test>
154 <param name="infile_model" value="rfc_model01" ftype="zip"/> 149 <param name="infile_model" value="rfc_model01" ftype="zip"/>
155 <param name="infile_data" value="test.tabular" ftype="tabular"/> 150 <param name="infile_data" value="test.tabular" ftype="tabular"/>
156 <param name="selected_task" value="load"/> 151 <param name="selected_task" value="load"/>
157 <output name="outfile_predict" file="rfc_result01"/> 152 <output name="outfile_predict" file="rfc_result01" compare="sim_size" delta="500"/>
158 </test> 153 </test>
159 154
160 <test> 155 <test>
161 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> 156 <param name="infile1" value="regression_train.tabular" ftype="tabular"/>
162 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> 157 <param name="infile2" value="regression_train.tabular" ftype="tabular"/>
169 </test> 164 </test>
170 <test> 165 <test>
171 <param name="infile_model" value="rfr_model01" ftype="zip"/> 166 <param name="infile_model" value="rfr_model01" ftype="zip"/>
172 <param name="infile_data" value="regression_test.tabular" ftype="tabular"/> 167 <param name="infile_data" value="regression_test.tabular" ftype="tabular"/>
173 <param name="selected_task" value="load"/> 168 <param name="selected_task" value="load"/>
174 <output name="outfile_predict" file="rfr_result01"/> 169 <output name="outfile_predict" file="rfr_result01" compare="sim_size" delta="500"/>
175 </test> 170 </test>
176 </tests> 171 </tests>
177 <help><![CDATA[ 172 <help><![CDATA[
178 ***What it does*** 173 ***What it does***
179 The goal of ensemble methods is to combine the predictions of several base estimators built with a given learning algorithm in order to improve generalizability / robustness over a single estimator. This tool offers two sets of ensemble algorithms for classification and regression: random forests and ADA boosting which are based on sklearn.ensemble library from Scikit-learn. Here you can find out about the input, output and methods presented in the tools. For information about ensemble methods and parameters settings please refer to `Scikit-learn ensemble`_. 174 The goal of ensemble methods is to combine the predictions of several base estimators built with a given learning algorithm in order to improve generalizability / robustness over a single estimator. This tool offers two sets of ensemble algorithms for classification and regression: random forests and ADA boosting which are based on sklearn.ensemble library from Scikit-learn. Here you can find out about the input, output and methods presented in the tools. For information about ensemble methods and parameters settings please refer to `Scikit-learn ensemble`_.
184 There are two groups of operations available: 179 There are two groups of operations available:
185 180
186 1 - Train a model : A training set containing samples and their respective labels (or predicted values) are input. Based on the selected algorithm and options, an estimator object is fit to the data and is returned. 181 1 - Train a model : A training set containing samples and their respective labels (or predicted values) are input. Based on the selected algorithm and options, an estimator object is fit to the data and is returned.
187 182
188 2 - Load a model and predict : An existing model predicts the class labels (or regression values) for a new dataset. 183 2 - Load a model and predict : An existing model predicts the class labels (or regression values) for a new dataset.
189 184
190 **2 - Trainig input** 185 **2 - Trainig input**
191 When you choose to train a model, you need a features dataset X and a labels set y. This tool expects tabular or sparse data for X and a single column for y (tabular). You can select a subset of columns in a tabular dataset as your features dataset or labels column. Below you find some examples: 186 When you choose to train a model, you need a features dataset X and a labels set y. This tool expects tabular or sparse data for X and a single column for y (tabular). You can select a subset of columns in a tabular dataset as your features dataset or labels column. Below you find some examples:
192 187
193 **Sample tabular features dataset** 188 **Sample tabular features dataset**
194 The following training dataset contains 3 feature columns and a column containing class labels. You can simply select the first 3 columns as features and the last column as labels: 189 The following training dataset contains 3 feature columns and a column containing class labels. You can simply select the first 3 columns as features and the last column as labels:
195 190
196 :: 191 ::
197 192
198 4.01163365529 -6.10797684314 8.29829894763 1 193 4.01163365529 -6.10797684314 8.29829894763 1
199 10.0788438916 1.59539821454 10.0684278289 0 194 10.0788438916 1.59539821454 10.0684278289 0
200 -5.17607775503 -0.878286135332 6.92941850665 2 195 -5.17607775503 -0.878286135332 6.92941850665 2
201 4.00975406235 -7.11847496542 9.3802423585 1 196 4.00975406235 -7.11847496542 9.3802423585 1
202 4.61204065139 -5.71217537352 9.12509610964 1 197 4.61204065139 -5.71217537352 9.12509610964 1
203 198
204 199
205 **Sample sparse features dataset** 200 **Sample sparse features dataset**
206 In this case you cannot specifiy a column range. 201 In this case you cannot specifiy a column range.
207 202
208 :: 203 ::
209 204
210 4 1048577 8738 205 4 1048577 8738
211 1 271 0.02083333333333341 206 1 271 0.02083333333333341
212 1 1038 0.02461995616119806 207 1 1038 0.02461995616119806
213 2 829017 0.01629088031127686 208 2 829017 0.01629088031127686
214 2 829437 0.01209127083516686 209 2 829437 0.01209127083516686
224 **2 - Trainig output** 219 **2 - Trainig output**
225 The trained model is generated and output in the form of a binary file. 220 The trained model is generated and output in the form of a binary file.
226 221
227 222
228 **3 - Prediction input** 223 **3 - Prediction input**
229 224
230 When you choose to load a model and do prediction, the tool expects an already trained estimator and a tabular dataset as input. The dataset contains new samples which you want to classify or predict regression values for. 225 When you choose to load a model and do prediction, the tool expects an already trained estimator and a tabular dataset as input. The dataset contains new samples which you want to classify or predict regression values for.
231 226
232 227
233 .. class:: warningmark 228 .. class:: warningmark
234 229
235 The number of feature columns must be the same in training and prediction datasets! 230 The number of feature columns must be the same in training and prediction datasets!
236 231
237 232
238 **3 - Prediction output** 233 **3 - Prediction output**
239 The tool predicts the class labels for new samples and adds them as the last column to the prediction dataset. The new dataset then is output as a tabular file. The prediction output format should look like the training dataset. 234 The tool predicts the class labels for new samples and adds them as the last column to the prediction dataset. The new dataset then is output as a tabular file. The prediction output format should look like the training dataset.
240 235
241 ]]></help> 236 ]]></help>
242 <expand macro="sklearn_citation"/> 237 <expand macro="sklearn_citation"/>
243 </tool> 238 </tool>