Implement 3 types of smoothing

This commit is contained in:
2024-06-10 15:49:01 +02:00
parent 684443a788
commit 27a3e5a5e0
11 changed files with 37 additions and 9 deletions

View File

@@ -8,10 +8,13 @@
#include <vector>
#include <torch/torch.h>
#include <nlohmann/json.hpp>
#include "bayesnet/network/Network.h"
namespace bayesnet {
enum status_t { NORMAL, WARNING, ERROR };
class BaseClassifier {
public:
void setSmoothing(Smoothing_t smoothing) { this->smoothing = smoothing; } // To call before fit
// X is nxm std::vector, y is nx1 std::vector
virtual BaseClassifier& fit(std::vector<std::vector<int>>& X, std::vector<int>& y, const std::vector<std::string>& features, const std::string& className, std::map<std::string, std::vector<int>>& states) = 0;
// X is nxm tensor, y is nx1 tensor
@@ -41,5 +44,6 @@ namespace bayesnet {
protected:
virtual void trainModel(const torch::Tensor& weights) = 0;
std::vector<std::string> validHyperparameters;
Smoothing_t smoothing = Smoothing_t::NONE;
};
}