SHOGUN
3.2.1
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
classifier
vw
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
15
#include <
shogun/classifier/vw/vw_label.h
>
16
17
using namespace
shogun;
18
19
void
VwLabel::label_from_substring
(
v_array<substring>
& words)
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]);
35
initial
=
SGIO::float_of_substring
(words[2]);
36
break
;
37
default
:
38
SG_SERROR
(
"malformed example!\n"
39
"words.index() = %d\n"
, words.
index
());
40
}
41
}
shogun::v_array
Class v_array taken directly from JL's implementation.
Definition:
CSVFile.h:26
vw_label.h
shogun::v_array::index
int index
Definition:
JLCoverTreePoint.h:44
shogun::VwLabel::label
float32_t label
Label value.
Definition:
vw_label.h:92
shogun::VwLabel::weight
float32_t weight
Weight of example.
Definition:
vw_label.h:94
shogun::VwLabel::label_from_substring
void label_from_substring(v_array< substring > &words)
Definition:
vw_label.cpp:19
shogun::SGIO::float_of_substring
static float32_t float_of_substring(substring s)
Definition:
SGIO.cpp:337
shogun::VwLabel::initial
float32_t initial
Initial approximation.
Definition:
vw_label.h:96
SG_SERROR
#define SG_SERROR(...)
Definition:
SGIO.h:180
SHOGUN
Machine Learning Toolbox - Documentation