vw_label.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009 Yahoo! Inc.  All rights reserved.  The copyrights
00003  * embodied in the content of this file are licensed under the BSD
00004  * (revised) open source license.
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * Written (W) 2011 Shashwat Lal Das
00012  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society.
00013  */
00014 
00015 #include <shogun/classifier/vw/vw_label.h>
00016 
00017 using namespace shogun;
00018 
00019 void VwLabel::label_from_substring(v_array<substring>& words)
00020 {
00021     switch(words.index())
00022     {
00023     case 0:
00024         break;
00025     case 1:
00026         label = float_of_substring(words[0]);
00027         break;
00028     case 2:
00029         label = float_of_substring(words[0]);
00030         weight = float_of_substring(words[1]);
00031         break;
00032     case 3:
00033         label = float_of_substring(words[0]);
00034         weight = float_of_substring(words[1]);
00035         initial = float_of_substring(words[2]);
00036         break;
00037     default:
00038         SG_SERROR("malformed example!\n"
00039               "words.index() = %d\n", words.index());
00040     }
00041 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation