GenSVM
Macros | Functions | Variables
GenSVMgrid.c File Reference

Command line interface for the grid search program. More...

#include "gensvm_checks.h"
#include "gensvm_cmdarg.h"
#include "gensvm_io.h"
#include "gensvm_gridsearch.h"
#include "gensvm_consistency.h"
Include dependency graph for GenSVMgrid.c:

Go to the source code of this file.

Macros

#define MINARGS   2
 

Functions

void exit_with_help (char **argv)
 Help function. More...
 
void parse_command_line (int argc, char **argv, char *input_filename)
 Parse command line arguments. More...
 
void read_grid_from_file (char *input_filename, struct GenGrid *grid)
 Read the GenGrid struct from file. More...
 
int main (int argc, char **argv)
 Main interface function for GenSVMgrid. More...
 
KernelType parse_kernel_str (char *kernel_line)
 Parse the kernel string from the training file. More...
 

Variables

FILE * GENSVM_OUTPUT_FILE
 
FILE * GENSVM_ERROR_FILE
 

Detailed Description

Command line interface for the grid search program.

Author
G.J.J. van den Burg
Date
2014-01-07

This is a command line interface to the parameter grid search functionality of the algorithm. The grid search is specified in a separate file, thereby reducing the number of command line arguments. See read_grid_from_file() for documentation on the grid file.

The program runs a grid search as specified in the grid file. If desired the grid search can incorporate consistency checks to find the configuration among the best configurations which scores consistently high. All output is written to stdout, unless the quiet mode is specified.

For further usage information, see the program help function.

This file is part of GenSVM.

GenSVM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

GenSVM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GenSVM. If not, see http://www.gnu.org/licenses/.

Definition in file GenSVMgrid.c.

Macro Definition Documentation

◆ MINARGS

#define MINARGS   2

Minimal number of command line arguments

Definition at line 49 of file GenSVMgrid.c.

Function Documentation

◆ exit_with_help()

void exit_with_help ( char **  argv)

Help function.

Print help for this program and exit. Note that VERSION is provided by the Makefile.

Parameters
[in]argvcommand line arguments

Print help for this program and exit. Note that the VERSION is defined in the Makefile.

Parameters
[in]argvcommand line arguments

Definition at line 69 of file GenSVMgrid.c.

◆ main()

int main ( int  argc,
char **  argv 
)

Main interface function for GenSVMgrid.

Main interface for the command line program. A given grid file which specifies a grid search over a single dataset is read. From this, a Queue is created containing all Task instances that need to be performed in the search. Depending on the type of dataset, either cross validation or train/test split training is performed for all tasks. If specified, consistency repeats are done at the end of the grid search. Note that currently no output is produced other than what is written to stdout.

Parameters
[in]argcnumber of command line arguments
[in]argvarray of command line arguments
Returns
exit status

Definition at line 102 of file GenSVMgrid.c.

Here is the call graph for this function:

◆ parse_command_line()

void parse_command_line ( int  argc,
char **  argv,
char *  input_filename 
)

Parse command line arguments.

Few arguments can be supplied to the command line. Only quiet mode can be specified, or help can be requested. The filename of the grid file is read from the arguments. Parsing of the grid file is done separately in read_grid_from_file().

Parameters
[in]argcnumber of command line arguments
[in]argvarray of command line arguments
[in]input_filenamepre-allocated buffer for the grid filename.

Definition at line 191 of file GenSVMgrid.c.

Here is the call graph for this function:

◆ parse_kernel_str()

KernelType parse_kernel_str ( char *  kernel_line)

Parse the kernel string from the training file.

This is a utility function for the read_grid_from_file() function, to keep the main code a bit shorter. It reads the line from the given buffer and returns the corresponding KernelType.

Parameters
[in]kernel_lineline from the file with the kernel specification
Returns
the corresponding kerneltype

Definition at line 236 of file GenSVMgrid.c.

Here is the call graph for this function:

◆ read_grid_from_file()

void read_grid_from_file ( char *  input_filename,
struct GenGrid grid 
)

Read the GenGrid struct from file.

Read the GenGrid struct from a file. The grid file follows a specific format specified in Grid Input File Specification.

Commonly used string functions in this function are all_doubles_str() and all_longs_str().

Parameters
[in]input_filenamefilename of the grid file
[in]gridGenGrid structure to place the parsed parameter grid.

Definition at line 268 of file GenSVMgrid.c.

Here is the call graph for this function:

Variable Documentation

◆ GENSVM_ERROR_FILE

FILE* GENSVM_ERROR_FILE

The GENSVM_ERROR_FILE specifies the output stream to use when writing an error. Typically this is stderr, but when unit testing we can temporarily redirect this to check if the correct output is written.

Definition at line 43 of file gensvm_print.c.

◆ GENSVM_OUTPUT_FILE

FILE* GENSVM_OUTPUT_FILE

The GENSVM_OUTPUT_FILE specifies the output stream to which all output is written. This is done through the function note(). The advantage of using a global output stream variable is that the output can temporarily be suppressed by importing this variable through extern and (temporarily) setting it to NULL.

Definition at line 33 of file gensvm_print.c.