annotate discriminant.xml @ 0:e0067d9baffc draft

planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
author bgruening
date Fri, 16 Feb 2018 09:19:24 -0500
parents
children f46da2feb233
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
1 <tool id="sklearn_discriminant_classifier" name="Discriminant Analysis" version="@VERSION@">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
2 <description></description>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
3 <macros>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
4 <import>main_macros.xml</import>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
5 <!--macro name="priors"-->
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
6 </macros>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
7 <expand macro="python_requirements"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
8 <expand macro="macro_stdio"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
9 <version_command>echo "@VERSION@"</version_command>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
10 <command><![CDATA[
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
11 python "$discriminant_script" '$inputs'
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
12 ]]>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
13 </command>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
14 <configfiles>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
15 <inputs name="inputs"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
16 <configfile name="discriminant_script">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
17 <![CDATA[
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
18 import sys
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
19 import json
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
20 import numpy as np
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
21 import sklearn.discriminant_analysis
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
22 import pandas
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
23 import pickle
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
24
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
25 input_json_path = sys.argv[1]
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
26 params = json.load(open(input_json_path, "r"))
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
27
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
28
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
29 #if $selected_tasks.selected_task == "load":
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
30
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
31 classifier_object = pickle.load(open("$infile_model", 'r'))
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
32
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
33 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False )
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
34 prediction = classifier_object.predict(data)
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
35 prediction_df = pandas.DataFrame(prediction)
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
36 res = pandas.concat([data, prediction_df], axis=1)
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
37 res.to_csv(path_or_buf = "$outfile_predict", sep="\t", index=False)
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
38
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
39 #else:
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
40
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
41 data_train = pandas.read_csv("$selected_tasks.infile_train", sep='\t', header=0, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False )
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
42
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
43 data = data_train.ix[:,0:len(data_train.columns)-1]
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
44 labels = np.array(data_train[data_train.columns[len(data_train.columns)-1]])
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
45
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
46 options = params["selected_tasks"]["selected_algorithms"]["options"]
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
47 selected_algorithm = params["selected_tasks"]["selected_algorithms"]["selected_algorithm"]
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
48
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
49 my_class = getattr(sklearn.discriminant_analysis, selected_algorithm)
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
50 classifier_object = my_class(**options)
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
51 classifier_object.fit(data,labels)
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
52 pickle.dump(classifier_object,open("$outfile_fit", 'w+'), pickle.HIGHEST_PROTOCOL)
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
53
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
54 #end if
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
55 ]]>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
56 </configfile>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
57 </configfiles>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
58 <inputs>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
59 <expand macro="train_loadConditional" model="zip">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
60 <param name="selected_algorithm" type="select" label="Classifier type">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
61 <option value="LinearDiscriminantAnalysis" selected="true">Linear Discriminant Classifier</option>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
62 <option value="QuadraticDiscriminantAnalysis">Quadratic Discriminant Classifier</option>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
63 </param>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
64 <when value="LinearDiscriminantAnalysis">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
65 <section name="options" title="Advanced Options" expanded="False">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
66 <param argument="solver" type="select" optional="true" label="Solver" help="">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
67 <option value="svd" selected="true">Singular Value Decomposition</option>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
68 <option value="lsqr">Least Squares Solution</option>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
69 <option value="eigen">Eigenvalue Decomposition</option>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
70 </param>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
71 <!--param name="shrinkage"-->
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
72 <!--expand macro="priors"/-->
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
73 <param argument="n_components" type="integer" optional="true" value="" label="Number of components"
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
74 help="Number of components for dimensionality reduction. ( always less than n_classes - 1 )"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
75 <expand macro="tol" default_value="0.0001" help_text="Rank estimation threshold used in SVD solver."/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
76 <param argument="store_covariance" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolflase" checked="false"
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
77 label="Store covariance" help="Compute class covariance matrix."/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
78 </section>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
79 </when>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
80 <when value="QuadraticDiscriminantAnalysis">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
81 <section name="options" title="Advanced Options" expanded="False">
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
82 <!--expand macro="priors"/-->
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
83 <param argument="reg_param" type="float" optional="true" value="0.0" label="Regularization coefficient" help="Covariance estimate regularizer."/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
84 <expand macro="tol" default_value="0.00001" help_text="Rank estimation threshold used in SVD solver."/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
85 <param argument="store_covariances" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolflase" checked="false"
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
86 label="Store covariances" help="Compute class covariance matrixes."/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
87 </section>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
88 </when>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
89 </expand>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
90 </inputs>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
91 <expand macro="output"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
92 <tests>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
93 <test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
94 <param name="infile_train" value="train.tabular" ftype="tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
95 <param name="selected_task" value="train"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
96 <param name="selected_algorithm" value="LinearDiscriminantAnalysis"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
97 <param name="solver" value="svd" />
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
98 <param name="store_covariances" value="True"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
99 <output name="outfile_fit" file="lda_model01" compare="sim_size" delta="500"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
100 </test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
101 <test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
102 <param name="infile_train" value="train.tabular" ftype="tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
103 <param name="selected_task" value="train"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
104 <param name="selected_algorithm" value="LinearDiscriminantAnalysis"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
105 <param name="solver" value="lsqr"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
106 <output name="outfile_fit" file="lda_model02" compare="sim_size" delta="500"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
107 </test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
108 <test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
109 <param name="infile_train" value="train.tabular" ftype="tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
110 <param name="selected_task" value="train"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
111 <param name="selected_algorithm" value="QuadraticAnalysis"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
112 <output name="outfile_fit" file="qda_model01" compare="sim_size" delta="500"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
113 </test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
114 <test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
115 <param name="infile_model" value="lda_model01" ftype="zip"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
116 <param name="infile_data" value="test.tabular" ftype="tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
117 <param name="selected_task" value="load"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
118 <output name="outfile_predict" file="lda_prediction_result01.tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
119 </test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
120 <test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
121 <param name="infile_model" value="lda_model02" ftype="zip"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
122 <param name="infile_data" value="test.tabular" ftype="tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
123 <param name="selected_task" value="load"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
124 <output name="outfile_predict" file="lda_prediction_result02.tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
125 </test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
126 <test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
127 <param name="infile_model" value="qda_model01" ftype="zip"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
128 <param name="infile_data" value="test.tabular" ftype="tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
129 <param name="selected_task" value="load"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
130 <output name="outfile_predict" file="qda_prediction_result01.tabular"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
131 </test>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
132 </tests>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
133 <help><![CDATA[
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
134 ***What it does***
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
135 Linear and Quadratic Discriminant Analysis are two classic classifiers with a linear and a quadratic decision surface respectively. These classifiers are fast and easy to interprete.
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
136
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
137
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
138 **1 - Training input**
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
139
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
140 When you choose to train a model, discriminant analysis tool expects a tabular file with numeric values, the order of the columns being as follows:
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
141
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
142 ::
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
143
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
144 "feature_1" "feature_2" "..." "feature_n" "class_label"
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
145
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
146 **Example for training data**
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
147 The following training dataset contains 3 feature columns and a column containing class labels:
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
148
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
149 ::
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
150
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
151 4.01163365529 -6.10797684314 8.29829894763 1
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
152 10.0788438916 1.59539821454 10.0684278289 0
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
153 -5.17607775503 -0.878286135332 6.92941850665 2
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
154 4.00975406235 -7.11847496542 9.3802423585 1
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
155 4.61204065139 -5.71217537352 9.12509610964 1
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
156
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
157
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
158 **2 - Trainig output**
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
159
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
160 Based on your choice, this tool fits a sklearn discriminant_analysis.LinearDiscriminantAnalysis or discriminant_analysis.QuadraticDiscriminantAnalysis on the traning data and outputs the trained model in the form of pickled object in a text file.
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
161
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
162
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
163 **3 - Prediction input**
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
164
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
165 When you choose to load a model and do prediction, the tool expects an already trained Discriminant Analysis estimator and a tabular dataset as input. The dataset is a tabular file with new samples which you want to classify. It just contains feature columns.
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
166
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
167 **Example for prediction data**
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
168
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
169 ::
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
170
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
171 8.26530668997 2.96705005011 8.88881190248
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
172 2.96366327113 -3.76295851562 11.7113372463
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
173 8.13319631944 -0.223645298585 10.5820605308
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
174
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
175 .. class:: warningmark
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
176
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
177 The number of feature columns must be the same in training and prediction datasets!
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
178
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
179
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
180 **3 - Prediction output**
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
181 The tool predicts the class labels for new samples and adds them as the last column to the prediction dataset. The new dataset then is output as a tabular file. The prediction output format should look like the training dataset.
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
182
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
183 Discriminant Analysis is based on sklearn.discriminant_analysis library from Scikit-learn.
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
184 For more information please refer to `Scikit-learn site`_.
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
185
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
186 .. _`Scikit-learn site`: http://scikit-learn.org/stable/modules/lda_qda.html
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
187
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
188 ]]></help>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
189 <expand macro="sklearn_citation"/>
e0067d9baffc planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
bgruening
parents:
diff changeset
190 </tool>