aboutsummaryrefslogtreecommitdiff
path: root/src/GenSVMtraintest.c
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2017-02-23 22:03:00 -0500
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2017-02-23 22:04:54 -0500
commit7acce74e8eeb6a8fcd99af61030977e0fb498f88 (patch)
treed3e3d73f334ee700041d29e4433760206aa8a82e /src/GenSVMtraintest.c
parentadd additional gcc checks (diff)
downloadgensvm-7acce74e8eeb6a8fcd99af61030977e0fb498f88.tar.gz
gensvm-7acce74e8eeb6a8fcd99af61030977e0fb498f88.zip
Allow setting of the random seed in the model
Diffstat (limited to 'src/GenSVMtraintest.c')
-rw-r--r--src/GenSVMtraintest.c7
1 files changed, 4 insertions, 3 deletions
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