From 7acce74e8eeb6a8fcd99af61030977e0fb498f88 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Thu, 23 Feb 2017 22:03:00 -0500 Subject: Allow setting of the random seed in the model --- src/GenSVMtraintest.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/GenSVMtraintest.c') diff --git a/src/GenSVMtraintest.c b/src/GenSVMtraintest.c index 285be2a..63e6d58 100644 --- a/src/GenSVMtraintest.c +++ b/src/GenSVMtraintest.c @@ -95,6 +95,7 @@ void exit_with_help(char **argv) "3=SIGMOID)\n"); printf("-x : data files are in LibSVM/SVMlight " "format\n"); + printf("-z seed : seed for the random number generator\n"); printf("\n"); exit(EXIT_FAILURE); @@ -165,9 +166,6 @@ int main(int argc, char **argv) gensvm_free_sparse(traindata->spZ); } - // seed the random number generator - srand(time(NULL)); - // load a seed model from file if it is specified if (gensvm_check_argv_eq(argc, argv, "-s")) { seed_model = gensvm_init_model(); @@ -348,6 +346,9 @@ void parse_command_line(int argc, char **argv, struct GenModel *model, case 'x': i--; break; + case 'z': + model->seed = atoi(argv[i]); + break; default: // this one should always print explicitly to // stderr, even if '-q' is supplied, because -- cgit v1.2.3