#include <OpenMS/FORMAT/LibSVMEncoder.h>
The class can be used to construct composition vectors for sequences. Additionally the vectors can be encoded into the libsvm format.
Public Member Functions | |
LibSVMEncoder () | |
Constructor. | |
~LibSVMEncoder () | |
Destructor. | |
void | encodeCompositionVector (const String &sequence, std::vector< std::pair< Int, DoubleReal > > &encoded_vector, const String &allowed_characters="ACDEFGHIKLMNPQRSTVWY") |
stores a composition vector of 'sequence' in 'encoded_vector' | |
void | encodeCompositionVectors (const std::vector< String > &sequences, const String &allowed_characters, std::vector< std::vector< std::pair< Int, DoubleReal > > > &composition_vectors) |
stores composition vectors of the sequences given by 'sequence' in 'composition_vectors' | |
svm_node * | encodeLibSVMVector (const std::vector< std::pair< Int, DoubleReal > > &feature_vector) |
encodes the feature vector in LibSVM compliant format | |
void | encodeLibSVMVectors (const std::vector< std::vector< std::pair< Int, DoubleReal > > > &feature_vectors, std::vector< svm_node * > &libsvm_vectors) |
encodes the feature vectors in LibSVM compliant format | |
svm_problem * | encodeLibSVMProblem (const std::vector< svm_node * > &vectors, std::vector< DoubleReal > &labels) |
encodes the LibSVM compliant vectors into a LibSVM compliant structure | |
svm_problem * | encodeLibSVMProblemWithCompositionVectors (const std::vector< String > &sequences, std::vector< DoubleReal > &labels, const String &allowed_characters) |
creates composition vectors for 'sequences' and stores them in LibSVM compliant format | |
svm_problem * | encodeLibSVMProblemWithCompositionAndLengthVectors (const std::vector< String > &sequences, std::vector< DoubleReal > &labels, const String &allowed_characters, UInt maximum_sequence_length) |
creates composition vectors with additional length information for 'sequences' and stores them in LibSVM compliant format | |
bool | storeLibSVMProblem (const String &filename, const svm_problem *problem) const |
stores the LibSVM-encoded data in a text file that can be used by the LibSVM applications (svm-scale, svm-train,...) | |
svm_problem * | loadLibSVMProblem (const String &filename) |
loads the LibSVM-encoded data stored in 'filename' | |
void | encodeOligoBorders (String sequence, UInt k_mer_length, const String &allowed_characters, UInt border_length, std::vector< std::pair< Int, DoubleReal > > &libsvm_vector, bool strict=false, bool unpaired=false, bool length_encoding=false) |
encodes the borders of the sequence as k_mer oligos and stores them in 'libsvm_vector' | |
svm_problem * | encodeLibSVMProblemWithOligoBorderVectors (const std::vector< String > &sequences, std::vector< DoubleReal > &labels, UInt k_mer_length, const String &allowed_characters, UInt border_length, bool strict=false, bool unpaired=false, bool length_encoding=false) |
creates oligo border vectors vectors for 'sequences' and stores them in LibSVM compliant format | |
void | libSVMVectorToString (svm_node *vector, String &output) |
stores a string representation of the encoded sequence 'vector' in 'output' | |
void | libSVMVectorsToString (svm_problem *vector, String &output) |
stores a string representation of the encoded sequences in 'vectors' in 'output' |
LibSVMEncoder | ( | ) |
Constructor.
~LibSVMEncoder | ( | ) |
Destructor.
void encodeCompositionVector | ( | const String & | sequence, | |
std::vector< std::pair< Int, DoubleReal > > & | encoded_vector, | |||
const String & | allowed_characters = "ACDEFGHIKLMNPQRSTVWY" | |||
) |
stores a composition vector of 'sequence' in 'encoded_vector'
The allowed characters given by 'allowed_characters' are counted in the sequence 'sequence' and the relative frequency of the letters are sored in the composition vector. The first entry of the vector (<UInt, DoubleReal>) corresponds to the first letter of 'allowed_characters' that has a non zero frequency in 'sequence' and its corresponding relative frequency...
void encodeCompositionVectors | ( | const std::vector< String > & | sequences, | |
const String & | allowed_characters, | |||
std::vector< std::vector< std::pair< Int, DoubleReal > > > & | composition_vectors | |||
) |
stores composition vectors of the sequences given by 'sequence' in 'composition_vectors'
The allowed characters given by 'allowed_characters' are counted in the sequences 'sequences' and the relative frequency of the letters are sored in the composition vectors. The first entry of the first vector (<UInt, DoubleReal>) corresponds to the first letter of 'allowed_characters' that has a non zero frequency in the first 'sequence' and its corresponding relative frequency...
svm_node* encodeLibSVMVector | ( | const std::vector< std::pair< Int, DoubleReal > > & | feature_vector | ) |
encodes the feature vector in LibSVM compliant format
void encodeLibSVMVectors | ( | const std::vector< std::vector< std::pair< Int, DoubleReal > > > & | feature_vectors, | |
std::vector< svm_node * > & | libsvm_vectors | |||
) |
encodes the feature vectors in LibSVM compliant format
svm_problem* encodeLibSVMProblem | ( | const std::vector< svm_node * > & | vectors, | |
std::vector< DoubleReal > & | labels | |||
) |
encodes the LibSVM compliant vectors into a LibSVM compliant structure
svm_problem* encodeLibSVMProblemWithCompositionVectors | ( | const std::vector< String > & | sequences, | |
std::vector< DoubleReal > & | labels, | |||
const String & | allowed_characters | |||
) |
creates composition vectors for 'sequences' and stores them in LibSVM compliant format
svm_problem* encodeLibSVMProblemWithCompositionAndLengthVectors | ( | const std::vector< String > & | sequences, | |
std::vector< DoubleReal > & | labels, | |||
const String & | allowed_characters, | |||
UInt | maximum_sequence_length | |||
) |
creates composition vectors with additional length information for 'sequences' and stores them in LibSVM compliant format
bool storeLibSVMProblem | ( | const String & | filename, | |
const svm_problem * | problem | |||
) | const |
stores the LibSVM-encoded data in a text file that can be used by the LibSVM applications (svm-scale, svm-train,...)
svm_problem* loadLibSVMProblem | ( | const String & | filename | ) |
loads the LibSVM-encoded data stored in 'filename'
void encodeOligoBorders | ( | String | sequence, | |
UInt | k_mer_length, | |||
const String & | allowed_characters, | |||
UInt | border_length, | |||
std::vector< std::pair< Int, DoubleReal > > & | libsvm_vector, | |||
bool | strict = false , |
|||
bool | unpaired = false , |
|||
bool | length_encoding = false | |||
) |
encodes the borders of the sequence as k_mer oligos and stores them in 'libsvm_vector'
svm_problem* encodeLibSVMProblemWithOligoBorderVectors | ( | const std::vector< String > & | sequences, | |
std::vector< DoubleReal > & | labels, | |||
UInt | k_mer_length, | |||
const String & | allowed_characters, | |||
UInt | border_length, | |||
bool | strict = false , |
|||
bool | unpaired = false , |
|||
bool | length_encoding = false | |||
) |
creates oligo border vectors vectors for 'sequences' and stores them in LibSVM compliant format
void libSVMVectorToString | ( | svm_node * | vector, | |
String & | output | |||
) |
stores a string representation of the encoded sequence 'vector' in 'output'
This function can be used if one wants to print one feature vector that is used in the libsvm.
void libSVMVectorsToString | ( | svm_problem * | vector, | |
String & | output | |||
) |
stores a string representation of the encoded sequences in 'vectors' in 'output'
This function can be used if one wants to print the feature vectors that are used in the libsvm.
Generated Tue Apr 1 15:36:44 2008 -- using doxygen 1.5.4 | OpenMS / TOPP 1.1 |