summaryrefslogtreecommitdiff
path: root/dtrain/sample.h
diff options
context:
space:
mode:
Diffstat (limited to 'dtrain/sample.h')
-rw-r--r--dtrain/sample.h64
1 files changed, 0 insertions, 64 deletions
diff --git a/dtrain/sample.h b/dtrain/sample.h
deleted file mode 100644
index 502901af..00000000
--- a/dtrain/sample.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef _DTRAIN_SAMPLE_H_
-#define _DTRAIN_SAMPLE_H_
-
-
-#include "kbestget.h"
-
-
-namespace dtrain
-{
-
-
-struct TPair
-{
- SparseVector<double> first, second;
- size_t first_rank, second_rank;
- double first_score, second_score;
-};
-
-typedef vector<TPair> TrainingInstances;
-
-
-void
-sample_all( KBestList* kb, TrainingInstances &training )
-{
- for ( size_t i = 0; i < kb->GetSize()-1; i++ ) {
- for ( size_t j = i+1; j < kb->GetSize(); j++ ) {
- TPair p;
- p.first = kb->feats[i];
- p.second = kb->feats[j];
- p.first_rank = i;
- p.second_rank = j;
- p.first_score = kb->scores[i];
- p.second_score = kb->scores[j];
- training.push_back( p );
- }
- }
-}
-
-void
-sample_rand( KBestList* kb, TrainingInstances &training )
-{
- srand( time(NULL) );
- for ( size_t i = 0; i < kb->GetSize()-1; i++ ) {
- for ( size_t j = i+1; j < kb->GetSize(); j++ ) {
- if ( rand() % 2 ) {
- TPair p;
- p.first = kb->feats[i];
- p.second = kb->feats[j];
- p.first_rank = i;
- p.second_rank = j;
- p.first_score = kb->scores[i];
- p.second_score = kb->scores[j];
- training.push_back( p );
- }
- }
- }
-}
-
-
-} // namespace
-
-
-#endif
-