![]() |
MeLOn
|
Class defining support vector machine to be used in the MAiNGO solver. More...
#include <svm.h>
Public Member Functions | |
SupportVectorMachine () | |
Default Constructor. More... | |
SupportVectorMachine (std::string modelName) | |
Constructor. More... | |
SupportVectorMachine (std::string modelPath, std::string modelName) | |
Constructor. More... | |
SupportVectorMachine (std::shared_ptr< const SvmData > modelData) | |
Constructor. More... | |
void | get_fullspace_variables (size_t &variableNumber, std::vector< std::string > &variableNames, std::vector< std::pair< double, double >> &variableBounds) |
Creates variables for the full space formulation in MAiNGO. More... | |
T | calculate_prediction_full_space (std::vector< T > input, std::vector< T > internalVariables, std::vector< T > &constraints) |
Calculates prediction based on inputs and set constraints for fullspace formulation. More... | |
T | calculate_prediction_reduced_space (std::vector< T > input) |
Calculates prediction based on inputs in reduced space. More... | |
size_t | get_number_of_full_space_variables () |
Calculates the number of full space variables. More... | |
![]() | |
virtual | ~MelonModel ()=default |
Default destructor. More... | |
void | load_model (std::string modelName, MODEL_FILE_TYPE fileType) |
Loads new model from file. More... | |
void | load_model (std::string modelPath, std::string modelName, MODEL_FILE_TYPE fileType) |
Loads new model from file. More... | |
void | load_model (std::shared_ptr< const ModelData > modelData) |
Loads new model from file. More... | |
Protected Member Functions | |
void | _set_data_object (std::shared_ptr< const ModelData > modelData) override |
Sets data object containing model parameters. More... | |
T | _calculate_prediction (std::vector< T > input, std::vector< T > internalVariables, const bool fullSpace, std::vector< T > &constraints) |
Calculates prediction. More... | |
void | _update_kernel () |
Loads kernel according to loaded internal parameters. More... | |
virtual T | _decision_function (std::vector< T > kernelValues)=0 |
Decision function used by the different types of svms. More... | |
![]() | |
MelonModel (std::shared_ptr< ModelParserFactory > parserFactory) | |
Constructor. More... | |
template<typename RandomAccessIterator > | |
void | _set_constraints (std::vector< T > &constraints, std::vector< T > &constraintEvaluation, RandomAccessIterator &constraintValue) |
Sets constraints required for fullspace opimization. More... | |
template<typename RandomAccessIterator > | |
void | _set_constraints (std::vector< T > &constraints, T &constraintEvaluation, RandomAccessIterator &constraintValue) |
Sets constraints required for fullspace opimization. More... | |
Protected Attributes | |
std::shared_ptr< const SvmData > | _data |
std::unique_ptr< kernel::StationaryKernel< double, T > > | _kernel |
std::unique_ptr< Scaler< T > > | _inputScaler |
std::unique_ptr< Scaler< T > > | _outputScaler |
![]() | |
bool | _modelLoaded { false } |
std::shared_ptr< ModelParserFactory > | _parserFactory |
Class defining support vector machine to be used in the MAiNGO solver.
|
inline |
Default Constructor.
|
inline |
Constructor.
[in] | modelName | is the name of the svm |
|
inline |
Constructor.
[in] | modelPath | is the path to the directory in which the svm file is located |
[in] | modelName | is the name of the svm |
|
inline |
Constructor.
[in] | modelData | is a SvmData object containing the data which defines the svm |
|
protected |
Calculates prediction.
[in] | input | is a vector of inputs for which the prediction will be evaluated |
[in] | internalVariables | holds variables that are used in full space formulation and not in reduced space |
[in] | fullSpace | decides if evaluation shall be done in full or reduced space |
[out] | constraints | will be filled in case of fullSpace formulation |
|
protectedpure virtual |
Decision function used by the different types of svms.
[in] | kernelValues | is a vector containing the kernel evaluations for the the support vectors with the input. |
Implemented in melon::SupportVectorMachineOneClass< T >, and melon::SupportVectorRegression< T >.
|
overrideprotectedvirtual |
Sets data object containing model parameters.
[in] | modelData | is a ModelData object containing the data which defines the model |
Implements melon::MelonModel< T >.
|
protected |
Loads kernel according to loaded internal parameters.
T melon::SupportVectorMachine< T >::calculate_prediction_full_space | ( | std::vector< T > | input, |
std::vector< T > | internalVariables, | ||
std::vector< T > & | constraints | ||
) |
Calculates prediction based on inputs and set constraints for fullspace formulation.
[in] | input | is a vector of inputs for which the constraint will be evaluated |
[in] | internalVariables | holds variables that are used in full space formulation and not in reduced space |
[out] | constraints | will be filled in case of fullSpace formulation (such that internal Variables are equal to internal evaluation) |
T melon::SupportVectorMachine< T >::calculate_prediction_reduced_space | ( | std::vector< T > | input | ) |
Calculates prediction based on inputs in reduced space.
[in] | input | is a vector of inputs for which the constraint will be evaluated |
void melon::SupportVectorMachine< T >::get_fullspace_variables | ( | size_t & | variableNumber, |
std::vector< std::string > & | variableNames, | ||
std::vector< std::pair< double, double >> & | variableBounds | ||
) |
Creates variables for the full space formulation in MAiNGO.
[out] | variableNumber | is the number of variables created |
[out] | variableNames | is a vetor of the corresponding variable names |
[out] | variableBounds | is a pair vector of bounds for each variable |
size_t melon::SupportVectorMachine< T >::get_number_of_full_space_variables |
Calculates the number of full space variables.
|
protected |
object containing the data and parameters of the svm
|
protected |
Object for scaling input data
|
protected |
kernel object
|
protected |
Object for scaling output data