From 3a30e992cf022f4ec3c76506c070e59d093951d4 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 17 Feb 2017 19:02:52 -0500 Subject: Remove kernelparam array in favour of explicit kernel parameters This simplifies a lot of the code and will make it easier to link to other languages. --- src/GenSVMtraintest.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'src/GenSVMtraintest.c') diff --git a/src/GenSVMtraintest.c b/src/GenSVMtraintest.c index 0da45ec..285be2a 100644 --- a/src/GenSVMtraintest.c +++ b/src/GenSVMtraintest.c @@ -278,9 +278,6 @@ void parse_command_line(int argc, char **argv, struct GenModel *model, char **prediction_outputfile) { int i; - double gamma = 1.0, - degree = 2.0, - coef = 0.0; GENSVM_OUTPUT_FILE = stdout; GENSVM_ERROR_FILE = stderr; @@ -294,10 +291,10 @@ void parse_command_line(int argc, char **argv, struct GenModel *model, } switch (argv[i-1][1]) { case 'c': - coef = atof(argv[i]); + model->coef = atof(argv[i]); break; case 'd': - degree = atof(argv[i]); + model->degree = atof(argv[i]); break; case 'e': model->epsilon = atof(argv[i]); @@ -305,7 +302,7 @@ void parse_command_line(int argc, char **argv, struct GenModel *model, exit_invalid_param("epsilon", argv); break; case 'g': - gamma = atof(argv[i]); + model->gamma = atof(argv[i]); break; case 'k': model->kappa = atof(argv[i]); @@ -369,24 +366,4 @@ void parse_command_line(int argc, char **argv, struct GenModel *model, (*testing_inputfile) = Malloc(char, strlen(argv[i])+1); strcpy((*testing_inputfile), argv[i+1]); } - - // set kernel parameters - switch (model->kerneltype) { - case K_LINEAR: - break; - case K_POLY: - model->kernelparam = Calloc(double, 3); - model->kernelparam[0] = gamma; - model->kernelparam[1] = coef; - model->kernelparam[2] = degree; - break; - case K_RBF: - model->kernelparam = Calloc(double, 1); - model->kernelparam[0] = gamma; - break; - case K_SIGMOID: - model->kernelparam = Calloc(double, 1); - model->kernelparam[0] = gamma; - model->kernelparam[1] = coef; - } } -- cgit v1.2.3