SHOGUN v0.9.0
|
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) 2009 Sebastian J. Schultheiss and Soeren Sonnenburg 00008 * Copyright (C) 2009 Max-Planck-Society 00009 */ 00010 00011 #ifndef _REGULATORYMODULESSTRINGKERNEL_H___ 00012 #define _REGULATORYMODULESSTRINGKERNEL_H___ 00013 00014 #include "lib/common.h" 00015 #include "kernel/StringKernel.h" 00016 #include "features/SimpleFeatures.h" 00017 00018 namespace shogun 00019 { 00025 class CRegulatoryModulesStringKernel: public CStringKernel<char> 00026 { 00027 public: 00029 CRegulatoryModulesStringKernel(void); 00030 00039 CRegulatoryModulesStringKernel(int32_t size, float64_t width, int32_t degree, int32_t shift, int32_t window); 00040 00053 CRegulatoryModulesStringKernel(CStringFeatures<char>* lstr, CStringFeatures<char>* rstr, 00054 CSimpleFeatures<uint16_t>* lpos, CSimpleFeatures<uint16_t>* rpos, 00055 float64_t width, int32_t degree, int32_t shift, int32_t window, int32_t size=10); 00056 00058 virtual ~CRegulatoryModulesStringKernel(); 00059 00066 virtual bool init(CFeatures* l, CFeatures* r); 00067 00072 virtual EKernelType get_kernel_type() { return K_REGULATORYMODULES; } 00073 00078 inline virtual const char* get_name() const { return "RegulatoryModulesStringKernel"; } 00079 00085 void set_motif_positions( 00086 CSimpleFeatures<uint16_t>* positions_lhs, CSimpleFeatures<uint16_t>* positions_rhs); 00087 00088 protected: 00097 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00098 00106 float64_t compute_wds(char* avec, char* bvec, int32_t len); 00107 00108 00110 void set_wd_weights(); 00111 00112 protected: 00114 float64_t width; 00115 00117 int32_t degree; 00119 int32_t shift; 00120 00122 int32_t window; 00123 00125 CSimpleFeatures<uint16_t>* motif_positions_lhs; 00126 00128 CSimpleFeatures<uint16_t>* motif_positions_rhs; 00129 00131 float64_t* position_weights; 00132 00134 float64_t* weights; 00135 }; 00136 } 00137 #endif /* _REGULATORYMODULESSTRINGKERNEL_H__ */