summaryrefslogtreecommitdiff
path: root/dtrain/test/log_reg_dyer/bin_class.h
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2011-09-25 20:23:09 +0200
committerPatrick Simianer <p@simianer.de>2011-09-25 20:23:09 +0200
commit43e7ecdca09f4125346f64d45e44f440ac964421 (patch)
treea6f7bb33d1c2b2c55118286ef59ec37beba3dab6 /dtrain/test/log_reg_dyer/bin_class.h
parent521e8c49ad529f17f63eca1726ba8e2f564ac290 (diff)
removed some quirks, less boost, prettier code, score_t
Diffstat (limited to 'dtrain/test/log_reg_dyer/bin_class.h')
-rw-r--r--dtrain/test/log_reg_dyer/bin_class.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/dtrain/test/log_reg_dyer/bin_class.h b/dtrain/test/log_reg_dyer/bin_class.h
new file mode 100644
index 00000000..3466109a
--- /dev/null
+++ b/dtrain/test/log_reg_dyer/bin_class.h
@@ -0,0 +1,22 @@
+#ifndef _BIN_CLASS_H_
+#define _BIN_CLASS_H_
+
+#include <vector>
+#include "sparse_vector.h"
+
+struct TrainingInstance {
+ // TODO add other info? loss for MIRA-type updates?
+ SparseVector<double> x_feature_map;
+ bool y;
+};
+
+struct Objective {
+ virtual ~Objective();
+
+ // returns f(x) and f'(x)
+ virtual double ObjectiveAndGradient(const SparseVector<double>& x,
+ const std::vector<TrainingInstance>& training_instances,
+ SparseVector<double>* g) const = 0;
+};
+
+#endif