diff options
author | Patrick Simianer <p@simianer.de> | 2011-09-25 20:23:09 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-09-25 20:23:09 +0200 |
commit | 43e7ecdca09f4125346f64d45e44f440ac964421 (patch) | |
tree | a6f7bb33d1c2b2c55118286ef59ec37beba3dab6 /dtrain/pairsampling.h | |
parent | 521e8c49ad529f17f63eca1726ba8e2f564ac290 (diff) |
removed some quirks, less boost, prettier code, score_t
Diffstat (limited to 'dtrain/pairsampling.h')
-rw-r--r-- | dtrain/pairsampling.h | 12 |
1 files changed, 5 insertions, 7 deletions
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<double> first, second; size_t first_rank, second_rank; double first_score, second_score; }; -typedef vector<TPair> TrainingInstances; - inline void -sample_all_pairs(KBestList* kb, TrainingInstances &training) +sample_all_pairs(Samples* kb, vector<Pair> &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<Pair> &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; |