Implement hyperparameters

This commit is contained in:
2023-11-08 10:35:38 +01:00
parent 1f46fc6c24
commit 331381930a
17 changed files with 913 additions and 325 deletions

View File

@@ -2,15 +2,17 @@
#define PYCLASSIFER_H
#include "boost/python/detail/wrap_python.hpp"
#include <boost/python/numpy.hpp>
#include <nlohmann/json.hpp>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <torch/torch.h>
#include "PyWrap.h"
#include "Classifier.h"
namespace pywrap {
class PyClassifier {
class PyClassifier : public Classifier {
public:
PyClassifier(const std::string& module, const std::string& className);
virtual ~PyClassifier();
@@ -19,11 +21,15 @@ namespace pywrap {
double score(torch::Tensor& X, torch::Tensor& y);
std::string version();
std::string callMethodString(const std::string& method);
void setHyperparameters(const nlohmann::json& hyperparameters) override;
protected:
void checkHyperparameters(const std::vector<std::string>& validKeys, const nlohmann::json& hyperparameters);
nlohmann::json hyperparameters;
private:
PyWrap* pyWrap;
std::string module;
std::string className;
bool fitted;
};
} /* namespace pywrap */
#endif /* PYCLASSIFER_H */