MeLOn
svmParser.h
Go to the documentation of this file.
1 /**********************************************************************************
2 * Copyright (c) 2020 Process Systems Engineering (AVT.SVT), RWTH Aachen University
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License 2.0 which is available at
6 * http://www.eclipse.org/legal/epl-2.0.
7 *
8 * SPDX-License-Identifier: EPL-2.0
9 *
10 * @file svmParser.h
11 *
12 * @brief File containing declaration of the support vector machine parser classes.
13 *
14 **********************************************************************************/
15 
16 #pragma once
17 
18 #include <string> // std::string
19 #include <vector> // std::vector
20 #include <memory> // std::unique_ptr, std::shared_ptr
21 
22 #include "modelParser.h"
23 #include "svmData.h"
24 #include "exceptions.h"
25 #include "scaler.h"
26 
27 #include <nlohmann/json.hpp>
29 
30 namespace melon {
31 
36  class SvmParser : public ModelParser {
37  public:
38 
48  std::shared_ptr<ModelData> parse_model(const std::string modelPath, const std::string modelName) override;
49 
57  static KERNEL_FUNCTION string_to_kernel_function(const std::string& kernelName);
58 
66  static std::shared_ptr<ScalerData> parse_scaler(json scalerJson);
67  };
68 
69 
75  public:
76 
84  std::unique_ptr<ModelParser> create_model_parser(const MODEL_FILE_TYPE fileType) override;
85  };
86 }
melon::MODEL_FILE_TYPE
MODEL_FILE_TYPE
Enum for representing the parsable filetypes.
Definition: modelParser.h:43
exceptions.h
melon::KERNEL_FUNCTION
KERNEL_FUNCTION
enum for representing different kernel functions
Definition: svmData.h:44
melon::SvmParser::string_to_kernel_function
static KERNEL_FUNCTION string_to_kernel_function(const std::string &kernelName)
Turns string with kernel name into enum representation.
Definition: svmParser.cpp:102
scaler.h
json
nlohmann::json json
Definition: gpParser.cpp:24
json
nlohmann::json json
Definition: svmParser.h:28
melon::SvmParser
This class implements a support vector machine file parser.
Definition: svmParser.h:36
melon::SvmParserFactory
This class is a factory class for creating child instances of SvmParser.
Definition: svmParser.h:74
melon::SvmParser::parse_model
std::shared_ptr< ModelData > parse_model(const std::string modelPath, const std::string modelName) override
Function for parsing the support vector machine data from a file.
Definition: svmParser.cpp:114
svmData.h
melon::SvmParserFactory::create_model_parser
std::unique_ptr< ModelParser > create_model_parser(const MODEL_FILE_TYPE fileType) override
Factory function for creating a instance of a support vector machine parser corresponding to the spec...
Definition: svmParser.cpp:58
melon::ModelParserFactory
This class is a abstract parent class for model parser factories implemented in the MeLOn library.
Definition: modelParser.h:112
melon
Definition: kernel.h:21
modelParser.h
melon::ModelParser
This class is a abstract parent class for model parser implemented in the MeLOn library.
Definition: modelParser.h:53
melon::SvmParser::parse_scaler
static std::shared_ptr< ScalerData > parse_scaler(json scalerJson)
Function for parsing scaler data from json object.
Definition: svmParser.cpp:72