Mercurial > repos > bgruening > sklearn_nn_classifier
comparison nn_classifier.xml @ 6:e972a913e61a draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 8cf3d813ec755166ee0bd517b4ecbbd4f84d4df1
author | bgruening |
---|---|
date | Thu, 23 Aug 2018 16:15:30 -0400 |
parents | 753ebd417b17 |
children | 5072ac474cd5 |
comparison
equal
deleted
inserted
replaced
5:753ebd417b17 | 6:e972a913e61a |
---|---|
17 import sys | 17 import sys |
18 import json | 18 import json |
19 import numpy as np | 19 import numpy as np |
20 import sklearn.neighbors | 20 import sklearn.neighbors |
21 import pandas | 21 import pandas |
22 import pickle | |
23 | 22 |
24 execfile("$__tool_directory__/utils.py") | 23 execfile("$__tool_directory__/sk_whitelist.py") |
24 execfile("$__tool_directory__/utils.py", globals()) | |
25 | 25 |
26 input_json_path = sys.argv[1] | 26 input_json_path = sys.argv[1] |
27 with open(input_json_path, "r") as param_handler: | 27 with open(input_json_path, "r") as param_handler: |
28 params = json.load(param_handler) | 28 params = json.load(param_handler) |
29 | 29 |
30 #if $selected_tasks.selected_task == "load": | 30 #if $selected_tasks.selected_task == "load": |
31 | 31 |
32 with open("$infile_model", 'rb') as model_handler: | 32 with open("$infile_model", 'rb') as model_handler: |
33 classifier_object = pickle.load(model_handler) | 33 classifier_object = SafePickler.load(model_handler) |
34 | 34 |
35 header = 'infer' if params["selected_tasks"]["header"] else None | 35 header = 'infer' if params["selected_tasks"]["header"] else None |
36 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=header, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False) | 36 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=header, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False) |
37 prediction = classifier_object.predict(data) | 37 prediction = classifier_object.predict(data) |
38 prediction_df = pandas.DataFrame(prediction) | 38 prediction_df = pandas.DataFrame(prediction) |