35 #ifndef OPENMS_FORMAT_LIBSVMENCODER_H 36 #define OPENMS_FORMAT_LIBSVMENCODER_H 72 void encodeCompositionVector(
const String & sequence, std::vector<std::pair<Int, double> > & encoded_vector,
const String & allowed_characters =
"ACDEFGHIKLMNPQRSTVWY");
83 void encodeCompositionVectors(
const std::vector<String> & sequences,
const String & allowed_characters, std::vector<std::vector<std::pair<Int, double> > > & composition_vectors);
85 svm_node * encodeLibSVMVector(
const std::vector<std::pair<Int, double> > & feature_vector);
88 void encodeLibSVMVectors(
const std::vector<std::vector<std::pair<Int, double> > > & feature_vectors, std::vector<svm_node *> & libsvm_vectors);
91 svm_problem * encodeLibSVMProblem(
const std::vector<svm_node *> & vectors,
92 std::vector<double> & labels);
95 svm_problem * encodeLibSVMProblemWithCompositionVectors(
const std::vector<String> & sequences,
96 std::vector<double> & labels,
97 const String & allowed_characters);
100 svm_problem * encodeLibSVMProblemWithCompositionAndLengthVectors(
const std::vector<String> & sequences,
101 std::vector<double> & labels,
102 const String & allowed_characters,
103 UInt maximum_sequence_length);
106 svm_problem * encodeLibSVMProblemWithCompositionLengthAndWeightVectors(
const std::vector<String> & sequences,
107 std::vector<double> & labels,
108 const String & allowed_characters);
111 bool storeLibSVMProblem(
const String & filename,
const svm_problem * problem)
const;
114 svm_problem * loadLibSVMProblem(
const String & filename);
117 void encodeOligoBorders(
String sequence,
119 const String & allowed_characters,
121 std::vector<std::pair<Int, double> > & libsvm_vector,
123 bool unpaired =
false,
124 bool length_encoding =
false);
127 svm_problem * encodeLibSVMProblemWithOligoBorderVectors(
const std::vector<String> & sequences,
128 std::vector<double> & labels,
130 const String & allowed_characters,
133 bool unpaired =
false,
134 bool length_encoding =
false);
137 void encodeProblemWithOligoBorderVectors(
const std::vector<AASequence> & sequences,
139 const String & allowed_characters,
141 std::vector<std::vector<std::pair<Int, double> > > & vectors);
149 void libSVMVectorToString(svm_node * vector,
String & output);
157 void libSVMVectorsToString(svm_problem * vector,
String & output);
167 const String & allowed_characters,
168 std::vector<std::pair<Int, double> > & values,
169 bool is_right_border =
false);
176 static void destroyProblem(svm_problem * problem);
180 static bool cmpOligos_(std::pair<Int, double> a,
181 std::pair<Int, double> b);
187 #endif // OPENMS_FORMAT_LIBSVMENCODER_H A more convenient string class.
Definition: String.h:57
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
Serves for encoding sequences into feature vectors.
Definition: LibSVMEncoder.h:55
Representation of a peptide/protein sequence.
Definition: AASequence.h:108
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47