vw_example.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_example.h>
00016 
00017 using namespace shogun;
00018 
00019 VwExample::VwExample(): tag(), indices(), atomics(),
00020             num_features(0), pass(0),
00021             final_prediction(0.), loss(0),
00022             eta_round(0.), global_weight(0),
00023             example_t(0), total_sum_feat_sq(1), sorted(false)
00024 {
00025     ld = new VwLabel();
00026 }
00027 
00028 VwExample::~VwExample()
00029 {
00030     if (ld)
00031         delete ld;
00032 }
00033 
00034 void VwExample::reset_members()
00035 {
00036     num_features = 0;
00037     total_sum_feat_sq = 1;
00038     example_counter = 0;
00039     global_weight = 0;
00040     example_t = 0;
00041     eta_round = 0;
00042     final_prediction = 0;
00043     loss = 0;
00044 
00045     for (vw_size_t* i = indices.begin; i != indices.end; i++)
00046     {
00047         atomics[*i].erase();
00048         sum_feat_sq[*i]=0;
00049     }
00050 
00051     indices.erase();
00052     tag.erase();
00053 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation