Mercurial > repos > bgruening > sklearn_model_validation
annotate model_validation.xml @ 31:65f18ab91132 draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit d970dae980fbe349414fc0889f719d875d999c5b"
author | bgruening |
---|---|
date | Fri, 27 Aug 2021 09:39:58 +0000 |
parents | 4b359039f09f |
children | 1fe00785190d |
rev | line source |
---|---|
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
1 <tool id="sklearn_model_validation" name="Model Validation" version="@VERSION@" profile="20.05"> |
24
a5aed87b2cc0
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 5b2ac730ec6d3b762faa9034eddd19ad1b347476"
bgruening
parents:
21
diff
changeset
|
2 <description>includes cross_validate, cross_val_predict, learning_curve, and more</description> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
3 <macros> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
4 <import>main_macros.xml</import> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
5 </macros> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
6 <expand macro="python_requirements" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
7 <expand macro="macro_stdio" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
8 <version_command>echo "@VERSION@"</version_command> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
9 <command> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
10 <![CDATA[ |
20
5895fe0b8bde
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ba6a47bdf76bbf4cb276206ac1a8cbf61332fd16"
bgruening
parents:
19
diff
changeset
|
11 export HDF5_USE_FILE_LOCKING='FALSE'; |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
12 python "$sklearn_model_validation_script" '$inputs' |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
13 ]]> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
14 </command> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
15 <configfiles> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
16 <inputs name="inputs" /> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
17 <configfile name="sklearn_model_validation_script"> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
18 <![CDATA[ |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
19 import imblearn |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
20 import joblib |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
21 import json |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
22 import numpy as np |
24
a5aed87b2cc0
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 5b2ac730ec6d3b762faa9034eddd19ad1b347476"
bgruening
parents:
21
diff
changeset
|
23 import os |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
24 import pandas as pd |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
25 import pickle |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
26 import pprint |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
27 import skrebate |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
28 import sys |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
29 import warnings |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
30 import xgboost |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
31 from mlxtend import classifier, regressor |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
32 from sklearn import ( |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
33 cluster, compose, decomposition, ensemble, feature_extraction, |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
34 feature_selection, gaussian_process, kernel_approximation, metrics, |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
35 model_selection, naive_bayes, neighbors, pipeline, preprocessing, |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
36 svm, linear_model, tree, discriminant_analysis) |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
37 from sklearn.model_selection import _validation |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
38 |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
39 from galaxy_ml.utils import (SafeEval, get_cv, get_scoring, load_model, |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
40 read_columns, get_module) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
41 from galaxy_ml.model_validations import _fit_and_score |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
42 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
43 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
44 setattr(_validation, '_fit_and_score', _fit_and_score) |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
45 |
24
a5aed87b2cc0
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 5b2ac730ec6d3b762faa9034eddd19ad1b347476"
bgruening
parents:
21
diff
changeset
|
46 N_JOBS = int(os.environ.get('GALAXY_SLOTS', 1)) |
a5aed87b2cc0
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 5b2ac730ec6d3b762faa9034eddd19ad1b347476"
bgruening
parents:
21
diff
changeset
|
47 CACHE_DIR = os.path.join(os.getcwd(), 'cached') |
a5aed87b2cc0
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 5b2ac730ec6d3b762faa9034eddd19ad1b347476"
bgruening
parents:
21
diff
changeset
|
48 del os |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
49 ALLOWED_CALLBACKS = ('EarlyStopping', 'TerminateOnNaN', 'ReduceLROnPlateau', |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
50 'CSVLogger', 'None') |
16
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
51 |
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
52 warnings.filterwarnings('ignore') |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
53 |
12
2c1851992069
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit d00173591e4a783a4c1cb2664e4bb192ab5414f7
bgruening
parents:
11
diff
changeset
|
54 safe_eval = SafeEval() |
2
dd502cb0d567
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
bgruening
parents:
0
diff
changeset
|
55 |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
56 input_json_path = sys.argv[1] |
16
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
57 with open(input_json_path, 'r') as param_handler: |
8
fd7a054ffdbd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit f54ff2ba2f8e7542d68966ce5a6b17d7f624ac48
bgruening
parents:
5
diff
changeset
|
58 params = json.load(param_handler) |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
59 |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
60 ## load estimator |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
61 with open('$infile_estimator', 'rb') as estimator_handler: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
62 estimator = load_model(estimator_handler) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
63 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
64 estimator_params = estimator.get_params() |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
65 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
66 ## check estimator hyperparameters |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
67 memory = joblib.Memory(location=CACHE_DIR, verbose=0) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
68 # cache iraps_core fits could increase search speed significantly |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
69 if estimator.__class__.__name__ == 'IRAPSClassifier': |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
70 estimator.set_params(memory=memory) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
71 else: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
72 # For iraps buried in pipeline |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
73 for p, v in estimator_params.items(): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
74 if p.endswith('memory'): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
75 # for case of `__irapsclassifier__memory` |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
76 if len(p) > 8 and p[:-8].endswith('irapsclassifier'): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
77 # cache iraps_core fits could increase search |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
78 # speed significantly |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
79 new_params = {p: memory} |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
80 estimator.set_params(**new_params) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
81 # security reason, we don't want memory being |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
82 # modified unexpectedly |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
83 elif v: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
84 new_params = {p, None} |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
85 estimator.set_params(**new_params) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
86 # For now, 1 CPU is suggested for iprasclassifier |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
87 elif p.endswith('n_jobs'): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
88 new_params = {p: 1} |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
89 estimator.set_params(**new_params) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
90 # for security reason, types of callback are limited |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
91 elif p.endswith('callbacks'): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
92 for cb in v: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
93 cb_type = cb['callback_selection']['callback_type'] |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
94 if cb_type not in ALLOWED_CALLBACKS: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
95 raise ValueError( |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
96 "Prohibited callback type: %s!" % cb_type) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
97 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
98 ## store read dataframe object |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
99 loaded_df = {} |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
100 |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
101 #if $input_options.selected_input == 'tabular' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
102 header = 'infer' if params['input_options']['header1'] else None |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
103 column_option = params['input_options']['column_selector_options_1']['selected_column_selector_option'] |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
104 if column_option in ['by_index_number', 'all_but_by_index_number', 'by_header_name', 'all_but_by_header_name']: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
105 c = params['input_options']['column_selector_options_1']['col1'] |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
106 else: |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
107 c = None |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
108 infile1 = '$input_options.infile1' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
109 df_key = infile1 + repr(header) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
110 df = pd.read_csv(infile1, sep='\t', header=header, parse_dates=True) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
111 loaded_df[df_key] = df |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
112 X = read_columns(df, c=c, c_option=column_option).astype(float) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
113 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
114 #elif $input_options.selected_input == 'sparse': |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
115 X = mmread('$input_options.infile1') |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
116 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
117 #elif $input_options.selected_input == 'seq_fasta' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
118 fasta_path = '$input_options.fasta_path' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
119 pyfaidx = get_module('pyfaidx') |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
120 sequences = pyfaidx.Fasta(fasta_path) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
121 n_seqs = len(sequences.keys()) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
122 X = np.arange(n_seqs)[:, np.newaxis] |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
123 for param in estimator_params.keys(): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
124 if param.endswith('fasta_path'): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
125 estimator.set_params( |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
126 **{param: fasta_path}) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
127 break |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
128 else: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
129 raise ValueError( |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
130 "The selected estimator doesn't support " |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
131 "fasta file input! Please consider using " |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
132 "KerasGBatchClassifier with " |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
133 "FastaDNABatchGenerator/FastaProteinBatchGenerator " |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
134 "or having GenomeOneHotEncoder/ProteinOneHotEncoder " |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
135 "in pipeline!") |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
136 #elif $input_options.selected_input == 'refseq_and_interval' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
137 ref_seq = '$input_options.ref_genome_file' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
138 intervals = '$input_options.interval_file' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
139 targets = __import__('os').path.join(__import__('os').getcwd(), |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
140 '${target_file.element_identifier}.gz') |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
141 path_params = { |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
142 'data_batch_generator__ref_genome_path': ref_seq, |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
143 'data_batch_generator__intervals_path': intervals, |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
144 'data_batch_generator__target_path': targets |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
145 } |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
146 estimator.set_params(**path_params) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
147 n_intervals = sum(1 for line in open(intervals)) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
148 X = np.arange(n_intervals)[:, np.newaxis] |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
149 #end if |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
150 |
16
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
151 header = 'infer' if params['input_options']['header2'] else None |
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
152 column_option = params['input_options']['column_selector_options_2']['selected_column_selector_option2'] |
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
153 if column_option in ['by_index_number', 'all_but_by_index_number', 'by_header_name', 'all_but_by_header_name']: |
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
154 c = params['input_options']['column_selector_options_2']['col2'] |
3
424d8d21744d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 97c4f22cdcfa6cddeeffc7b102c418a7ff12a888
bgruening
parents:
2
diff
changeset
|
155 else: |
424d8d21744d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 97c4f22cdcfa6cddeeffc7b102c418a7ff12a888
bgruening
parents:
2
diff
changeset
|
156 c = None |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
157 infile2 = '$input_options.infile2' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
158 df_key = infile2 + repr(header) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
159 if df_key in loaded_df: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
160 infile2 = loaded_df[df_key] |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
161 else: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
162 infile2 = pd.read_csv(infile2, sep='\t', header=header, parse_dates=True) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
163 loaded_df[df_key] = infile2 |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
164 y = read_columns( |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
165 infile2, |
3
424d8d21744d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 97c4f22cdcfa6cddeeffc7b102c418a7ff12a888
bgruening
parents:
2
diff
changeset
|
166 c = c, |
424d8d21744d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 97c4f22cdcfa6cddeeffc7b102c418a7ff12a888
bgruening
parents:
2
diff
changeset
|
167 c_option = column_option, |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
168 sep='\t', |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
169 header=header, |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
170 parse_dates=True) |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
171 if len(y.shape) == 2 and y.shape[1] == 1: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
172 y = y.ravel() |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
173 #if $input_options.selected_input == 'refseq_and_interval' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
174 estimator.set_params( |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
175 data_batch_generator__features=y.ravel().tolist()) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
176 y = None |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
177 #end if |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
178 |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
179 ## handle options |
16
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
180 options = params['model_validation_functions']['options'] |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
181 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
182 #if $model_validation_functions.options.cv_selector.selected_cv\ |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
183 in ['GroupKFold', 'GroupShuffleSplit', 'LeaveOneGroupOut', 'LeavePGroupsOut']: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
184 infile_g = '$model_validation_functions.options.cv_selector.groups_selector.infile_g' |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
185 header = 'infer' if options['cv_selector']['groups_selector']['header_g'] else None |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
186 column_option = (options['cv_selector']['groups_selector']['column_selector_options_g'] |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
187 ['selected_column_selector_option_g']) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
188 if column_option in ['by_index_number', 'all_but_by_index_number', |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
189 'by_header_name', 'all_but_by_header_name']: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
190 c = (options['cv_selector']['groups_selector']['column_selector_options_g']['col_g']) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
191 else: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
192 c = None |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
193 df_key = infile_g + repr(header) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
194 if df_key in loaded_df: |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
195 infile_g = loaded_df[df_key] |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
196 groups = read_columns(infile_g, c=c, c_option=column_option, |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
197 sep='\t', header=header, parse_dates=True) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
198 groups = groups.ravel() |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
199 options['cv_selector']['groups_selector'] = groups |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
200 #end if |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
201 |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
202 ## del loaded_df |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
203 del loaded_df |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
204 |
16
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
205 splitter, groups = get_cv( options.pop('cv_selector') ) |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
206 options['cv'] = splitter |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
207 options['groups'] = groups |
12
2c1851992069
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit d00173591e4a783a4c1cb2664e4bb192ab5414f7
bgruening
parents:
11
diff
changeset
|
208 options['n_jobs'] = N_JOBS |
2c1851992069
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit d00173591e4a783a4c1cb2664e4bb192ab5414f7
bgruening
parents:
11
diff
changeset
|
209 if 'scoring' in options: |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
210 primary_scoring = options['scoring']['primary_scoring'] |
12
2c1851992069
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit d00173591e4a783a4c1cb2664e4bb192ab5414f7
bgruening
parents:
11
diff
changeset
|
211 options['scoring'] = get_scoring(options['scoring']) |
2
dd502cb0d567
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
bgruening
parents:
0
diff
changeset
|
212 if 'pre_dispatch' in options and options['pre_dispatch'] == '': |
dd502cb0d567
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
bgruening
parents:
0
diff
changeset
|
213 options['pre_dispatch'] = None |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
214 |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
215 ## Set up validator, run estimator through validator and return results. |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
216 |
16
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
217 validator = params['model_validation_functions']['selected_function'] |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
218 validator = getattr(_validation, validator) |
2
dd502cb0d567
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
bgruening
parents:
0
diff
changeset
|
219 |
16
86e1e2874460
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 57f4407e278a615f47a377a3328782b1d8e0b54d
bgruening
parents:
14
diff
changeset
|
220 selected_function = params['model_validation_functions']['selected_function'] |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
221 |
2
dd502cb0d567
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
bgruening
parents:
0
diff
changeset
|
222 if selected_function == 'cross_validate': |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
223 res = validator(estimator, X, y, **options) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
224 stat = {} |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
225 for k, v in res.items(): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
226 if k.startswith('test'): |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
227 stat['mean_' + k] = np.mean(v) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
228 stat['std_' + k] = np.std(v) |
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
229 res.update(stat) |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
230 rval = pd.DataFrame(res) |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
231 rval = rval[sorted(rval.columns)] |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
232 elif selected_function == 'cross_val_predict': |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
233 predicted = validator(estimator, X, y, **options) |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
234 if len(predicted.shape) == 1: |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
235 rval = pd.DataFrame(predicted, columns=['Predicted']) |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
236 else: |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
237 rval = pd.DataFrame(predicted) |
2
dd502cb0d567
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
bgruening
parents:
0
diff
changeset
|
238 elif selected_function == 'learning_curve': |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
239 try: |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
240 train_sizes = safe_eval(options['train_sizes']) |
30
4b359039f09f
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ea12f973df4b97a2691d9e4ce6bf6fae59d57717"
bgruening
parents:
28
diff
changeset
|
241 except Exception: |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
242 sys.exit("Unsupported train_sizes input! Supports int/float in tuple and array-like structure.") |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
243 if type(train_sizes) is tuple: |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
244 train_sizes = np.linspace(*train_sizes) |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
245 options['train_sizes'] = train_sizes |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
246 train_sizes_abs, train_scores, test_scores = validator(estimator, X, y, **options) |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
247 rval = pd.DataFrame(dict( |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
248 train_sizes_abs = train_sizes_abs, |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
249 mean_train_scores = np.mean(train_scores, axis=1), |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
250 std_train_scores = np.std(train_scores, axis=1), |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
251 mean_test_scores = np.mean(test_scores, axis=1), |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
252 std_test_scores = np.std(test_scores, axis=1))) |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
253 rval = rval[['train_sizes_abs', 'mean_train_scores', 'std_train_scores', |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
254 'mean_test_scores', 'std_test_scores']] |
2
dd502cb0d567
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
bgruening
parents:
0
diff
changeset
|
255 elif selected_function == 'permutation_test_score': |
19
efbec977a47d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 60f0fbc0eafd7c11bc60fb6c77f2937782efd8a9-dirty
bgruening
parents:
17
diff
changeset
|
256 score, permutation_scores, pvalue = validator(estimator, X, y, **options) |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
257 permutation_scores_df = pd.DataFrame(dict( |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
258 permutation_scores = permutation_scores)) |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
259 score_df = pd.DataFrame(dict( |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
260 score = [score], |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
261 pvalue = [pvalue])) |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
262 rval = pd.concat([score_df[['score', 'pvalue']], permutation_scores_df], axis=1) |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
263 |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
264 rval.to_csv(path_or_buf='$outfile', sep='\t', header=True, index=False) |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
265 |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
266 ]]> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
267 </configfile> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
268 </configfiles> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
269 <inputs> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
270 <param name="infile_estimator" type="data" format="zip" label="Choose the dataset containing model/pipeline object" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
271 <conditional name="model_validation_functions"> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
272 <param name="selected_function" type="select" label="Select a model validation function"> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
273 <option value="cross_validate">cross_validate - Evaluate metric(s) by cross-validation and also record fit/score times</option> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
274 <option value="cross_val_predict">cross_val_predict - Generate cross-validated estimates for each input data point</option> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
275 <option value="learning_curve">learning_curve - Learning curve</option> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
276 <option value="permutation_test_score">permutation_test_score - Evaluate the significance of a cross-validated score with permutations</option> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
277 <option value="validation_curve">validation_curve - Use grid search with one parameter instead</option> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
278 </param> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
279 <when value="cross_validate"> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
280 <section name="options" title="Other Options" expanded="false"> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
281 <expand macro="scoring_selection" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
282 <expand macro="model_validation_common_options" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
283 <param argument="return_train_score" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolfalse" checked="false" help="Whether to include train scores." /> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
284 <!--param argument="return_estimator" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolfalse" checked="false" help="Whether to return the estimators fitted on each split."/> --> |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
285 <!--param argument="error_score" type="boolean" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="Raise fit error:" help="If false, the metric score is assigned to NaN if an error occurs in estimator fitting and FitFailedWarning is raised."/> --> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
286 <!--fit_params--> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
287 <expand macro="pre_dispatch" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
288 </section> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
289 </when> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
290 <when value="cross_val_predict"> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
291 <section name="options" title="Other Options" expanded="false"> |
2
dd502cb0d567
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 4ed8c4f6ef9ece81797a398b17a99bbaf49a6978
bgruening
parents:
0
diff
changeset
|
292 <expand macro="model_validation_common_options" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
293 <!--fit_params--> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
294 <expand macro="pre_dispatch" value="2*n_jobs’" help="Controls the number of jobs that get dispatched during parallel execution" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
295 <param argument="method" type="select" label="Invokes the passed method name of the passed estimator"> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
296 <option value="predict" selected="true">predict</option> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
297 <option value="predict_proba">predict_proba</option> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
298 </param> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
299 </section> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
300 </when> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
301 <when value="learning_curve"> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
302 <section name="options" title="Other Options" expanded="false"> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
303 <expand macro="scoring_selection" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
304 <expand macro="model_validation_common_options" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
305 <param argument="train_sizes" type="text" value="(0.1, 1.0, 5)" label="train_sizes" help="Relative or absolute numbers of training examples that will be used to generate the learning curve. Supports 1) tuple, to be evaled by np.linspace, e.g. (0.1, 1.0, 5); 2) array-like, e.g. [0.1 , 0.325, 0.55 , 0.775, 1.]"> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
306 <sanitizer> |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
307 <valid initial="default"> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
308 <add value="[" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
309 <add value="]" /> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
310 </valid> |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
311 </sanitizer> |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
312 </param> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
313 <param argument="exploit_incremental_learning" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolfalse" checked="false" help="Whether to apply incremental learning to speed up fitting of the estimator if supported" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
314 <expand macro="pre_dispatch" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
315 <expand macro="shuffle" checked="false" label="shuffle" help="Whether to shuffle training data before taking prefixes" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
316 <expand macro="random_state" help_text="If int, the seed used by the random number generator. Used when `shuffle` is True" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
317 </section> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
318 </when> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
319 <when value="permutation_test_score"> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
320 <section name="options" title="Other Options" expanded="false"> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
321 <expand macro="scoring_selection" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
322 <expand macro="model_validation_common_options" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
323 <param name="n_permutations" type="integer" value="100" optional="true" label="n_permutations" help="Number of times to permute y" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
324 <expand macro="random_state" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
325 </section> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
326 </when> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
327 <when value="validation_curve" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
328 </conditional> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
329 <expand macro="sl_mixed_input_plus_sequence" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
330 </inputs> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
331 <outputs> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
332 <data format="tabular" name="outfile" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
333 </outputs> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
334 <tests> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
335 <test> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
336 <param name="infile_estimator" value="pipeline02" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
337 <param name="selected_function" value="cross_validate" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
338 <param name="return_train_score" value="True" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
339 <param name="infile1" value="regression_train.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
340 <param name="col1" value="1,2,3,4,5" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
341 <param name="infile2" value="regression_train.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
342 <param name="col2" value="6" /> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
343 <output name="outfile"> |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
344 <assert_contents> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
345 <has_n_columns n="6" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
346 <has_text text="0.9999961390418067" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
347 <has_text text="0.9944541531269271" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
348 <has_text text="0.9999193322454393" /> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
349 </assert_contents> |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
350 </output> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
351 </test> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
352 <test> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
353 <param name="infile_estimator" value="pipeline02" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
354 <param name="selected_function" value="cross_val_predict" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
355 <param name="infile1" value="regression_train.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
356 <param name="col1" value="1,2,3,4,5" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
357 <param name="infile2" value="regression_train.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
358 <param name="col2" value="6" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
359 <output name="outfile" file="mv_result02.tabular" lines_diff="14" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
360 </test> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
361 <test> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
362 <param name="infile_estimator" value="pipeline05" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
363 <param name="selected_function" value="learning_curve" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
364 <param name="infile1" value="regression_X.tabular" ftype="tabular" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
365 <param name="header1" value="true" /> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
366 <param name="col1" value="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
367 <param name="infile2" value="regression_y.tabular" ftype="tabular" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
368 <param name="header2" value="true" /> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
369 <param name="col2" value="1" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
370 <output name="outfile" file="mv_result03.tabular" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
371 </test> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
372 <test> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
373 <param name="infile_estimator" value="pipeline05" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
374 <param name="selected_function" value="permutation_test_score" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
375 <param name="infile1" value="regression_train.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
376 <param name="col1" value="1,2,3,4,5" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
377 <param name="infile2" value="regression_train.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
378 <param name="col2" value="6" /> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
379 <output name="outfile"> |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
380 <assert_contents> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
381 <has_n_columns n="3" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
382 <has_text text="0.25697059258228816" /> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
383 </assert_contents> |
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
384 </output> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
385 </test> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
386 <test> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
387 <param name="infile_estimator" value="pipeline05" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
388 <param name="selected_function" value="cross_val_predict" /> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
389 <section name="groups_selector"> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
390 <param name="infile_groups" value="regression_y.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
391 <param name="header_g" value="true" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
392 <param name="selected_column_selector_option_g" value="by_index_number" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
393 <param name="col_g" value="1" /> |
17
cf9aa11b91c8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ab963ec9498bd05d2fb2f24f75adb2fccae7958c
bgruening
parents:
16
diff
changeset
|
394 </section> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
395 <param name="selected_cv" value="GroupKFold" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
396 <param name="infile1" value="regression_X.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
397 <param name="header1" value="true" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
398 <param name="col1" value="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
399 <param name="infile2" value="regression_y.tabular" ftype="tabular" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
400 <param name="header2" value="true" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
401 <param name="col2" value="1" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
402 <output name="outfile" file="mv_result05.tabular" /> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
403 </test> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
404 </tests> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
405 <help> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
406 <![CDATA[ |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
407 **What it does** |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
408 This tool includes model validation functions to evaluate estimator performance in the cross-validation approach. This tool is based on |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
409 sklearn.model_selection package. |
9
c6b3efcba7bd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 76583c1fcd9d06a4679cc46ffaee44117b9e22cd
bgruening
parents:
8
diff
changeset
|
410 For information about model validation functions and their parameter settings please refer to `Scikit-learn model_selection`_. |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
411 |
9
c6b3efcba7bd
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 76583c1fcd9d06a4679cc46ffaee44117b9e22cd
bgruening
parents:
8
diff
changeset
|
412 .. _`Scikit-learn model_selection`: http://scikit-learn.org/stable/modules/classes.html#module-sklearn.model_selection |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
413 ]]> |
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
414 </help> |
13
badd86b9ce24
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 8cf3d813ec755166ee0bd517b4ecbbd4f84d4df1
bgruening
parents:
12
diff
changeset
|
415 <expand macro="sklearn_citation"> |
28
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
416 <expand macro="skrebate_citation" /> |
9b017b0da56e
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04"
bgruening
parents:
24
diff
changeset
|
417 <expand macro="xgboost_citation" /> |
13
badd86b9ce24
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 8cf3d813ec755166ee0bd517b4ecbbd4f84d4df1
bgruening
parents:
12
diff
changeset
|
418 </expand> |
0
333507faecab
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2e1e78576b38110cf5b1f2ed83b08b9c3a6cbfee
bgruening
parents:
diff
changeset
|
419 </tool> |