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 #ifndef _VW_EXAMPLE_H__ 00016 #define _VW_EXAMPLE_H__ 00017 00018 #include <shogun/lib/DataType.h> 00019 #include <shogun/lib/common.h> 00020 #include <shogun/lib/v_array.h> 00021 #include <shogun/classifier/vw/vw_constants.h> 00022 #include <shogun/classifier/vw/vw_label.h> 00023 00024 namespace shogun 00025 { 00026 00032 class VwFeature 00033 { 00034 public: 00036 float32_t x; 00037 00039 uint32_t weight_index; 00040 00048 bool operator==(VwFeature j) { return weight_index == j.weight_index; } 00049 }; 00050 00056 class VwExample 00057 { 00058 public: 00062 VwExample(); 00063 00067 ~VwExample(); 00068 00073 void reset_members(); 00074 00075 public: 00077 VwLabel* ld; 00078 00080 v_array<char> tag; 00082 v_array<vw_size_t> indices; 00084 v_array<VwFeature> atomics[256]; 00085 00087 vw_size_t num_features; 00089 vw_size_t pass; 00091 float32_t final_prediction; 00093 float32_t loss; 00095 float32_t eta_round; 00097 float32_t global_weight; 00099 float32_t example_t; 00100 00102 float64_t sum_feat_sq[256]; 00104 float32_t total_sum_feat_sq; 00105 00107 vw_size_t example_counter; 00109 bool sorted; 00110 }; 00111 00112 } 00113 #endif // _VW_EXAMPLE_H__