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_ENV_H__ 00016 #define _VW_ENV_H__ 00017 00018 #include <shogun/base/SGObject.h> 00019 #include <shogun/base/DynArray.h> 00020 #include <shogun/lib/DataType.h> 00021 #include <shogun/lib/common.h> 00022 #include <shogun/lib/v_array.h> 00023 #include <shogun/classifier/vw/vw_constants.h> 00024 00025 namespace shogun 00026 { 00027 00039 class CVwEnvironment: public CSGObject 00040 { 00041 public: 00046 CVwEnvironment(); 00047 00051 virtual ~CVwEnvironment() { } 00052 00057 inline void set_num_bits(vw_size_t bits) { num_bits = bits; } 00058 00063 inline vw_size_t get_num_bits() { return num_bits; } 00064 00069 inline void set_mask(vw_size_t m) { mask = m; } 00070 00075 inline vw_size_t get_mask() { return mask; } 00076 00081 inline float64_t get_min_label() { return min_label; } 00082 00087 inline float64_t get_max_label() { return max_label; } 00088 00093 inline vw_size_t num_threads() { return 1 << thread_bits; } 00094 00099 inline vw_size_t length() { return 1 << num_bits; } 00100 00107 void set_stride(vw_size_t new_stride); 00108 00114 virtual const char* get_name() const { return "VwEnvironment"; } 00115 00116 private: 00120 virtual void init(); 00121 00122 public: 00124 vw_size_t num_bits; 00126 vw_size_t thread_bits; 00128 vw_size_t mask; 00130 vw_size_t thread_mask; 00132 vw_size_t stride; 00133 00135 float64_t min_label; 00137 float64_t max_label; 00138 00140 float32_t eta; 00142 float32_t eta_decay_rate; 00143 00145 bool adaptive; 00147 bool exact_adaptive_norm; 00149 float32_t l1_regularization; 00150 00152 bool random_weights; 00154 float32_t initial_weight; 00155 00157 float32_t update_sum; 00158 00160 float32_t t; 00162 float64_t initial_t; 00164 float32_t power_t; 00165 00167 int64_t example_number; 00169 float64_t weighted_examples; 00171 float64_t weighted_unlabeled_examples; 00173 float64_t weighted_labels; 00175 vw_size_t total_features; 00177 float64_t sum_loss; 00179 vw_size_t passes_complete; 00181 vw_size_t num_passes; 00182 00184 vw_size_t ngram; 00186 vw_size_t skips; 00187 00189 bool ignore_some; 00191 bool ignore[256]; 00192 00194 DynArray<char*> pairs; 00195 00197 const char* vw_version; 00199 vw_size_t v_length; 00200 }; 00201 00202 } 00203 #endif // _VW_ENV_H__