CStringFeatures< ST > Class Template Reference

Inheritance diagram for CStringFeatures< ST >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<class ST>
class CStringFeatures< ST >

template class StringFeatures StringFeatures do not yet support PREPROCS

Definition at line 59 of file StringFeatures.h.


Public Member Functions

 CStringFeatures (E_ALPHABET alpha)
 CStringFeatures (CAlphabet *alpha)
 CStringFeatures (const CStringFeatures &orig)
 CStringFeatures (char *fname, E_ALPHABET alpha=DNA)
virtual ~CStringFeatures ()
void cleanup ()
virtual EFeatureClass get_feature_class ()
virtual EFeatureType get_feature_type ()
CAlphabetget_alphabet ()
virtual CFeaturesduplicate () const
void select_feature_vector (INT num)
void get_string (ST **dst, INT *len)
virtual ST * get_feature_vector (INT num, INT &len)
virtual void set_feature_vector (INT num, ST *string, INT len)
virtual ST get_feature (INT vec_num, INT feat_num)
virtual INT get_vector_length (INT vec_num)
virtual INT get_max_vector_length ()
virtual INT get_num_vectors ()
LONGREAL get_num_symbols ()
LONGREAL get_max_num_symbols ()
LONGREAL get_original_num_symbols ()
INT get_order ()
ST get_masked_symbols (ST symbol, BYTE mask)
ST shift_offset (ST offset, INT amount)
ST shift_symbol (ST symbol, INT amount)
virtual bool load (CHAR *fname)
bool load_dna_file (CHAR *fname, bool remap_to_bin=true)
bool load_from_directory (CHAR *dirname)
bool set_features (T_STRING< ST > *p_features, INT p_num_vectors, INT p_max_string_length)
virtual T_STRING< ST > * get_features (INT &num_str, INT &max_str_len)
virtual bool save (CHAR *dest)
virtual INT get_size ()
virtual bool apply_preproc (bool force_preprocessing=false)
INT obtain_by_sliding_window (INT window_size, INT step_size, INT skip=0)
INT obtain_by_position_list (INT window_size, CDynamicArray< INT > *positions, INT skip=0)
bool obtain_from_char (CStringFeatures< CHAR > *sf, INT start, INT p_order, INT gap, bool rev)
template<class CT>
bool obtain_from_char_features (CStringFeatures< CT > *sf, INT start, INT p_order, INT gap, bool rev)
bool have_same_length (INT len)
template<>
EFeatureType get_feature_type ()
template<>
EFeatureType get_feature_type ()
template<>
EFeatureType get_feature_type ()
template<>
EFeatureType get_feature_type ()
template<>
EFeatureType get_feature_type ()
template<>
EFeatureType get_feature_type ()
template<>
EFeatureType get_feature_type ()
template<>
EFeatureType get_feature_type ()
template<>
EFeatureType get_feature_type ()
virtual INT add_preproc (CPreProc *p)
 set preprocessor
virtual CPreProcdel_preproc (INT num)
 del current preprocessor
CPreProcget_preproc (INT num)
 get current preprocessor
void set_preprocessed (INT num)
bool is_preprocessed (INT num)
INT get_num_preprocessed ()
 get whether specified preprocessor (or all if num=1) was/were already applied
INT get_num_preproc ()
void clean_preprocs ()
 clears all preprocs
INT get_cache_size ()
virtual bool reshape (INT num_features, INT num_vectors)
void list_feature_obj ()
bool check_feature_compatibility (CFeatures *f)

Static Public Attributes

static CParallel parallel
static CIO io
static CVersion version

Protected Member Functions

void translate_from_single_order (ST *obs, INT sequence_length, INT start, INT p_order, INT max_val)
void translate_from_single_order_reversed (ST *obs, INT sequence_length, INT start, INT p_order, INT max_val)
void translate_from_single_order (ST *obs, INT sequence_length, INT start, INT p_order, INT max_val, INT gap)
void translate_from_single_order_reversed (ST *obs, INT sequence_length, INT start, INT p_order, INT max_val, INT gap)

Protected Attributes

CAlphabetalphabet
 alphabet
INT num_vectors
 number of string vectors
T_STRING< ST > * features
 this contains the array of features.
ST * single_string
 true when single string / created by sliding window
INT length_of_single_string
 length of prior single string
INT max_string_length
 length of longest string
LONGREAL num_symbols
 number of used symbols
LONGREAL original_num_symbols
 original number of used symbols (before higher order mapping)
INT order
 order used in higher order mapping
INT selected_vector
 vector to be obtained via get_string
ST * symbol_mask_table
 order used in higher order mapping

Constructor & Destructor Documentation

template<class ST>
CStringFeatures< ST >::CStringFeatures ( E_ALPHABET  alpha  ) 

constructor

Parameters:
alpha alphabet (type) to use for string features

Definition at line 66 of file StringFeatures.h.

template<class ST>
CStringFeatures< ST >::CStringFeatures ( CAlphabet alpha  ) 

constructor

Parameters:
alpha alphabet to use for string features

Definition at line 82 of file StringFeatures.h.

template<class ST>
CStringFeatures< ST >::CStringFeatures ( const CStringFeatures< ST > &  orig  ) 

copy constructor

Definition at line 95 of file StringFeatures.h.

template<class ST>
CStringFeatures< ST >::CStringFeatures ( char *  fname,
E_ALPHABET  alpha = DNA 
)

constructor

Parameters:
fname filename to load features from
alpha alphabet (type) to use for string features

Definition at line 135 of file StringFeatures.h.

template<class ST>
virtual CStringFeatures< ST >::~CStringFeatures (  )  [virtual]

Definition at line 148 of file StringFeatures.h.


Member Function Documentation

template<class ST>
void CStringFeatures< ST >::cleanup (  ) 

cleanup string features

Definition at line 160 of file StringFeatures.h.

template<class ST>
virtual EFeatureClass CStringFeatures< ST >::get_feature_class (  )  [virtual]

get feature class

Returns:
feature class STRING

Implements CFeatures.

Definition at line 186 of file StringFeatures.h.

template<class ST>
virtual EFeatureType CStringFeatures< ST >::get_feature_type (  )  [virtual]

get feature type

Returns:
templated feature type

Implements CFeatures.

template<class ST>
CAlphabet* CStringFeatures< ST >::get_alphabet (  ) 

get alphabet used in string features

Returns:
alphabet

Definition at line 198 of file StringFeatures.h.

template<class ST>
virtual CFeatures* CStringFeatures< ST >::duplicate (  )  const [virtual]

duplicate feature object

Returns:
feature object

Implements CFeatures.

Definition at line 208 of file StringFeatures.h.

template<class ST>
void CStringFeatures< ST >::select_feature_vector ( INT  num  ) 

select feature vector

Parameters:
num which feature vector to select

Definition at line 217 of file StringFeatures.h.

template<class ST>
void CStringFeatures< ST >::get_string ( ST **  dst,
INT len 
)

get feature vector for selected example

Parameters:
dst destination where vector will be stored
len number of features in vector

Definition at line 230 of file StringFeatures.h.

template<class ST>
virtual ST* CStringFeatures< ST >::get_feature_vector ( INT  num,
INT len 
) [virtual]

get feature vector for sample num

Parameters:
num index of feature vector
len length is returned by reference
Returns:
feature vector for sample num

Definition at line 246 of file StringFeatures.h.

template<class ST>
virtual void CStringFeatures< ST >::set_feature_vector ( INT  num,
ST *  string,
INT  len 
) [virtual]

set feature vector for sample num

Parameters:
num index of feature vector
string string with the feature vector's content
len length of the string

Definition at line 261 of file StringFeatures.h.

template<class ST>
virtual ST CStringFeatures< ST >::get_feature ( INT  vec_num,
INT  feat_num 
) [virtual]

get feature

Parameters:
vec_num which vector
feat_num which feature
Returns:
feature

Definition at line 276 of file StringFeatures.h.

template<class ST>
virtual INT CStringFeatures< ST >::get_vector_length ( INT  vec_num  )  [virtual]

get vector length

Parameters:
vec_num which vector
Returns:
length of vector

Definition at line 289 of file StringFeatures.h.

template<class ST>
virtual INT CStringFeatures< ST >::get_max_vector_length (  )  [virtual]

get maximum vector length

Returns:
maximum vector/string length

Definition at line 299 of file StringFeatures.h.

template<class ST>
virtual INT CStringFeatures< ST >::get_num_vectors (  )  [virtual]

get number of vectors

Returns:
number of vectors

Implements CFeatures.

Definition at line 308 of file StringFeatures.h.

template<class ST>
LONGREAL CStringFeatures< ST >::get_num_symbols (  ) 

get number of symbols

Note: LONGREAL sounds weird, but LONG is not long enough

Returns:
number of symbols

Definition at line 316 of file StringFeatures.h.

template<class ST>
LONGREAL CStringFeatures< ST >::get_max_num_symbols (  ) 

get maximum number of symbols

Note: LONGREAL sounds weird, but LONG is not long enough

Returns:
maximum number of symbols

Definition at line 324 of file StringFeatures.h.

template<class ST>
LONGREAL CStringFeatures< ST >::get_original_num_symbols (  ) 

number of symbols before higher order mapping

Returns:
original number of symbols

Definition at line 332 of file StringFeatures.h.

template<class ST>
INT CStringFeatures< ST >::get_order (  ) 

order used for higher order mapping

Returns:
order

Definition at line 338 of file StringFeatures.h.

template<class ST>
ST CStringFeatures< ST >::get_masked_symbols ( ST  symbol,
BYTE  mask 
)

a higher order mapped symbol will be shaped such that the symbols specified by bits in the mask will be returned.

Parameters:
symbol symbol to mask
mask mask to apply
Returns:
masked symbol

Definition at line 347 of file StringFeatures.h.

template<class ST>
ST CStringFeatures< ST >::shift_offset ( ST  offset,
INT  amount 
)

shift offset to the left by amount

Parameters:
offset offset to shift
amount amount to shift the offset
Returns:
shifted offset

Definition at line 359 of file StringFeatures.h.

template<class ST>
ST CStringFeatures< ST >::shift_symbol ( ST  symbol,
INT  amount 
)

shift symbol to the right by amount (taking care of custom symbol sizes)

Parameters:
symbol symbol to shift
amount amount to shift the symbol
Returns:
shifted symbol

Definition at line 371 of file StringFeatures.h.

template<class ST>
virtual bool CStringFeatures< ST >::load ( CHAR fname  )  [virtual]

load features from file

Parameters:
fname filename to load from
Returns:
if loading was successful

Reimplemented from CFeatures.

Definition at line 382 of file StringFeatures.h.

template<class ST>
bool CStringFeatures< ST >::load_dna_file ( CHAR fname,
bool  remap_to_bin = true 
)

load DNA features from file

Parameters:
fname filename to load from
remap_to_bin if remap_to_bin
Returns:
if loading was successful

Definition at line 442 of file StringFeatures.h.

template<class ST>
bool CStringFeatures< ST >::load_from_directory ( CHAR dirname  ) 

load features from directory

Parameters:
dirname directory name to load from
Returns:
if loading was successful

Definition at line 575 of file StringFeatures.h.

template<class ST>
bool CStringFeatures< ST >::set_features ( T_STRING< ST > *  p_features,
INT  p_num_vectors,
INT  p_max_string_length 
)

set features

Parameters:
p_features new features
p_num_vectors number of vectors
p_max_string_length maximum string length
Returns:
if setting was successful

Definition at line 648 of file StringFeatures.h.

template<class ST>
virtual T_STRING<ST>* CStringFeatures< ST >::get_features ( INT num_str,
INT max_str_len 
) [virtual]

get_features

Parameters:
num_str number of strings (returned)
max_str_len maximal string length (returned)
Returns:
string features

Definition at line 692 of file StringFeatures.h.

template<class ST>
virtual bool CStringFeatures< ST >::save ( CHAR dest  )  [virtual]

save features to file

Parameters:
dest filename to save to
Returns:
if saving was successful

Reimplemented from CFeatures.

Definition at line 704 of file StringFeatures.h.

template<class ST>
virtual INT CStringFeatures< ST >::get_size (  )  [virtual]

get memory footprint of one feature

Returns:
memory footprint of one feature

Implements CFeatures.

Definition at line 713 of file StringFeatures.h.

template<class ST>
virtual bool CStringFeatures< ST >::apply_preproc ( bool  force_preprocessing = false  )  [virtual]

apply preprocessor

Parameters:
force_preprocessing if preprocssing shall be forced
Returns:
if applying was successful

Definition at line 720 of file StringFeatures.h.

template<class ST>
INT CStringFeatures< ST >::obtain_by_sliding_window ( INT  window_size,
INT  step_size,
INT  skip = 0 
)

slides a window of size window_size over the current single string step_size is the amount by which the window is shifted. creates (string_len-window_size)/step_size many feature obj if skip is nonzero, skip the first 'skip' characters of each string

Parameters:
window_size window size
step_size step size
skip skip
Returns:
something inty

Definition at line 748 of file StringFeatures.h.

template<class ST>
INT CStringFeatures< ST >::obtain_by_position_list ( INT  window_size,
CDynamicArray< INT > *  positions,
INT  skip = 0 
)

extracts windows of size window_size from first string using the positions in list

Parameters:
window_size window size
positions positions
skip skip
Returns:
something inty

Definition at line 791 of file StringFeatures.h.

template<class ST>
bool CStringFeatures< ST >::obtain_from_char ( CStringFeatures< CHAR > *  sf,
INT  start,
INT  p_order,
INT  gap,
bool  rev 
)

obtain string features from char features

wrapper for template method

Parameters:
sf string features
start start
p_order order
gap gap
rev reverse
Returns:
if obtaining was successful

Definition at line 857 of file StringFeatures.h.

template<class ST>
template<class CT>
bool CStringFeatures< ST >::obtain_from_char_features ( CStringFeatures< CT > *  sf,
INT  start,
INT  p_order,
INT  gap,
bool  rev 
)

template obtain from char features

Parameters:
sf string features
start start
p_order order
gap gap
rev reverse
Returns:
if obtaining was successful

Definition at line 872 of file StringFeatures.h.

template<class ST>
bool CStringFeatures< ST >::have_same_length ( INT  len  ) 

check if length of each vector in this feature object equals the given length.

Parameters:
len vector length to check against
Returns:
if length of each vector in this feature object equals the given length.

Definition at line 965 of file StringFeatures.h.

template<class ST>
void CStringFeatures< ST >::translate_from_single_order ( ST *  obs,
INT  sequence_length,
INT  start,
INT  p_order,
INT  max_val 
) [protected]

translate from single order

Parameters:
obs observation
sequence_length length of sequence
start start
p_order order
max_val maximum value

Definition at line 988 of file StringFeatures.h.

template<class ST>
void CStringFeatures< ST >::translate_from_single_order_reversed ( ST *  obs,
INT  sequence_length,
INT  start,
INT  p_order,
INT  max_val 
) [protected]

translate from single order reversed

Parameters:
obs observation
sequence_length length of sequence
start start
p_order order
max_val maximum value

Definition at line 1029 of file StringFeatures.h.

template<class ST>
void CStringFeatures< ST >::translate_from_single_order ( ST *  obs,
INT  sequence_length,
INT  start,
INT  p_order,
INT  max_val,
INT  gap 
) [protected]

translate from single order

Parameters:
obs observation
sequence_length length of sequence
start start
p_order order
max_val maximum value
gap gap

Definition at line 1071 of file StringFeatures.h.

template<class ST>
void CStringFeatures< ST >::translate_from_single_order_reversed ( ST *  obs,
INT  sequence_length,
INT  start,
INT  p_order,
INT  max_val,
INT  gap 
) [protected]

translate from single order reversed

Parameters:
obs observation
sequence_length length of sequence
start start
p_order order
max_val maximum value
gap gap

Definition at line 1138 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< CHAR >::get_feature_type (  )  [virtual]

get feature type the CHAR feature can deal with

Returns:
feature type CHAR

Implements CFeatures.

Definition at line 1232 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< BYTE >::get_feature_type (  )  [virtual]

get feature type the BYTE feature can deal with

Returns:
feature type BYTE

Implements CFeatures.

Definition at line 1241 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< SHORT >::get_feature_type (  )  [virtual]

get feature type the SHORT feature can deal with

Returns:
feature type SHORT

Implements CFeatures.

Definition at line 1250 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< WORD >::get_feature_type (  )  [virtual]

get feature type the WORD feature can deal with

Returns:
feature type WORD

Implements CFeatures.

Definition at line 1259 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< INT >::get_feature_type (  )  [virtual]

get feature type the INT feature can deal with

Returns:
feature type INT

Implements CFeatures.

Definition at line 1268 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< UINT >::get_feature_type (  )  [virtual]

get feature type the INT feature can deal with

Returns:
feature type INT

Implements CFeatures.

Definition at line 1277 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< LONG >::get_feature_type (  )  [virtual]

get feature type the LONG feature can deal with

Returns:
feature type LONG

Implements CFeatures.

Definition at line 1286 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< ULONG >::get_feature_type (  )  [virtual]

get feature type the ULONG feature can deal with

Returns:
feature type ULONG

Implements CFeatures.

Definition at line 1295 of file StringFeatures.h.

template<>
EFeatureType CStringFeatures< DREAL >::get_feature_type (  )  [virtual]

get feature type the DREAL feature can deal with

Returns:
feature type DREAL

Implements CFeatures.

Definition at line 1304 of file StringFeatures.h.

INT CFeatures::add_preproc ( CPreProc p  )  [virtual, inherited]

set preprocessor

add preprocessor

Parameters:
p preprocessor to set
Returns:
something inty

Definition at line 48 of file Features.cpp.

CPreProc * CFeatures::del_preproc ( INT  num  )  [virtual, inherited]

del current preprocessor

delete preprocessor from list caller has to clean up returned preproc

Parameters:
num index of preprocessor in list

Definition at line 107 of file Features.cpp.

CPreProc * CFeatures::get_preproc ( INT  num  )  [inherited]

get current preprocessor

get specified preprocessor

Parameters:
num index of preprocessor in list

Definition at line 78 of file Features.cpp.

void CFeatures::set_preprocessed ( INT  num  )  [inherited]

set applied flag for preprocessor

Parameters:
num index of preprocessor in list

Definition at line 95 of file Features.h.

bool CFeatures::is_preprocessed ( INT  num  )  [inherited]

get whether specified preprocessor was already applied

Parameters:
num index of preprocessor in list

Definition at line 101 of file Features.h.

INT CFeatures::get_num_preprocessed (  )  [inherited]

get whether specified preprocessor (or all if num=1) was/were already applied

get the number of applied preprocs

Returns:
number of applied preprocessors

Definition at line 87 of file Features.cpp.

INT CFeatures::get_num_preproc (  )  [inherited]

get number of preprocessors

Returns:
number of preprocessors

Definition at line 113 of file Features.h.

void CFeatures::clean_preprocs (  )  [inherited]

clears all preprocs

clears all preprocs

Definition at line 101 of file Features.cpp.

INT CFeatures::get_cache_size (  )  [inherited]

get cache size

Returns:
cache size

Definition at line 122 of file Features.h.

virtual bool CFeatures::reshape ( INT  num_features,
INT  num_vectors 
) [virtual, inherited]

in case there is a feature matrix allow for reshaping

NOT IMPLEMENTED!

Parameters:
num_features new number of features
num_vectors new number of vectors
Returns:
if reshaping was succesful

Reimplemented in CSimpleFeatures< ST >, CSimpleFeatures< double >, CSimpleFeatures< float >, CSimpleFeatures< int >, CSimpleFeatures< short int >, CSimpleFeatures< unsigned char >, CSimpleFeatures< char >, and CSimpleFeatures< unsigned short int >.

Definition at line 140 of file Features.h.

void CFeatures::list_feature_obj (  )  [inherited]

list feature object

Definition at line 152 of file Features.cpp.

bool CFeatures::check_feature_compatibility ( CFeatures f  )  [inherited]

check feature compatibility

Parameters:
f features to check for compatibility
Returns:
if features are compatible

Definition at line 223 of file Features.cpp.


Member Data Documentation

template<class ST>
CAlphabet* CStringFeatures< ST >::alphabet [protected]

alphabet

Definition at line 1195 of file StringFeatures.h.

template<class ST>
INT CStringFeatures< ST >::num_vectors [protected]

number of string vectors

Definition at line 1198 of file StringFeatures.h.

template<class ST>
T_STRING<ST>* CStringFeatures< ST >::features [protected]

this contains the array of features.

Definition at line 1201 of file StringFeatures.h.

template<class ST>
ST* CStringFeatures< ST >::single_string [protected]

true when single string / created by sliding window

Definition at line 1204 of file StringFeatures.h.

template<class ST>
INT CStringFeatures< ST >::length_of_single_string [protected]

length of prior single string

Definition at line 1207 of file StringFeatures.h.

template<class ST>
INT CStringFeatures< ST >::max_string_length [protected]

length of longest string

Definition at line 1210 of file StringFeatures.h.

template<class ST>
LONGREAL CStringFeatures< ST >::num_symbols [protected]

number of used symbols

Definition at line 1213 of file StringFeatures.h.

template<class ST>
LONGREAL CStringFeatures< ST >::original_num_symbols [protected]

original number of used symbols (before higher order mapping)

Definition at line 1216 of file StringFeatures.h.

template<class ST>
INT CStringFeatures< ST >::order [protected]

order used in higher order mapping

Definition at line 1219 of file StringFeatures.h.

template<class ST>
INT CStringFeatures< ST >::selected_vector [protected]

vector to be obtained via get_string

Definition at line 1222 of file StringFeatures.h.

template<class ST>
ST* CStringFeatures< ST >::symbol_mask_table [protected]

order used in higher order mapping

Definition at line 1225 of file StringFeatures.h.

CParallel CSGObject::parallel [static, inherited]

Definition at line 105 of file SGObject.h.

CIO CSGObject::io [static, inherited]

Definition at line 106 of file SGObject.h.

CVersion CSGObject::version [static, inherited]

Definition at line 107 of file SGObject.h.


The documentation for this class was generated from the following file:

SHOGUN Machine Learning Toolbox - Documentation