ECOCEDDecoder.h

Go to the documentation of this file.
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 ECOCEDDECODER_H__
00012 #define ECOCEDDECODER_H__
00013 
00014 #include <shogun/multiclass/ecoc/ECOCSimpleDecoder.h>
00015 #include <shogun/mathematics/Math.h>
00016 
00017 namespace shogun
00018 {
00019 
00026 class CECOCEDDecoder: public CECOCSimpleDecoder
00027 {
00028 public:
00030     CECOCEDDecoder() {}
00031 
00033     virtual ~CECOCEDDecoder() {}
00034 
00036     virtual const char* get_name() const { return "ECOCEDDecoder"; }
00037 
00038     
00039 protected:
00041     virtual bool binary_decoding()
00042     {
00043         return false;
00044     }
00045 
00047     virtual float64_t compute_distance(SGVector<float64_t> outputs, const int32_t *code)
00048     {
00049         float64_t dist = 0;
00050         for (int32_t i=0; i < outputs.vlen; ++i)
00051             dist += (outputs[i]-code[i])*(outputs[i]-code[i]);
00052         return CMath::sqrt(dist);
00053     }
00054 };
00055 
00056 } /* shogun */ 
00057 
00058 #endif /* end of include guard: ECOCEDDECODER_H__ */
00059 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation