comparison generalized_linear.xml @ 21:212e7adfe65f draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2a058459e6daf0486871f93845f00fdb4a4eaca1
author bgruening
date Sat, 29 Sep 2018 07:39:16 -0400
parents 9b7d0655f70f
children e0f8931f6149
comparison
equal deleted inserted replaced
20:9b7d0655f70f 21:212e7adfe65f
19 import numpy as np 19 import numpy as np
20 import sklearn.linear_model 20 import sklearn.linear_model
21 import pandas 21 import pandas
22 from scipy.io import mmread 22 from scipy.io import mmread
23 23
24 execfile("$__tool_directory__/sk_whitelist.py") 24 with open("$__tool_directory__/sk_whitelist.json", "r") as f:
25 execfile("$__tool_directory__/utils.py", globals()) 25 sk_whitelist = json.load(f)
26 exec(open("$__tool_directory__/utils.py").read(), globals())
26 27
27 input_json_path = sys.argv[1] 28 input_json_path = sys.argv[1]
28 with open(input_json_path, "r") as param_handler: 29 with open(input_json_path, "r") as param_handler:
29 params = json.load(param_handler) 30 params = json.load(param_handler)
30 31
41 with open("$outfile_fit", 'wb') as out_handler: 42 with open("$outfile_fit", 'wb') as out_handler:
42 pickle.dump(estimator, out_handler, pickle.HIGHEST_PROTOCOL) 43 pickle.dump(estimator, out_handler, pickle.HIGHEST_PROTOCOL)
43 44
44 #else: 45 #else:
45 with open("$selected_tasks.infile_model", 'rb') as model_handler: 46 with open("$selected_tasks.infile_model", 'rb') as model_handler:
46 classifier_object = SafePickler.load(model_handler) 47 classifier_object = load_model(model_handler)
47 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=None, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False ) 48 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=None, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False )
48 prediction = classifier_object.predict(data) 49 prediction = classifier_object.predict(data)
49 prediction_df = pandas.DataFrame(prediction, columns=["predicted"]) 50 prediction_df = pandas.DataFrame(prediction, columns=["predicted"])
50 res = pandas.concat([data, prediction_df], axis=1) 51 res = pandas.concat([data, prediction_df], axis=1)
51 res.to_csv(path_or_buf = "$outfile_predict", sep="\t", index=False, header=None) 52 res.to_csv(path_or_buf = "$outfile_predict", sep="\t", index=False, header=None)
197 <!--class_weight=None--> 198 <!--class_weight=None-->
198 </section> 199 </section>
199 </when> 200 </when>
200 </expand> 201 </expand>
201 </inputs> 202 </inputs>
202 <outputs> 203 <expand macro="output"/>
203 <data format="tabular" name="outfile_predict">
204 <filter>selected_tasks['selected_task'] == 'load'</filter>
205 </data>
206 <data format="zip" name="outfile_fit">
207 <filter>selected_tasks['selected_task'] == 'train'</filter>
208 </data>
209 </outputs>
210 <tests> 204 <tests>
211 <test> 205 <test>
212 <param name="infile1" value="regression_train.tabular" ftype="tabular"/> 206 <param name="infile1" value="regression_train.tabular" ftype="tabular"/>
213 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> 207 <param name="infile2" value="regression_train.tabular" ftype="tabular"/>
214 <param name="selected_column_selector_option" value="all_but_by_index_number"/> 208 <param name="selected_column_selector_option" value="all_but_by_index_number"/>
262 <param name="infile2" value="regression_train.tabular" ftype="tabular"/> 256 <param name="infile2" value="regression_train.tabular" ftype="tabular"/>
263 <param name="col1" value="1,2,3,4,5"/> 257 <param name="col1" value="1,2,3,4,5"/>
264 <param name="col2" value="6"/> 258 <param name="col2" value="6"/>
265 <param name="selected_task" value="train"/> 259 <param name="selected_task" value="train"/>
266 <param name="selected_algorithm" value="LinearRegression"/> 260 <param name="selected_algorithm" value="LinearRegression"/>
267 <param name="random_state" value="10"/>
268 <output name="outfile_fit" file="glm_model04" compare="sim_size" delta="500"/> 261 <output name="outfile_fit" file="glm_model04" compare="sim_size" delta="500"/>
269 </test> 262 </test>
270 <test> 263 <test>
271 <param name="infile_model" value="glm_model04" ftype="zip"/> 264 <param name="infile_model" value="glm_model04" ftype="zip"/>
272 <param name="infile_data" value="regression_test.tabular" ftype="tabular"/> 265 <param name="infile_data" value="regression_test.tabular" ftype="tabular"/>