Commits

Jian Zhou  committed 784d471

svmhierarchy ggo fixes

  • Participants
  • Parent commits f300dd7

Comments (0)

Files changed (3)

File tools/SVMhierarchy/SVMhierarchy.ggo

 										int default="0" no
 option "tradeoff"    			t   "SVM tradeoff constant C"
 										float default="1" no
-option "learning_algorithm" 		w   "Choice of structural learning algorithm (default 4):
+option "learning_algorithm" 		w   "Choice of structural learning algorithm:
+
 0\tn-slack algorithm 
 1\tn-slack algorithm with shrinking heuristic
 2\t1-slack algorithm (primal) 

File tools/SVMhierarchy/cmdline.c

   "  -o, --output=filename         Output file ",
   "  -i, --input=filename          Input PCL file ",
   "  -m, --model=filename          Model file",
+  "  -T, --test_labels=filename    Test Labels file",
   "  -h, --ontoparam=filename      Ontology file",
   "  -a, --all                     Always classify all genes in PCLs  \n                                  (default=off)",
   "  -S, --slack                   Use slack rescaling (NOT implemented for \n                                  Hierarchical Multilabel SVM)  (default=off)",
   "  -s, --skip=INT                Number of columns to skip in input pcls  \n                                  (default=`2')",
   "  -n, --normalize               Normalize PCLS to 0 mean 1 variance  \n                                  (default=off)",
   "  -c, --cross_validation=INT    Number of cross-validation sets ( arg of 1 will \n                                  turn off cross-validation )  (default=`5')",
-  "  -e, --loss_function=INT       Sets the loss function for SVM learning: Choice \n                                  of:\n\n                                  0\tHamming distance loss: total number of \n                                  differences in label vector.\n\n                                  1\tHamming distance loss (modified): total \n                                  number of differences in label vector; \n                                  over-annotation not counted as difference. \n\n                                  2\tLikelihood distance loss. \n\n                                  3\tLikelihood distance loss (modified). \n\n                                  \n                                    (default=`0')",
+  "  -e, --loss_function=INT       Sets the loss function for SVM learning: Choice \n                                  of:\n                                  0\tHamming distance loss: total number of \n                                  differences in label vector.\n                                  1\tHamming distance loss (modified): total \n                                  number of differences in label vector; \n                                  over-annotation not counted as difference. \n                                  2\tLikelihood distance loss. \n                                  3\tLikelihood distance loss (modified). \n                                  \n                                    (default=`0')",
   "  -t, --tradeoff=FLOAT          SVM tradeoff constant C  (default=`1')",
-  "  -w, --learning_algorithm=INT  Choice of structural learning algorithm \n                                  (default 4):\n\n                                  0\tn-slack algorithm \n\n                                  1\tn-slack algorithm with shrinking heuristic\n\n                                  2\t1-slack algorithm (primal) \n\n                                  3\t1-slack algorithm (dual)\n\n                                  4\t1-slack algorithm (dual) with constraint \n                                  cache\n                                    (default=`3')",
+  "  -w, --learning_algorithm=INT  Choice of structural learning algorithm:\n                                  0\tn-slack algorithm \n                                  1\tn-slack algorithm with shrinking heuristic\n                                  2\t1-slack algorithm (primal) \n                                  3\t1-slack algorithm (dual)\n                                  4\t1-slack algorithm (dual) with constraint \n                                  cache\n                                    (default=`3')",
   "  -p, --threads=INT             number of threads (only apply to algorithm 3 \n                                  currently)  (default=`4')",
   "  -M, --mmap                    Memory map binary input  (default=off)",
     0
   args_info->output_given = 0 ;
   args_info->input_given = 0 ;
   args_info->model_given = 0 ;
+  args_info->test_labels_given = 0 ;
   args_info->ontoparam_given = 0 ;
   args_info->all_given = 0 ;
   args_info->slack_given = 0 ;
   args_info->input_orig = NULL;
   args_info->model_arg = NULL;
   args_info->model_orig = NULL;
+  args_info->test_labels_arg = NULL;
+  args_info->test_labels_orig = NULL;
   args_info->ontoparam_arg = NULL;
   args_info->ontoparam_orig = NULL;
   args_info->all_flag = 0;
   args_info->output_help = gengetopt_args_info_help[4] ;
   args_info->input_help = gengetopt_args_info_help[5] ;
   args_info->model_help = gengetopt_args_info_help[6] ;
-  args_info->ontoparam_help = gengetopt_args_info_help[7] ;
-  args_info->all_help = gengetopt_args_info_help[8] ;
-  args_info->slack_help = gengetopt_args_info_help[9] ;
-  args_info->verbosity_help = gengetopt_args_info_help[11] ;
-  args_info->skip_help = gengetopt_args_info_help[12] ;
-  args_info->normalize_help = gengetopt_args_info_help[13] ;
-  args_info->cross_validation_help = gengetopt_args_info_help[14] ;
-  args_info->loss_function_help = gengetopt_args_info_help[15] ;
-  args_info->tradeoff_help = gengetopt_args_info_help[16] ;
-  args_info->learning_algorithm_help = gengetopt_args_info_help[17] ;
-  args_info->threads_help = gengetopt_args_info_help[18] ;
-  args_info->mmap_help = gengetopt_args_info_help[19] ;
+  args_info->test_labels_help = gengetopt_args_info_help[7] ;
+  args_info->ontoparam_help = gengetopt_args_info_help[8] ;
+  args_info->all_help = gengetopt_args_info_help[9] ;
+  args_info->slack_help = gengetopt_args_info_help[10] ;
+  args_info->verbosity_help = gengetopt_args_info_help[12] ;
+  args_info->skip_help = gengetopt_args_info_help[13] ;
+  args_info->normalize_help = gengetopt_args_info_help[14] ;
+  args_info->cross_validation_help = gengetopt_args_info_help[15] ;
+  args_info->loss_function_help = gengetopt_args_info_help[16] ;
+  args_info->tradeoff_help = gengetopt_args_info_help[17] ;
+  args_info->learning_algorithm_help = gengetopt_args_info_help[18] ;
+  args_info->threads_help = gengetopt_args_info_help[19] ;
+  args_info->mmap_help = gengetopt_args_info_help[20] ;
   
 }
 
   free_string_field (&(args_info->input_orig));
   free_string_field (&(args_info->model_arg));
   free_string_field (&(args_info->model_orig));
+  free_string_field (&(args_info->test_labels_arg));
+  free_string_field (&(args_info->test_labels_orig));
   free_string_field (&(args_info->ontoparam_arg));
   free_string_field (&(args_info->ontoparam_orig));
   free_string_field (&(args_info->verbosity_orig));
     write_into_file(outfile, "input", args_info->input_orig, 0);
   if (args_info->model_given)
     write_into_file(outfile, "model", args_info->model_orig, 0);
+  if (args_info->test_labels_given)
+    write_into_file(outfile, "test_labels", args_info->test_labels_orig, 0);
   if (args_info->ontoparam_given)
     write_into_file(outfile, "ontoparam", args_info->ontoparam_orig, 0);
   if (args_info->all_given)
         { "output",	1, NULL, 'o' },
         { "input",	1, NULL, 'i' },
         { "model",	1, NULL, 'm' },
+        { "test_labels",	1, NULL, 'T' },
         { "ontoparam",	1, NULL, 'h' },
         { "all",	0, NULL, 'a' },
         { "slack",	0, NULL, 'S' },
         { NULL,	0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "Vl:o:i:m:h:aSv:s:nc:e:t:w:p:M", long_options, &option_index);
+      c = getopt_long (argc, argv, "Vl:o:i:m:T:h:aSv:s:nc:e:t:w:p:M", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
+        case 'T':	/* Test Labels file.  */
+        
+        
+          if (update_arg( (void *)&(args_info->test_labels_arg), 
+               &(args_info->test_labels_orig), &(args_info->test_labels_given),
+              &(local_args_info.test_labels_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "test_labels", 'T',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'h':	/* Ontology file.  */
         
         
             goto failure;
         
           break;
-        case 'e':	/* Sets the loss function for SVM learning: Choice of:
-        0\tHamming distance loss: total number of differences in label vector.
-        1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-        2\tLikelihood distance loss. 
-        3\tLikelihood distance loss (modified). 
+        case 'e':	/* Sets the loss function for SVM learning: Choice of:
+        0\tHamming distance loss: total number of differences in label vector.
+        1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+        2\tLikelihood distance loss. 
+        3\tLikelihood distance loss (modified). 
         \n.  */
         
         
             goto failure;
         
           break;
-        case 'w':	/* Choice of structural learning algorithm (default 4):
-        0\tn-slack algorithm 
-        1\tn-slack algorithm with shrinking heuristic
-        2\t1-slack algorithm (primal) 
-        3\t1-slack algorithm (dual)
+        case 'w':	/* Choice of structural learning algorithm:
+        0\tn-slack algorithm 
+        1\tn-slack algorithm with shrinking heuristic
+        2\t1-slack algorithm (primal) 
+        3\t1-slack algorithm (dual)
         4\t1-slack algorithm (dual) with constraint cache\n.  */
         
         

File tools/SVMhierarchy/cmdline.h

   char * model_arg;	/**< @brief Model file.  */
   char * model_orig;	/**< @brief Model file original value given at command line.  */
   const char *model_help; /**< @brief Model file help description.  */
+  char * test_labels_arg;	/**< @brief Test Labels file.  */
+  char * test_labels_orig;	/**< @brief Test Labels file original value given at command line.  */
+  const char *test_labels_help; /**< @brief Test Labels file help description.  */
   char * ontoparam_arg;	/**< @brief Ontology file.  */
   char * ontoparam_orig;	/**< @brief Ontology file original value given at command line.  */
   const char *ontoparam_help; /**< @brief Ontology file help description.  */
   int cross_validation_arg;	/**< @brief Number of cross-validation sets ( arg of 1 will turn off cross-validation ) (default='5').  */
   char * cross_validation_orig;	/**< @brief Number of cross-validation sets ( arg of 1 will turn off cross-validation ) original value given at command line.  */
   const char *cross_validation_help; /**< @brief Number of cross-validation sets ( arg of 1 will turn off cross-validation ) help description.  */
-  int loss_function_arg;	/**< @brief Sets the loss function for SVM learning: Choice of:
-  0\tHamming distance loss: total number of differences in label vector.
-  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-  2\tLikelihood distance loss. 
-  3\tLikelihood distance loss (modified). 
+  int loss_function_arg;	/**< @brief Sets the loss function for SVM learning: Choice of:
+  0\tHamming distance loss: total number of differences in label vector.
+  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+  2\tLikelihood distance loss. 
+  3\tLikelihood distance loss (modified). 
   \n (default='0').  */
-  char * loss_function_orig;	/**< @brief Sets the loss function for SVM learning: Choice of:
-  0\tHamming distance loss: total number of differences in label vector.
-  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-  2\tLikelihood distance loss. 
-  3\tLikelihood distance loss (modified). 
+  char * loss_function_orig;	/**< @brief Sets the loss function for SVM learning: Choice of:
+  0\tHamming distance loss: total number of differences in label vector.
+  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+  2\tLikelihood distance loss. 
+  3\tLikelihood distance loss (modified). 
   \n original value given at command line.  */
-  const char *loss_function_help; /**< @brief Sets the loss function for SVM learning: Choice of:
-  0\tHamming distance loss: total number of differences in label vector.
-  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-  2\tLikelihood distance loss. 
-  3\tLikelihood distance loss (modified). 
+  const char *loss_function_help; /**< @brief Sets the loss function for SVM learning: Choice of:
+  0\tHamming distance loss: total number of differences in label vector.
+  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+  2\tLikelihood distance loss. 
+  3\tLikelihood distance loss (modified). 
   \n help description.  */
   float tradeoff_arg;	/**< @brief SVM tradeoff constant C (default='1').  */
   char * tradeoff_orig;	/**< @brief SVM tradeoff constant C original value given at command line.  */
   const char *tradeoff_help; /**< @brief SVM tradeoff constant C help description.  */
-  int learning_algorithm_arg;	/**< @brief Choice of structural learning algorithm (default 4):
-  0\tn-slack algorithm 
-  1\tn-slack algorithm with shrinking heuristic
-  2\t1-slack algorithm (primal) 
-  3\t1-slack algorithm (dual)
+  int learning_algorithm_arg;	/**< @brief Choice of structural learning algorithm:
+  0\tn-slack algorithm 
+  1\tn-slack algorithm with shrinking heuristic
+  2\t1-slack algorithm (primal) 
+  3\t1-slack algorithm (dual)
   4\t1-slack algorithm (dual) with constraint cache\n (default='3').  */
-  char * learning_algorithm_orig;	/**< @brief Choice of structural learning algorithm (default 4):
-  0\tn-slack algorithm 
-  1\tn-slack algorithm with shrinking heuristic
-  2\t1-slack algorithm (primal) 
-  3\t1-slack algorithm (dual)
+  char * learning_algorithm_orig;	/**< @brief Choice of structural learning algorithm:
+  0\tn-slack algorithm 
+  1\tn-slack algorithm with shrinking heuristic
+  2\t1-slack algorithm (primal) 
+  3\t1-slack algorithm (dual)
   4\t1-slack algorithm (dual) with constraint cache\n original value given at command line.  */
-  const char *learning_algorithm_help; /**< @brief Choice of structural learning algorithm (default 4):
-  0\tn-slack algorithm 
-  1\tn-slack algorithm with shrinking heuristic
-  2\t1-slack algorithm (primal) 
-  3\t1-slack algorithm (dual)
+  const char *learning_algorithm_help; /**< @brief Choice of structural learning algorithm:
+  0\tn-slack algorithm 
+  1\tn-slack algorithm with shrinking heuristic
+  2\t1-slack algorithm (primal) 
+  3\t1-slack algorithm (dual)
   4\t1-slack algorithm (dual) with constraint cache\n help description.  */
   int threads_arg;	/**< @brief number of threads (only apply to algorithm 3 currently) (default='4').  */
   char * threads_orig;	/**< @brief number of threads (only apply to algorithm 3 currently) original value given at command line.  */
   unsigned int output_given ;	/**< @brief Whether output was given.  */
   unsigned int input_given ;	/**< @brief Whether input was given.  */
   unsigned int model_given ;	/**< @brief Whether model was given.  */
+  unsigned int test_labels_given ;	/**< @brief Whether test_labels was given.  */
   unsigned int ontoparam_given ;	/**< @brief Whether ontoparam was given.  */
   unsigned int all_given ;	/**< @brief Whether all was given.  */
   unsigned int slack_given ;	/**< @brief Whether slack was given.  */