SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
vw_label.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 Yahoo! Inc. All rights reserved. The copyrights
3  * embodied in the content of this file are licensed under the BSD
4  * (revised) open source license.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Written (W) 2011 Shashwat Lal Das
12  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society.
13  */
14 
16 
17 using namespace shogun;
18 
20 {
21  switch(words.index())
22  {
23  case 0:
24  break;
25  case 1:
26  label = SGIO::float_of_substring(words[0]);
27  break;
28  case 2:
29  label = SGIO::float_of_substring(words[0]);
30  weight = SGIO::float_of_substring(words[1]);
31  break;
32  case 3:
33  label = SGIO::float_of_substring(words[0]);
34  weight = SGIO::float_of_substring(words[1]);
36  break;
37  default:
38  SG_SERROR("malformed example!\n"
39  "words.index() = %d\n", words.index());
40  }
41 }
Class v_array taken directly from JL's implementation.
float32_t label
Label value.
Definition: vw_label.h:92
float32_t weight
Weight of example.
Definition: vw_label.h:94
void label_from_substring(v_array< substring > &words)
Definition: vw_label.cpp:19
static float32_t float_of_substring(substring s)
Definition: SGIO.cpp:336
float32_t initial
Initial approximation.
Definition: vw_label.h:96
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
#define SG_SERROR(...)
Definition: SGIO.h:179

SHOGUN Machine Learning Toolbox - Documentation