diff to_categorical.xml @ 0:59e8b4328c82 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 208a8d348e7c7a182cfbe1b6f17868146428a7e2"
author bgruening
date Tue, 13 Apr 2021 22:40:10 +0000
parents
children ec69cbe34b73
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/to_categorical.xml	Tue Apr 13 22:40:10 2021 +0000
@@ -0,0 +1,93 @@
+<tool id="sklearn_to_categorical" name="To categorical" version="@VERSION@" profile="20.05">
+    <description>Converts a class vector (integers) to binary class matrix</description>
+    <macros>
+        <import>main_macros.xml</import>
+    </macros>
+    <expand macro="python_requirements" />
+    <expand macro="macro_stdio" />
+    <version_command>echo "@VERSION@"</version_command>
+    <command detect_errors="exit_code"><![CDATA[
+        python '$__tool_directory__/to_categorical.py'
+            --inputs '$inputs'
+            --infile '$infile'
+            #if $num_classes
+            --num_classes '$num_classes'
+            #end if
+            --outfile '$outfile'
+    ]]>
+    </command>
+    <configfiles>
+        <inputs name="inputs" />
+    </configfiles>
+    <inputs>
+        <param name="infile" type="data" format="tabular" label="Input file" />
+        <param name="header0" type="boolean" optional="true" truevalue="booltrue" falsevalue="boolfalse" checked="true" label="Does the dataset contain header?" />
+        <param name="num_classes" type="integer" optional="true" label="Total number of classes" />
+    </inputs>
+    <outputs>
+        <data name="outfile" format="tabular" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="infile" value="ohe_in_w_header.tabular" ftype="tabular" />
+            <param name="header0" value="true" />
+            <output name="outfile" file="ohe_out_4.tabular" ftype="tabular" />
+        </test>
+        <test>
+            <param name="infile" value="ohe_in_w_header.tabular" ftype="tabular" />
+            <param name="header0" value="true" />
+            <param name="num_classes" value="4" />
+            <output name="outfile" file="ohe_out_4.tabular" ftype="tabular" />
+        </test>
+        <test>
+            <param name="infile" value="ohe_in_w_header.tabular" ftype="tabular" />
+            <param name="header0" value="true" />
+            <param name="num_classes" value="5" />
+            <output name="outfile" file="ohe_out_5.tabular" ftype="tabular" />
+        </test>
+        <test>
+            <param name="infile" value="ohe_in_wo_header.tabular" ftype="tabular" />
+            <param name="header0" value="false" />
+            <output name="outfile" file="ohe_out_4.tabular" ftype="tabular" />
+        </test>
+        <test>
+            <param name="infile" value="ohe_in_wo_header.tabular" ftype="tabular" />
+            <param name="header0" value="false" />
+            <param name="num_classes" value="4" />
+            <output name="outfile" file="ohe_out_4.tabular" ftype="tabular" />
+        </test>
+        <test>
+            <param name="infile" value="ohe_in_wo_header.tabular" ftype="tabular" />
+            <param name="header0" value="false" />
+            <param name="num_classes" value="5" />
+            <output name="outfile" file="ohe_out_5.tabular" ftype="tabular" />
+        </test>
+    </tests>
+    <help><![CDATA[
+**What it does**
+
+Converts a class vector (integers) to binary class matrix.
+
+tf.keras.utils.to_categorical(
+    y, num_classes=None, dtype='float32'
+)
+
+E.g. for use with categorical_crossentropy.
+
+Arguments
+
+y: a vector of numbers to be converted into a matrix of one-hot encoded values.
+num_classes: total number of classes. If None, this would be inferred as the (largest number in y) + 1.
+dtype: The data type expected by the input. Default: 'float32'.
+
+Returns
+
+A binary matrix representation of the input. The classes axis is placed last.
+
+Raises
+
+Value Error: If input contains string value
+
+    ]]>    </help>
+    <expand macro="sklearn_citation" />
+</tool>