Refactor Hyperparameters management

This commit is contained in:
2023-11-19 22:36:27 +01:00
parent 89c4613591
commit 4f3a04058f
21 changed files with 1070 additions and 78 deletions

View File

@@ -1,11 +1,8 @@
#include "RandomForest.h"
namespace pywrap {
void RandomForest::setHyperparameters(const nlohmann::json& hyperparameters)
RandomForest::RandomForest() : PyClassifier("sklearn.ensemble", "RandomForestClassifier", true)
{
// Check if hyperparameters are valid
const std::vector<std::string> validKeys = { "n_estimators", "n_jobs", "random_state" };
checkHyperparameters(validKeys, hyperparameters);
this->hyperparameters = hyperparameters;
validHyperparameters = { "n_estimators", "n_jobs", "random_state" };
}
} /* namespace pywrap */