25 int32_t size,
float64_t w, int32_t d, int32_t s, int32_t wl)
33 float64_t w, int32_t d, int32_t s, int32_t wl, int32_t size)
47 void CRegulatoryModulesStringKernel::init()
57 SG_ADD(&
degree,
"degree",
"the degree of weighted degree kernel part",
60 "the shift of weighted degree with shifts kernel part",
MS_AVAILABLE);
63 "the matrix of motif positions from sequences left-hand side",
MS_NOT_AVAILABLE);
65 "the matrix of motif positions from sequences right-hand side",
MS_NOT_AVAILABLE);
76 SG_ERROR(
"Number of vectors does not agree (LHS: %d, Motif LHS: %d).\n",
79 SG_ERROR(
"Number of vectors does not agree (RHS: %d, Motif RHS: %d).\n",
95 SG_ERROR(
"Number of dimensions does not agree.\n")
108 bool free_avec, free_bvec;
114 int32_t alen_pos, blen_pos;
115 bool afree_pos, bfree_pos;
118 ASSERT(alen_pos==blen_pos)
119 int32_t num_pos=alen_pos;
125 for (int32_t p=0; p<num_pos; p++)
127 result_rbf+=
CMath::sq(positions_a[p]-positions_b[p]);
129 for (int32_t p2=0; p2<num_pos; p2++)
130 result_rbf+=
CMath::sq( (positions_a[p]-positions_a[p2]) - (positions_b[p]-positions_b[p2]) );
133 if (
window + positions_a[p] > alen)
134 limit = alen - positions_a[p];
136 if (
window + positions_b[p] > blen)
137 limit =
CMath::min(limit, blen - positions_b[p]);
139 result_wds+=
compute_wds(&avec[positions_a[p]], &bvec[positions_b[p]],
154 char* avec,
char* bvec, int32_t len)
158 for (int32_t i=0; i<
shift; i++)
162 for (int32_t i=0; i<len; i++)
168 for (int32_t j=0; (j<
degree) && (i+j<len); j++)
170 if (avec[i+j]!=bvec[i+j])
180 for (int32_t i=0; i<len; i++)
182 for (int32_t k=1; (k<=
shift) && (i+k<len); k++)
189 for (int32_t j=0; (j<
degree) && (i+j+k<len); j++)
191 if (avec[i+j+k]!=bvec[i+j])
197 for (int32_t j=0; (j<
degree) && (i+j+k<len); j++)
199 if (avec[i+j]!=bvec[i+j+k])
206 max_shift_vec[k-1] += sumi1 + sumi2 ;
211 for (int32_t i=0; i<
shift; i++)
212 result += max_shift_vec[i]/(2*(i+1)) ;
214 SG_FREE(max_shift_vec);
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
ST * get_feature_vector(int32_t num, int32_t &len, bool &dofree)
int32_t get_num_features() const
SGVector< float64_t > weights
CDenseFeatures< uint16_t > * motif_positions_rhs
virtual bool init(CFeatures *l, CFeatures *r)
virtual int32_t get_num_vectors() const =0
float64_t compute_wds(char *avec, char *bvec, int32_t len)
Class SGObject is the base class of all shogun objects.
virtual int32_t get_num_vectors() const
virtual ~CRegulatoryModulesStringKernel()
CDenseFeatures< uint16_t > * motif_positions_lhs
virtual bool init_normalizer()
CFeatures * rhs
feature vectors to occur on right hand side
all of classes and functions are contained in the shogun namespace
void set_motif_positions(CDenseFeatures< uint16_t > *positions_lhs, CDenseFeatures< uint16_t > *positions_rhs)
CRegulatoryModulesStringKernel()
CFeatures * lhs
feature vectors to occur on left hand side
The class Features is the base class of all feature objects.
SGVector< float64_t > position_weights
Template class StringKernel, is the base class of all String Kernels.