view to_categorical.xml @ 1:f93f0cdbaf18 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ea12f973df4b97a2691d9e4ce6bf6fae59d57717"
author bgruening
date Sat, 01 May 2021 01:01:47 +0000
parents 59e8b4328c82
children ec69cbe34b73
line wrap: on
line source

<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>