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

SHOGUN Machine Learning Toolbox - Documentation