yat
0.8.3pre
|
00001 #ifndef _theplu_yat_classifier_sv_index_ 00002 #define _theplu_yat_classifier_sv_index_ 00003 00004 // $Id: SVindex.h 2119 2009-12-12 23:11:43Z peter $ 00005 00006 /* 00007 Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 00008 00009 This file is part of the yat library, http://dev.thep.lu.se/yat 00010 00011 The yat library is free software; you can redistribute it and/or 00012 modify it under the terms of the GNU General Public License as 00013 published by the Free Software Foundation; either version 3 of the 00014 License, or (at your option) any later version. 00015 00016 The yat library is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 General Public License for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with yat. If not, see <http://www.gnu.org/licenses/>. 00023 */ 00024 00025 #include <vector> 00026 00027 namespace theplu { 00028 namespace yat { 00029 00030 namespace utility { 00031 class Vector; 00032 } 00033 00034 namespace classifier { 00035 00043 class SVindex 00044 { 00045 00046 public: 00048 SVindex(); 00049 00051 SVindex(const size_t); 00052 00054 size_t index_first(void) const; 00055 00057 size_t index_second(void) const; 00058 00060 void init(const utility::Vector& alpha, const double); 00061 00063 size_t nof_sv(void) const; 00064 00066 void nsv_first(void); 00067 00069 void nsv_second(void); 00070 00073 void shuffle(void); 00074 00076 size_t size(void) const; 00077 00079 void sv_first(void); 00080 00082 void sv_second(void); 00083 00085 void update_first(const size_t i); 00086 00088 void update_second(const size_t i); 00089 00091 size_t value_first(void) const; 00092 00094 size_t value_second(void) const; 00095 00097 size_t operator()(size_t i) const; 00098 00099 private: 00100 size_t index_first_; 00101 size_t index_second_; 00102 size_t nof_sv_; 00103 std::vector<size_t> vec_; 00104 size_t value_first_; // vec_[index_first_] exists for fast access 00105 size_t value_second_; // vec_[index_second_] exists for fast access 00106 00107 }; 00108 00109 }}} // of namespace classifier, yat, and theplu 00110 00111 #endif