diff create_tool_recommendation_model.xml @ 6:e94dc7945639 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/recommendation_training/tools/tool_recommendation_model commit 24bab7a797f53fe4bcc668b18ee0326625486164
author bgruening
date Sun, 16 Oct 2022 11:52:10 +0000
parents 4f7e6612906b
children
line wrap: on
line diff
--- a/create_tool_recommendation_model.xml	Fri May 06 09:05:18 2022 +0000
+++ b/create_tool_recommendation_model.xml	Sun Oct 16 11:52:10 2022 +0000
@@ -1,32 +1,32 @@
-<tool id="create_tool_recommendation_model" name="Create a model to recommend tools" version="0.0.4">
+<tool id="create_tool_recommendation_model" name="Create a model to recommend tools" version="0.0.5">
     <description>using deep learning</description>
     <requirements>
-        <requirement type="package" version="3.9.7">python</requirement>
-        <requirement type="package" version="2.7.0">tensorflow</requirement>
-        <requirement type="package" version="2.7.0">keras</requirement>
+        <requirement type="package" version="3.9.12">python</requirement>
+        <requirement type="package" version="2.9.1">tensorflow</requirement>
+        <requirement type="package" version="2.9.0">keras</requirement>
         <requirement type="package" version="1.0.2">scikit-learn</requirement>
+        <requirement type="package" version="1.4.2">pandas</requirement>
         <requirement type="package" version="3.6.0">h5py</requirement>
-        <requirement type="package" version="1.0.4">csvkit</requirement>
-        <requirement type="package" version="0.2.5">hyperopt</requirement>
     </requirements>
     <version_command>echo "@VERSION@"</version_command>
     <command detect_errors="aggressive">
 <![CDATA[
         python '$__tool_directory__/main.py'
+
             --workflow_file '$input_tabular_workflows'
             --tool_usage_file '$input_tabular_tool_usage'
             --cutoff_date '$data_parameters.input_cutoff_date'
             --maximum_path_length '$data_parameters.input_maximum_path_length'
-            --n_epochs '$training_parameters.n_epochs'
-            --optimize_n_epochs '$training_parameters.optimize_n_epochs'
-            --max_evals '$training_parameters.max_evals'
-            --test_share '$training_parameters.test_share'
-            --batch_size '$nn_parameters.batch_size'
-            --units '$nn_parameters.units'
-            --embedding_size '$nn_parameters.embedding_size'
+            --te_share '$training_parameters.te_share'
+            --tr_batch_size '$training_parameters.tr_batch_size'
+            --te_batch_size '$training_parameters.te_batch_size'
+            --n_train_iter '$training_parameters.n_train_iter'
+            --tr_logging_step '$training_parameters.tr_logging_step'
+            --te_logging_step '$training_parameters.te_logging_step'
+            --n_heads '$nn_parameters.n_heads'
+            --n_embed_dim '$nn_parameters.n_embed_dim'
+            --n_feed_forward_dim '$nn_parameters.n_feed_forward_dim'
             --dropout '$nn_parameters.dropout'
-            --spatial_dropout '$nn_parameters.spatial_dropout'
-            --recurrent_dropout '$nn_parameters.recurrent_dropout'
             --learning_rate '$nn_parameters.learning_rate'
             --output_model '$outfile_model'
 ]]>
@@ -34,37 +34,26 @@
     <inputs>
         <param name="input_tabular_workflows" type="data" format="tabular" label="Dataset containing workflows" help="Please provide Galaxy workflows as a tabular file."/>
         <param name="input_tabular_tool_usage" type="data" format="tabular" label="Dataset containing usage frequencies of tools" help="Please provide tools usage frequencies as a tabular file."/>
+
         <section name="data_parameters" title="Data parameters" expanded="False">
-
             <param name="input_cutoff_date" type="text" value="2017-12-01" label="Cutoff date" help="Provide a date (in the past) in yyyy-mm-dd format. The earliest date from which usage of tools will be extracted. For example, 2017-12-01 specifies that the usage of tools from this date until the data extraction date is extracted. The usage of tools before this date is not considered."/>
-
             <param name="input_maximum_path_length" type="integer" value="25" label="Maximum number of tools in a tool sequence" help="Provide an integer between 1 and 25. A workflow is divided into unique paths and this number specifies the maximum number of tools a path can have. Paths longer than this number are ignored and are not included in the deep learning training."/>
-
         </section>
         <section name="training_parameters" title="Training parameters" expanded="False">
-            <param name="max_evals" type="integer" value="20" label="Maximum number of evaluations of different configurations of parameters" help="Provide an integer. Different combinations of parameters are sampled and optimized to find the best one. This number specifies the number of different configurations sampled and tested."/>
-
-            <param name="optimize_n_epochs" type="integer" value="5" label="Number of training iterations to optimize the neural network parameters" help="Provide an integer. This number specifies the number of training iterations done for each sampled configuration while optimising the parameters."/>
-
-            <param name="n_epochs" type="integer" value="10" label="Number of training iterations" help="Provide an integer. This specifies the number of deep learning training iterations done after finding the best/optimised configuration of neural network parameters."/>
-
-            <param name="test_share" type="float" value="0.2" label="Share of the test data" help="Provide a real number between 0.0 and 1.0. This set of data is used to look through the prediction accuracy on unseen data after neural network training on an optimised configuration of parameters. It should be set to 0.0 while training for a model to be deployed to production. The minimum value can be 0.0 and maximum value should not be more than 0.5."/>
-
+            <param name="n_train_iter" type="integer" value="20" label="Maximum number of evaluations of different configurations of parameters" help="Provide an integer. Different combinations of parameters are sampled and optimized to find the best one. This number specifies the number of different configurations sampled and tested."/>
+            <param name="tr_batch_size" type="integer" value="128" label="Training batch size" help="" />
+            <param name="te_batch_size" type="integer" value="128" label="Test batch size" help=""/>
+            <param name="tr_logging_step" type="integer" value="5" label="Training log step" help="" />
+            <param name="te_logging_step" type="integer" value="5" label="Test log step" help="" />
+            <param name="te_share" type="text" value="0.2" label="Share of the test data" help="Provide a real number between 0.0 and 1.0. This set of data is used to look through the prediction accuracy on unseen data after neural network training on an optimised configuration of parameters."/>
         </section>
-        <section name="nn_parameters" title="Neural network parameters" expanded="False">
-            <param name="batch_size" type="text" value="32,256" label="Training batch size" help="Provide a comma-separated range to sample the batch size from. The training of the neural network is done using batch learning in this work. The training data is divided into equal batches and for each epoch (a training iteration), all the batches of data are trained one after another. An example: 32,256." />
 
-            <param name="units" type="text" value="32,512" label="Number of hidden recurrent units" help="Provide a comma-separated range to sample the number of hidden recurrent units. A higher value provide stronger neural network model (may lead to overfitting in case of smaller data) and smaller value leads to weaker model (may lead to underfitting in case of larger data). An example: 32,512."/>
-
-            <param name="embedding_size" type="text" value="32,512" label="Embedding vector size" help="Provide a comma-separated range to sample the embedding size for tools. A fixed-size vector is learned for each tool. This number specifies the fixed-size. An example: 32,512."/>
-
-            <param name="dropout" type="text" value="0.0,0.5" label="Dropout between neural network layers" help="Provide a comma-separated range to sample the amount of dropout to be used after neural netwrok layers. The minimum value should be 0.0 and the maximum value should be 1.0. Dropout is used to prevent or minimize overfitting after each neural network layer. An example: 0.0,0.5"/>
-
-            <param name="spatial_dropout" type="text" value="0.0,0.5" label="Dropout for the embedding layer" help="Provide a comma-separated range to sample the amount of dropout to be used after embedding layer. The minimum value should be 0.0 and the maximum value should be 1.0. Dropout is used to prevent or minimize overfitting in the embedding layer. An example: 0.0,0.5"/>
-
-            <param name="recurrent_dropout" type="text" value="0.0,0.5" label="Dropout for recurrent layers" help="Provide a comma-separated range to sample the amount of dropout to be used for the recurrent layers. The minimum value should be 0.0 and the maximum value should be 1.0. Dropout is used to prevent or minimize overfitting in the recurrent layers. An example: 0.0,0.5"/>
-
-            <param name="learning_rate" type="text" value="0.0001,0.1" label="Learning rate" help="Provide a range of positive real numbers to sample the learning rate. Learning rate defines the speed of neural network learning. A higher value will ensure fast learning and smaller value will ensure slower learning. An example: 0.0001,0.1"/>
+        <section name="nn_parameters" title="Neural network parameters" expanded="False">
+            <param name="n_heads" type="integer" value="4" label="Number of heads in Multihead attention network"/>
+            <param name="n_embed_dim" type="integer" value="128" label="Embedding dimensions"/>
+            <param name="n_feed_forward_dim" type="text" value="128" label="Number of units for feed forward network" help=""/>
+            <param name="dropout" type="text" value="0.2" label="Amount of dropout between neural network layers. E.g. 0.2 means 20%" help=""/>
+            <param name="learning_rate" type="text" value="0.001" label="Learning rate" help=""/>
         </section>
     </inputs>
     <outputs>
@@ -72,71 +61,85 @@
     </outputs>
     <tests>
         <test>
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
             <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/> 
-            <param name="max_evals" value="1"/>
-            <param name="batch_size" value="1,2"/>
-            <param name="optimize_n_epochs" value="1"/>
-            <param name="n_epochs" value="1"/>
-            <param name="test_share" value="0.2"/>
+            <param name="tr_batch_size" value="4"/>
+            <param name="te_batch_size" value="4"/>
+            <param name="n_train_iter" value="20"/>
+            <param name="tr_logging_step" value="10"/>
+            <param name="te_logging_step" value="10"/>
+            <param name="te_share" value="0.4"/>
             <output name="outfile_model">
                 <assert_contents>
-                    <has_h5_keys keys="best_parameters,class_weights,compatible_tools,data_dictionary,model_config,weight_0,weight_1,weight_2,weight_3,weight_4,weight_5,weight_6,weight_7,weight_8"/>
+                    <has_h5_keys keys="class_weights,compatible_tools,dense_2,dense_3,dropout_2,dropout_3,global_average_pooling1d,input_1,reverse_dict,standard_connections,token_and_position_embedding,top_level_model_weights,transformer_block"/>
                 </assert_contents>
             </output>
         </test>
         <test>
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
-            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="max_evals" value="1"/>
-            <param name="batch_size" value="1,2"/>
-            <param name="optimize_n_epochs" value="1"/>
-            <param name="n_epochs" value="1"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
+            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/> 
+            <param name="tr_batch_size" value="4"/>
+            <param name="te_batch_size" value="4"/>
+            <param name="n_train_iter" value="20"/>
+            <param name="tr_logging_step" value="10"/>
+            <param name="te_logging_step" value="10"/>
+            <param name="te_share" value="0.4"/>
+            <param name="n_heads" value="2"/>
+            <param name="n_embed_dim" value="32"/>
+            <param name="n_feed_forward_dim" value="32"/>
+            <param name="dropout" value="0.05"/>
+            <param name="learning_rate" value="0.0001"/>
             <output name="outfile_model">
                 <assert_contents>
-                    <has_h5_keys keys="best_parameters,class_weights,compatible_tools,data_dictionary,model_config,weight_0,weight_1,weight_2,weight_3,weight_4,weight_5,weight_6,weight_7,weight_8"/>
+                    <has_h5_keys keys="class_weights,compatible_tools,dense_2,dense_3,dropout_2,dropout_3,global_average_pooling1d,input_1,reverse_dict,standard_connections,token_and_position_embedding,top_level_model_weights,transformer_block"/>
                 </assert_contents>
             </output>
         </test>
+        
         <test expect_failure="true">
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
             <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="test_share" value="0.0"/>
+            <param name="te_share" value="0.0,0.1"/>
         </test>
         <test expect_failure="true">
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
-            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="batch_size" value="1"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
+            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/> 
+            <param name="tr_batch_size" value="1,9"/>
         </test>
         <test expect_failure="true">
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
             <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="units" value="1"/>
+            <param name="te_batch_size" value="1,1"/>
+        </test>
+        <test expect_failure="true">
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
+            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/> 
+            <param name="tr_logging_step" value="1,6"/>
         </test>
         <test expect_failure="true">
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
-            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="embedding_size" value="1"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
+            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/> 
+            <param name="n_embed_dim" value="1,6"/>
         </test>
         <test expect_failure="true">
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
             <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="dropout" value="0.1"/>
+            <param name="n_feed_forward_dim" value="1,6"/>
         </test>
         <test expect_failure="true">
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
-            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="spatial_dropout" value="0.1"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
+            <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/> 
+            <param name="dropout" value="0.1,0.2"/>
         </test>
         <test expect_failure="true">
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
             <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="recurrent_dropout" value="0.1"/>
+            <param name="n_heads" value="0.1"/>
         </test>
          <test expect_failure="true">
-            <param name="input_tabular_workflows" value="test_workflows" ftype="tabular"/>
+            <param name="input_tabular_workflows" value="test_workflow_connections" ftype="tabular"/>
             <param name="input_tabular_tool_usage" value="test_tool_usage" ftype="tabular"/>
-            <param name="learning_rate" value="0.0001"/>
+            <param name="learning_rate" value="0.0001,0.04"/>
         </test>
     </tests>
     <help>
@@ -188,7 +191,7 @@
     - "max_evals": The hyperparameters of the neural network are tuned using a Bayesian optimisation approach and multiple configurations are sampled from different ranges of parameters. The number specified in this parameter is the number of configurations of hyperparameters evaluated to optimise them. Higher the number, the longer is the running time of the tool.
     - "optimize_n_epochs": This number specifies how many iterations would the neural network executes to evaluate each sampled configuration.
     - "n_epochs": Once the best configuration of hyperparameters has been found, the neural network takes this configuration and runs for "n_epochs" number of times minimising the error to produce a model at the end.
-    - "test_share": It specifies the size of the test set. For example, if it is 0.5, then the test set is half of the entire data available. It should not be set to more than 0.5. This set is used for evaluating the precision on an unseen set.
+    - "te_share": It specifies the size of the test set. For example, if it is 0.5, then the test set is half of the entire data available. It should not be set to more than 0.5. This set is used for evaluating the precision on an unseen set.
     
 3. Neural network parameters:
     - "batch_size": The training of the neural network is done using batch learning in this work. The training data is divided into equal batches and for each epoch (a training iteration), all batches of data are trained one after another. A higher or lower value can unsettle the training. Therefore, this parameter should be optimised.