diff ml_visualization_ex.xml @ 0:f96efab83b65 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit ba6a47bdf76bbf4cb276206ac1a8cbf61332fd16"
author bgruening
date Fri, 13 Sep 2019 12:23:39 -0400
parents
children 09efff9a5765
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ml_visualization_ex.xml	Fri Sep 13 12:23:39 2019 -0400
@@ -0,0 +1,184 @@
+<tool id="ml_visualization_ex" name="Machine Learning Visualization Extension" version="@VERSION@">
+    <description>includes several types of plotting for machine learning</description>
+    <macros>
+        <import>main_macros.xml</import>
+        <import>keras_macros.xml</import>
+    </macros>
+    <expand macro="python_requirements">
+        <requirement type="package" version="3.1.1">plotly</requirement>
+        <requirement type="package" version="2.40.1">graphviz</requirement>
+        <requirement type="package" version="1.4.1">pydot</requirement>
+    </expand>
+    <expand macro="macro_stdio"/>
+    <version_command>echo "@VERSION@"</version_command>
+    <command>
+        <![CDATA[
+        python '$__tool_directory__/ml_visualization_ex.py' 
+            --inputs '$inputs'
+            #if $plotting_selection.plot_type in ['learning_curve', 'rfecv_gridscores']
+            --infile1 '$plotting_selection.infile1'
+            #elif $plotting_selection.plot_type in ['pr_curve', 'roc_curve']
+            --infile1 '$plotting_selection.infile1'
+            --infile2 '$plotting_selection.infile2'
+            #elif $plotting_selection.plot_type == 'feature_importances'
+            --estimator '$plotting_selection.infile_estimator'
+            --infile1 '$plotting_selection.infile1'
+            #elif $plotting_selection.plot_type == 'keras_plot_model'
+            --model_config '$plotting_selection.infile_model_config'
+            #end if
+        ]]>
+    </command>
+    <configfiles>
+        <inputs name="inputs" />
+    </configfiles>
+    <inputs>
+        <conditional name="plotting_selection">
+            <param name="plot_type" type="select" label="Select a plotting type">
+                <option value="learning_curve" selected="true">Learning curve</option>
+                <option value="pr_curve">2-class Precison Recall curve</option>
+                <option value="roc_curve">2-class Receiver Operating Characteristic (ROC) curve</option>
+                <option value="rfecv_gridscores">Number of features vs. Recursive Feature Elimination gridscores with corss-validation</option>
+                <option value="feature_importances">Feature Importances plot</option>
+                <option value="keras_plot_model">keras plot model - plot configuration of a neural network model</option>
+            </param>
+            <when value="learning_curve">
+                <param name="infile1" type="data" format="tabular" label="Select the dataset containing values for plotting learning curve." help="This dataset should be the output of tool model_validation->learning_curve."/>
+                <param name="plot_std_err" type="boolean" truevalue="booltrue" falsevalue="boolfalse" optional="true" checked="false" label="Whether to plot standard error bar?"/>
+                <param name="title" type="text" value="" optional="true" label="Plot title" help="Optional. If change is desired."/>
+            </when>
+            <when value="pr_curve">
+                <param name="infile1" type="data" format="tabular" label="Select the dataset containing true labels." help="No headers. Each column corresponds to one class."/>
+                <param name="infile2" type="data" format="tabular" label="Select the dataset containing predicted probabilities." help="No headers. Each column corresponds to one class."/>
+                <param name="pos_label" type="text" value="" optional="true" label="pos_label" help="The label of positive class. If not specified, it will be 1 by default."/>
+                <param name="title" type="text" value="" optional="true" label="Plot title" help="Optional. If change is desired."/>
+            </when>
+            <when value="roc_curve">
+                <param name="infile1" type="data" format="tabular" label="Select the dataset containing true labels." help="No headers. Each column corresponds to one class."/>
+                <param name="infile2" type="data" format="tabular" label="Select the dataset containing predicted probabilities." help="No headers. Each column corresponds to one class."/>
+                <param name="pos_label" type="text" value="" optional="true" label="pos_label" help="The label of positive class. If not specified, it will be 1 by default."/>
+                <param name="drop_intermediate" type="boolean" truevalue="booltrue" falsevalue="boolfalse" optional="true" checked="true" label="drop_intermediate" help="Whether to drop some suboptimal thresholds which would not appear on a plotted ROC curve."/>
+                <param name="title" type="text" value="" optional="true" label="Plot title" help="Optional. If change is desired."/>
+            </when>
+            <when value="rfecv_gridscores">
+                <param name="infile1" type="data" format="tabular" label="Select the dataset containing grid_scores from a fitted RFECV object." help="Headered. Single column. Could be Output from `estimator_attributes->grid_scores_`."/>
+                <param name="steps" type="text" value="" optional="true" label="Step IDs" help="List, containing hover labels for each grid_score. For example: `list(range(10)) + [15, 20]`."/>
+                <param name="title" type="text" value="" optional="true" label="Plot title" help="Optional. If change is desired."/>
+            </when>
+            <when value="feature_importances">
+                <param name="infile_estimator" type="data" format="zip" label="Select the dataset containing fitted estimator/pipeline" />
+                <param name="infile1" type="data" format="tabular" label="Select the dataset containing feature names" help="Make sure the headers (first row) are feature names."/>
+                <conditional name="column_selector_options">
+                    <expand macro="samples_column_selector_options" multiple="true"/>
+                </conditional>
+                <param name="threshold" type="float" value="" optional="true" min="0." label="Threshold value" help="Features with importance below the threshold value will be ignored."/>
+                <param name="title" type="text" value="" optional="true" label="Custom plot title" help="Optional."/>
+            </when>
+            <when value="keras_plot_model">
+                <param name="infile_model_config" type="data" format="json" label="Select the JSON dataset containing configuration for a neural network model"/>
+                <param name="title" type="hidden" value="" optional="true" label="Plot title" help="Optional. If change is desired."/>
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+        <data name="output" format="html" from_work_dir="output" label="${plotting_selection.plot_type} plot on ${on_string}">
+            <change_format>
+                <when input="plotting_selection.plot_type" value="keras_plot_model" format="png"/>
+            </change_format>
+        </data>
+    </outputs>
+    <tests>
+        <test>
+            <param name="plot_type" value="roc_curve"/>
+            <param name="infile1" value="y_true.tabular" ftype="tabular"/>
+            <param name="infile2" value="y_score.tabular" ftype="tabular"/>
+            <output name="output" file="ml_vis04.html" compare="sim_size"/>
+        </test>
+        <test>
+            <param name="plot_type" value="feature_importances"/>
+            <param name="infile_estimator" value="best_estimator_.zip" ftype="zip"/>
+            <param name="infile1" value="regression_X.tabular" ftype="tabular"/>
+            <param name="selected_column_selector_option" value="all_columns"/>
+            <output name="output" file="ml_vis01.html" compare="sim_size"/>
+        </test>
+        <test>
+            <param name="plot_type" value="learning_curve"/>
+            <param name="infile1" value="mv_result03.tabular" ftype="tabular"/>
+            <output name="output" file="ml_vis02.html" compare="sim_size"/>
+        </test>
+        <test>
+            <param name="plot_type" value="pr_curve"/>
+            <param name="infile1" value="y_true.tabular" ftype="tabular"/>
+            <param name="infile2" value="y_score.tabular" ftype="tabular"/>
+            <output name="output" file="ml_vis03.html" compare="sim_size"/>
+        </test>
+        <test>
+            <param name="plot_type" value="rfecv_gridscores"/>
+            <param name="infile1" value="grid_scores_.tabular" ftype="tabular"/>
+            <output name="output" file="ml_vis05.html" compare="sim_size"/>
+        </test>
+        <test>
+            <param name="plot_type" value="keras_plot_model"/>
+            <param name="infile_model_config" value="deepsear_1feature.json" ftype="json"/>
+            <output name="output" file="ml_vis05.png" compare="sim_size" delta="20000"/>
+        </test>
+    </tests>
+    <help>
+        <![CDATA[
+**What it does**
+This tool ouputs serveral machine learning visualization plots using Plotly, including 'feature_importances', 'learning curve', 'precison recall curve', 'roc_curve',  and 'number of featues vs. rfecv gridscores'. This tool also ouputs configuration diagram for a deep learning model using the Keras model JSON file as input.
+
+
+**Feature importances**
+
+.. image:: https://raw.githubusercontent.com/goeckslab/Galaxy-ML/master/galaxy_ml/tools/images/feature_importances.png
+    :width: 400
+    :alt: feature importances
+
+
+**Learning curve**
+
+.. image:: https://raw.githubusercontent.com/goeckslab/Galaxy-ML/master/galaxy_ml/tools/images/learning_curve.png
+    :width: 400
+    :alt: learning curve
+
+
+**Precison recall curve**
+
+.. image:: https://raw.githubusercontent.com/goeckslab/Galaxy-ML/master/galaxy_ml/tools/images/pr_curve.png
+    :width: 400
+    :alt: precison recall curve
+
+
+**Receiver operating characteristic curve**
+
+.. image:: https://raw.githubusercontent.com/goeckslab/Galaxy-ML/master/galaxy_ml/tools/images/roc_curve.png
+    :width: 400
+    :alt: Receiver operating characteristic curve
+
+
+**Number of featues vs. rfecv gridscores**
+
+.. image:: https://raw.githubusercontent.com/goeckslab/Galaxy-ML/master/galaxy_ml/tools/images/rfecv_gridscore.png
+    :width: 400
+    :alt: Number of featues vs. rfecv gridscores
+
+
+**Deep learning model configuration**
+
+.. image:: https://raw.githubusercontent.com/goeckslab/Galaxy-ML/master/galaxy_ml/tools/images/deepsea.png
+    :width: 400
+    :alt: deapsea model configuration
+        ]]>
+    </help>
+    <expand macro="sklearn_citation">
+        <citation type="bibtex">
+            @online{plotly,
+            author = {Plotly Technologies Inc.},
+            title = {Collaborative data science},
+            publisher = {Plotly Technologies Inc.},
+            address = {Montreal, QC},
+            year = {2015},
+            url = {https://plot.ly}}
+        </citation>
+    </expand>
+</tool>