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

multiclass.h « vowpalwabbit - github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fb0a76f84c391d71e1d12859fa303b573bfdd09a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Copyright (c) by respective owners including Yahoo!, Microsoft, and
individual contributors. All rights reserved.  Released under a BSD
license as described in the file LICENSE.
 */
#ifndef MULTICLASS_H
#define MULTICLASS_H

#include "io_buf.h"
#include "parse_primitives.h"
#include "example.h"

namespace MULTICLASS
{

  struct multiclass {
    uint32_t label;
    float weight;
    uint32_t prediction;
  };
  
  extern label_parser mc_label;
  
  void output_example(vw& all, example& ec);

  inline int label_is_test(multiclass* ld)
  { return ld->label == (uint32_t)-1; }

  inline int example_is_test(example* ec)
  { return label_is_test((multiclass*)ec->ld); }

  inline uint32_t get_example_label(example* ec)
  { return ((multiclass*)ec->ld)->label; }
}

#endif