Mercurial > repos > bgruening > sklearn_ensemble
comparison ensemble.xml @ 4:0431274c367d draft
planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit cea052cf3b8dd4f3620253bd222e126de32e7466
author | bgruening |
---|---|
date | Thu, 22 Mar 2018 13:46:46 -0400 |
parents | 6e6726be0728 |
children | f1761288587e |
comparison
equal
deleted
inserted
replaced
3:968863bd9008 | 4:0431274c367d |
---|---|
20 import sklearn.ensemble | 20 import sklearn.ensemble |
21 import pandas | 21 import pandas |
22 import pickle | 22 import pickle |
23 from scipy.io import mmread | 23 from scipy.io import mmread |
24 | 24 |
25 @COLUMNS_FUNCTION@ | |
26 | |
25 input_json_path = sys.argv[1] | 27 input_json_path = sys.argv[1] |
26 params = json.load(open(input_json_path, "r")) | 28 params = json.load(open(input_json_path, "r")) |
27 | |
28 @COLUMNS_FUNCTION@ | |
29 | 29 |
30 #if $selected_tasks.selected_task == "train": | 30 #if $selected_tasks.selected_task == "train": |
31 | 31 |
32 algorithm = params["selected_tasks"]["selected_algorithms"]["selected_algorithm"] | 32 algorithm = params["selected_tasks"]["selected_algorithms"]["selected_algorithm"] |
33 options = params["selected_tasks"]["selected_algorithms"]["options"] | 33 options = params["selected_tasks"]["selected_algorithms"]["options"] |
34 input_type = params["selected_tasks"]["selected_algorithms"]["input_options"]["selected_input"] | 34 input_type = params["selected_tasks"]["selected_algorithms"]["input_options"]["selected_input"] |
35 if input_type=="tabular": | 35 if input_type=="tabular": |
36 header = 'infer' if params["selected_tasks"]["selected_algorithms"]["input_options"]["header1"] else None | |
36 X = read_columns( | 37 X = read_columns( |
37 "$selected_tasks.selected_algorithms.input_options.infile1", | 38 "$selected_tasks.selected_algorithms.input_options.infile1", |
38 "$selected_tasks.selected_algorithms.input_options.col1", | 39 "$selected_tasks.selected_algorithms.input_options.col1", |
39 sep='\t', | 40 sep='\t', |
40 header=None, | 41 header=header, |
41 parse_dates=True | 42 parse_dates=True |
42 ) | 43 ) |
43 else: | 44 else: |
44 X = mmread(open("$selected_tasks.selected_algorithms.input_options.infile1", 'r')) | 45 X = mmread(open("$selected_tasks.selected_algorithms.input_options.infile1", 'r')) |
45 | 46 |
47 header = 'infer' if params["selected_tasks"]["selected_algorithms"]["input_options"]["header2"] else None | |
46 y = read_columns( | 48 y = read_columns( |
47 "$selected_tasks.selected_algorithms.input_options.infile2", | 49 "$selected_tasks.selected_algorithms.input_options.infile2", |
48 "$selected_tasks.selected_algorithms.input_options.col2", | 50 "$selected_tasks.selected_algorithms.input_options.col2", |
49 sep='\t', | 51 sep='\t', |
50 header=None, | 52 header=header, |
51 parse_dates=True | 53 parse_dates=True |
52 ) | 54 ) |
53 | 55 |
54 my_class = getattr(sklearn.ensemble, algorithm) | 56 my_class = getattr(sklearn.ensemble, algorithm) |
55 estimator = my_class(**options) | 57 estimator = my_class(**options) |