Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Langford <jl@nyclamp.(none)>2014-01-09 00:01:11 +0400
committerJohn Langford <jl@nyclamp.(none)>2014-01-09 00:01:11 +0400
commit5336bffc0d67fb224c90553f4aceaea671bcbd77 (patch)
treefe79f7ea9074a37b356da7d984a08a216daea040 /vowpalwabbit/mf.cc
parente258410d86feda58859ecc695940b816de26a8f2 (diff)
finished void* removal in learner.h
Diffstat (limited to 'vowpalwabbit/mf.cc')
-rw-r--r--vowpalwabbit/mf.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/vowpalwabbit/mf.cc b/vowpalwabbit/mf.cc
index 3e0f6b89..9d7718c3 100644
--- a/vowpalwabbit/mf.cc
+++ b/vowpalwabbit/mf.cc
@@ -53,8 +53,7 @@ struct mf {
};
template <bool cache_sub_predictions>
-void predict(void *d, learner& base, example* ec) {
- mf* data = (mf*) d;
+void predict(mf *data, learner& base, example* ec) {
vw* all = data->all;
float prediction = 0;
@@ -110,12 +109,11 @@ void predict(void *d, learner& base, example* ec) {
ec->final_prediction = GD::finalize_prediction(*(data->all), ec->partial_prediction);
}
- void learn(void* d, learner& base, example* ec) {
- mf* data = (mf*) d;
+ void learn(mf* data, learner& base, example* ec) {
vw* all = data->all;
// predict with current weights
- predict<true>(d, base, ec);
+ predict<true>(data, base, ec);
// update linear weights
base.update(ec);
@@ -202,7 +200,9 @@ void finish(mf* o) {
for (size_t j = 0; j < (all.reg.weight_mask + 1) / all.reg.stride; j++)
all.reg.weight_vector[j*all.reg.stride] = (float) (0.1 * frand48());
}
- learner* l = new learner(data, learn, predict<false>, all.l, 2*data->rank+1);
+ learner* l = new learner(data, all.l, 2*data->rank+1);
+ l->set_learn<mf, learn>();
+ l->set_predict<mf, predict<false> >();
l->set_finish<mf,finish>();
return l;
}