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) 2008-2009 Soeren Sonnenburg 00008 * Copyright (C) 2008-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _KERNELNORMALIZER_H___ 00012 #define _KERNELNORMALIZER_H___ 00013 00014 #include <shogun/kernel/Kernel.h> 00015 #include <shogun/base/Parameter.h> 00016 00017 namespace shogun 00018 { 00019 00021 enum ENormalizerType 00022 { 00023 N_REGULAR = 0, 00024 N_MULTITASK = 1 00025 }; 00026 00027 class CKernel; 00051 class CKernelNormalizer : public CSGObject 00052 { 00053 public: 00054 00057 CKernelNormalizer() : CSGObject() 00058 { 00059 register_params(); 00060 m_type = N_REGULAR; 00061 } 00062 00064 virtual ~CKernelNormalizer() { } 00065 00068 virtual bool init(CKernel* k)=0; 00069 00075 virtual float64_t normalize( 00076 float64_t value, int32_t idx_lhs, int32_t idx_rhs)=0; 00077 00082 virtual float64_t normalize_lhs(float64_t value, int32_t idx_lhs)=0; 00083 00088 virtual float64_t normalize_rhs(float64_t value, int32_t idx_rhs)=0; 00089 00092 virtual void register_params() 00093 { 00094 SG_ADD((machine_int_t*) &m_type, "m_type", "Normalizer type.", 00095 MS_NOT_AVAILABLE); 00096 } 00097 00100 ENormalizerType get_normalizer_type() 00101 { 00102 return m_type; 00103 } 00104 00108 void set_normalizer_type(ENormalizerType type) 00109 { 00110 m_type = type; 00111 } 00112 00113 protected: 00115 ENormalizerType m_type; 00116 }; 00117 } 00118 #endif