aboutsummaryrefslogtreecommitdiff
path: root/src/gensvm_train.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gensvm_train.c')
-rw-r--r--src/gensvm_train.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gensvm_train.c b/src/gensvm_train.c
index bc1dad7..5c668e0 100644
--- a/src/gensvm_train.c
+++ b/src/gensvm_train.c
@@ -44,6 +44,8 @@
void gensvm_train(struct GenModel *model, struct GenData *data,
struct GenModel *seed_model)
{
+ long real_seed;
+
// copy dataset parameters to model
model->n = data->n;
model->m = data->m;
@@ -52,6 +54,10 @@ void gensvm_train(struct GenModel *model, struct GenData *data,
// allocate model
gensvm_allocate_model(model);
+ // set the random seed
+ real_seed = (model->seed == -1) ? time(NULL) : model->seed;
+ srand(real_seed);
+
// initialize the V matrix (potentially with a seed model)
gensvm_init_V(seed_model, model, data);