SHOGUN
v3.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
kernel
string
SNPStringKernel.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 2009-2010 Soeren Sonnenburg
8
* Copyright (C) 2009-2010 Berlin Institute of Technology
9
*/
10
11
#ifndef _SNPSTRINGKERNEL_H___
12
#define _SNPSTRINGKERNEL_H___
13
14
#include <
shogun/lib/common.h
>
15
#include <
shogun/lib/memory.h
>
16
#include <
shogun/kernel/string/StringKernel.h
>
17
18
namespace
shogun
19
{
37
class
CSNPStringKernel
:
public
CStringKernel
<char>
38
{
39
public
:
41
CSNPStringKernel
();
42
50
CSNPStringKernel
(int32_t size, int32_t degree, int32_t win_len,
bool
inhomogene);
51
60
CSNPStringKernel
(
61
CStringFeatures<char>
* l,
CStringFeatures<char>
* r,
62
int32_t degree, int32_t win_len,
bool
inhomogene);
63
64
virtual
~CSNPStringKernel
();
65
72
virtual
bool
init
(
CFeatures
* l,
CFeatures
* r);
73
75
virtual
void
cleanup
();
76
81
virtual
EKernelType
get_kernel_type
()
82
{
83
return
K_POLYMATCH
;
84
}
85
90
void
set_minor_base_string
(
const
char
* str)
91
{
92
m_str_min
=get_strdup(str);
93
}
94
99
void
set_major_base_string
(
const
char
* str)
100
{
101
m_str_maj
=get_strdup(str);
102
}
103
108
char
*
get_minor_base_string
()
109
{
110
return
m_str_min
;
111
}
112
117
char
*
get_major_base_string
()
118
{
119
return
m_str_maj
;
120
}
121
123
void
obtain_base_strings
();
124
129
virtual
const
char
*
get_name
()
const
{
return
"SNPStringKernel"
; }
130
131
/* register the parameters
132
*/
133
virtual
void
register_params
();
134
135
protected
:
144
virtual
float64_t
compute
(int32_t idx_a, int32_t idx_b);
145
146
protected
:
148
int32_t
m_degree
;
150
int32_t
m_win_len
;
151
153
bool
m_inhomogene
;
154
157
int32_t
m_str_len
;
158
160
char
*
m_str_min
;
162
char
*
m_str_maj
;
163
164
private
:
165
void
init();
166
};
167
}
168
#endif
/* _SNPSTRINGKERNEL_H___ */
SHOGUN
Machine Learning Toolbox - Documentation