Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
28 lines
774 B
Diff
28 lines
774 B
Diff
diff --git a/svm.cpp b/svm.cpp
|
|
index 3b7643e..2a34b42 100644
|
|
--- a/svm.cpp
|
|
+++ b/svm.cpp
|
|
@@ -10,6 +10,7 @@
|
|
#include <vector>
|
|
#include <cmath>
|
|
#include <algorithm>
|
|
+#include <random>
|
|
#include "feature.h"
|
|
|
|
namespace zinnia {
|
|
@@ -43,11 +44,13 @@ bool svm_train(size_t l,
|
|
}
|
|
}
|
|
|
|
+ std::random_device rand_device;
|
|
+ std::default_random_engine rand_engine(rand_device());
|
|
static const size_t kMaxIteration = 2000;
|
|
for (size_t iter = 0; iter < kMaxIteration; ++iter) {
|
|
double PGmax_new = -kINF;
|
|
double PGmin_new = kINF;
|
|
- std::random_shuffle(index.begin(), index.begin() + active_size);
|
|
+ std::shuffle(index.begin(), index.begin() + active_size, rand_engine);
|
|
|
|
for (size_t s = 0; s < active_size; ++s) {
|
|
const size_t i = index[s];
|