~ubuntu-branches/ubuntu/vivid/vowpal-wabbit/vivid

« back to all changes in this revision

Viewing changes to vowpalwabbit/noop.cc

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-08-27 20:52:23 UTC
  • mfrom: (1.2.1) (7.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130827205223-q005ps71tqinh25v
Tags: 7.3-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) by respective owners including Yahoo!, Microsoft, and
 
3
individual contributors. All rights reserved.  Released under a BSD (revised)
 
4
license as described in the file LICENSE.
 
5
 */
 
6
// This is a function which does nothing with examples.  Used when VW is used as a compressor.
 
7
 
 
8
#include "example.h"
 
9
#include "parser.h"
 
10
#include "gd.h"
 
11
#include "simple_label.h"
 
12
#include "vw.h"
 
13
 
 
14
namespace NOOP {
 
15
  void learn(void* d, example*ec) {}
 
16
  void finish(void* d) {}
 
17
 
 
18
  void save_load(void* d, io_buf& model_file, bool read, bool text) {}
 
19
  
 
20
  void drive(vw* all, void* d)
 
21
  {
 
22
    example* ec = NULL;
 
23
    
 
24
    while ( !parser_done(all->p)){
 
25
      ec = VW::get_example(all->p);
 
26
      if (ec != NULL)
 
27
        return_simple_example(*all, ec);
 
28
    }
 
29
  }
 
30
  
 
31
  learner setup(vw& all)
 
32
  {
 
33
    sl_t sl = {NULL,save_load};
 
34
    all.is_noop = true;
 
35
    learner l(NULL,drive,learn,finish,sl);
 
36
    return l;
 
37
  }
 
38
}