diff clf_metrics.xml @ 1:65bd390f50ae draft

planemo upload for repository https://github.com/bgruening/galaxytools/tools/sklearn commit 0e582cf1f3134c777cce3aa57d71b80ed95e6ba9
author bgruening
date Fri, 16 Feb 2018 09:14:43 -0500
parents 8d7f8dc7c347
children 6d1b3653d6a6
line wrap: on
line diff
--- a/clf_metrics.xml	Thu Jun 23 15:26:39 2016 -0400
+++ b/clf_metrics.xml	Fri Feb 16 09:14:43 2018 -0500
@@ -30,7 +30,10 @@
 y_t = columns("$clf_metrics.infile1","$clf_metrics.col1")
 y_p = columns("$clf_metrics.infile2","$clf_metrics.col2")
 
-options = params["clf_metrics"]["options"]
+options = params["clf_metrics"].get("options", {})
+print(options)
+if options and options.get('average', '') == 'None':
+    options['average'] = None
 metric = params["clf_metrics"]["selected_metric"]
 metric_function = getattr(metrics, metric)
 res = metric_function(y_t,y_p,**options)
@@ -68,7 +71,8 @@
                 <expand macro="clf_inputs"/>
                 <section name="options" title="Advanced Options" expanded="False">
                     <!--sample_weight-->
-                    <param argument="normalize" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolflase" checked="true" label="Normalize" help="If false, returns the number of correctly classified samples. Otherwise, returns the fraction of correctly classified samples. "/>
+                    <param argument="normalize" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolflase" checked="true"
+                        label="Normalize" help="If false, returns the number of correctly classified samples. Otherwise, returns the fraction of correctly classified samples. "/>
                 </section>
             </when>
             <when value="classification_report">
@@ -87,7 +91,7 @@
                     <!--sample_weight-->
                     <expand macro="pos_label" default_value="1"/>
                     <expand macro="average">
-                        <option value="binary" selected="true" help="Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary.">binary</option>
+                        <option value="binary" selected="true">Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary. (binary)</option>
                     </expand>
                 </section>
             </when>
@@ -99,15 +103,15 @@
                     <!--sample_weight-->
                     <expand macro="pos_label" default_value="1"/>
                     <expand macro="average">
-                        <option value="binary" selected="true" help="Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary.">binary</option>
+                        <option value="binary" selected="true">Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary. (binary)</option>
                     </expand>
                 </section>
             </when>
             <when value="hamming_loss">
                 <expand macro="clf_inputs"/>
-                <section name="options" title="Advanced Options" expanded="False">
-                    <!--classes-->
-                </section>
+                <!--section name="options" title="Advanced Options" expanded="False">
+                    <!- -classes- ->
+                </section-->
             </when>
             <when value="jaccard_similarity_score">
                 <expand macro="clf_inputs"/>
@@ -124,7 +128,7 @@
                     <!--warn_for-->
                     <expand macro="pos_label" default_value="1"/>
                     <expand macro="average">
-                        <option value="binary" selected="true" help="Only report results for the class specified by pos_label. Applicable only on binary classification.">binary</option>
+                        <option value="binary" selected="true">Only report results for the class specified by pos_label. Applicable only on binary classification. (binary)</option>
                     </expand>
                 </section>
             </when>
@@ -135,7 +139,7 @@
                     <!--sample_weight-->
                     <expand macro="pos_label" default_value="1"/>
                     <expand macro="average">
-                        <option value="binary" selected="true" help="Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary.">binary</option>
+                        <option value="binary" selected="true">Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary. (binary)</option>
                     </expand>
                 </section>
             </when>
@@ -146,7 +150,7 @@
                     <!--sample_weight-->
                     <expand macro="pos_label" default_value="1"/>
                     <expand macro="average">
-                        <option value="binary" selected="true" help="Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary.">binary</option>
+                        <option value="binary" selected="true">Only report results for the class specified by pos_label. This is applicable only if targets (y_{true,pred}) are binary. (binary)</option>
                     </expand>
                 </section>
             </when>
@@ -166,20 +170,20 @@
             <when value="brier_score_loss">
                 <expand macro="clf_inputs"/>
                 <section name="options" title="Advanced Options" expanded="False">
-                    <!--weights-->>
+                    <!--weights-->
                     <expand macro="pos_label"/>
                 </section>
             </when>
             <when value="matthews_corrcoef">
                 <expand macro="clf_inputs"/>
-                <section name="options" title="Advanced Options" expanded="False">
-                </section>
+                <!--section name="options" title="Advanced Options" expanded="False">
+                </section-->
             </when>
             <when value="confusion_matrix">
                 <expand macro="clf_inputs"/>
-                <section name="options" title="Advanced Options" expanded="False">
-                    <!--labels-->
-                </section>
+                <!--section name="options" title="Advanced Options" expanded="False">
+                    <!- -labels- ->
+                </section-->
             </when>
             <when value="precision_recall_curve">
                 <expand macro="clf_inputs"/>
@@ -198,30 +202,32 @@
             </when>
             <when value="hinge_loss">
                 <expand macro="clf_inputs" multiple="true"/>
-                <section name="options" title="Advanced Options" expanded="False">
-                    <!--labels-->
-                    <!--sample_weight-->
-                </section>
+                <!--section name="options" title="Advanced Options" expanded="False">
+                    <!- -labels- ->
+                    <!- -sample_weight- ->
+                </section-->
             </when>
             <when value="log_loss">
                 <expand macro="clf_inputs" multiple="true"/>
                 <section name="options" title="Advanced Options" expanded="False">
                     <!--sample_weight-->
-                    <param argument="eps" type="float" value="1e-15" label="Clipping factor" help="Log loss is undefined for p=0 or p=1, so probabilities are     clipped to max(eps, min(1 - eps, p)). "/>
-                    <param argument="normalize" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolflase" checked="true" label="Normalize" help="If true, returns the mean loss per sample. Otherwise, returns the sum of the per-sample losses. "/>
+                    <param argument="eps" type="float" value="1e-15" label="Clipping factor"
+                        help="Log loss is undefined for p=0 or p=1, so probabilities are     clipped to max(eps, min(1 - eps, p)). "/>
+                    <param argument="normalize" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolflase" checked="true"
+                        label="Normalize" help="If true, returns the mean loss per sample. Otherwise, returns the sum of the per-sample losses. "/>
                 </section>
             </when>
             <when value="average_precision_score">
                 <expand macro="clf_inputs" multiple1="true" multiple="true"/>
-                <section name="options" title="Advanced Options" expanded="False">
-                    <!--average='macro', sample_weight=None-->
-                </section>
+                <!-- section name="options" title="Advanced Options" expanded="False">
+                    <!- -average='macro', sample_weight=None- ->
+                </section-->
             </when>
             <when value="roc_auc_score">
                 <expand macro="clf_inputs" multiple1="true" multiple="true"/>
                 <section name="options" title="Advanced Options" expanded="False">
                     <expand macro="average">
-                        <option value="macro" selected="true" help="Calculate metrics for each label, and find their unweighted mean.">macro</option>
+                        <option value="macro" selected="true">Calculate metrics for each label, and find their unweighted mean. (macro)</option>
                     </expand>
                 </section>
             </when>
@@ -253,7 +259,7 @@
             <param name="col1" value="1"/>
             <param name="infile2" value="y.tabular" ftype="tabular"/>
             <param name="col2" value="2"/>
-            <param name="average" value="binary"/>
+            <param name="average" value="micro"/>
             <output name="outfile" file="f1_score.txt"/>
         </test>
         <test>
@@ -262,6 +268,7 @@
             <param name="col1" value="1"/>
             <param name="infile2" value="y.tabular" ftype="tabular"/>
             <param name="col2" value="2"/>
+            <param name="average" value="micro"/>
             <output name="outfile" file="fbeta_score.txt"/>
         </test>
         <test>
@@ -286,6 +293,7 @@
             <param name="col1" value="1"/>
             <param name="infile2" value="y.tabular" ftype="tabular"/>
             <param name="col2" value="2"/>
+            <param name="average" value="micro"/>
             <output name="outfile" file="precision_recall_fscore_support.txt"/>
         </test>
         <test>
@@ -294,6 +302,7 @@
             <param name="col1" value="1"/>
             <param name="infile2" value="y.tabular" ftype="tabular"/>
             <param name="col2" value="2"/>
+            <param name="average" value="micro"/>
             <output name="outfile" file="precision_score.txt"/>
         </test>
         <test>
@@ -302,6 +311,7 @@
             <param name="col1" value="1"/>
             <param name="infile2" value="y.tabular" ftype="tabular"/>
             <param name="col2" value="2"/>
+            <param name="average" value="micro"/>
             <output name="outfile" file="recall_score.txt"/>
         </test>
         <test>
@@ -397,7 +407,7 @@
     <help>
         <![CDATA[
 **What it does**
-This tool provides several loss, score, and utility functions to measure classification performance. Some metrics might require probability estimates of the positive class, confidence values, or binary decisions values. This tool is based on 
+This tool provides several loss, score, and utility functions to measure classification performance. Some metrics might require probability estimates of the positive class, confidence values, or binary decisions values. This tool is based on
 sklearn.metrics package.
 For information about classification metric functions and their parameter settings please refer to `Scikit-learn classification metrics`_.