From 43e7ecdca09f4125346f64d45e44f440ac964421 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Sun, 25 Sep 2011 20:23:09 +0200
Subject: removed some quirks, less boost, prettier code, score_t
---
dtrain/pairsampling.h | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
(limited to 'dtrain/pairsampling.h')
diff --git a/dtrain/pairsampling.h b/dtrain/pairsampling.h
index e06036ca..a8521485 100644
--- a/dtrain/pairsampling.h
+++ b/dtrain/pairsampling.h
@@ -8,21 +8,19 @@ namespace dtrain
{
-struct TPair
+struct Pair
{
SparseVector first, second;
size_t first_rank, second_rank;
double first_score, second_score;
};
-typedef vector TrainingInstances;
-
inline void
-sample_all_pairs(KBestList* kb, TrainingInstances &training)
+sample_all_pairs(Samples* kb, vector &training)
{
for (size_t i = 0; i < kb->GetSize()-1; i++) {
for (size_t j = i+1; j < kb->GetSize(); j++) {
- TPair p;
+ Pair p;
p.first = kb->feats[i];
p.second = kb->feats[j];
p.first_rank = i;
@@ -35,12 +33,12 @@ sample_all_pairs(KBestList* kb, TrainingInstances &training)
}
inline void
-sample_rand_pairs(KBestList* kb, TrainingInstances &training, MT19937* prng)
+sample_rand_pairs(Samples* kb, vector &training, MT19937* prng)
{
for (size_t i = 0; i < kb->GetSize()-1; i++) {
for (size_t j = i+1; j < kb->GetSize(); j++) {
if (prng->next() < .5) {
- TPair p;
+ Pair p;
p.first = kb->feats[i];
p.second = kb->feats[j];
p.first_rank = i;
--
cgit v1.2.3