00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2012 Chiyuan Zhang 00008 * Copyright (C) 2012 Chiyuan Zhang 00009 */ 00010 00011 #ifndef ECOCHDDECODER_H__ 00012 #define ECOCHDDECODER_H__ 00013 00014 #include <shogun/multiclass/ecoc/ECOCSimpleDecoder.h> 00015 #include <shogun/multiclass/ecoc/ECOCUtil.h> 00016 00017 namespace shogun 00018 { 00019 00021 class CECOCHDDecoder: public CECOCSimpleDecoder 00022 { 00023 public: 00025 CECOCHDDecoder() {} 00026 00028 virtual ~CECOCHDDecoder() {} 00029 00031 virtual const char* get_name() const 00032 { 00033 return "ECOCHDDecoder"; 00034 } 00035 00036 protected: 00038 virtual bool binary_decoding() 00039 { 00040 return true; 00041 } 00042 00044 virtual float64_t compute_distance(SGVector<float64_t> outputs, const int32_t *code) 00045 { 00046 return CECOCUtil::hamming_distance(outputs.vector, code, outputs.vlen); 00047 } 00048 }; 00049 00050 } 00051 00052 #endif /* end of include guard: ECOCHDDECODER_H__ */