Create hyperparameter block_update

This commit is contained in:
2024-04-08 23:36:05 +02:00
parent f9553a38d7
commit da2a969686
4 changed files with 38 additions and 7 deletions

View File

@@ -16,7 +16,7 @@ namespace bayesnet {
{
validHyperparameters = {
"maxModels", "bisection", "order", "convergence", "threshold",
"select_features", "maxTolerance", "predict_voting"
"select_features", "maxTolerance", "predict_voting", "block_update"
};
}
@@ -94,6 +94,10 @@ namespace bayesnet {
}
hyperparameters.erase("select_features");
}
if (hyperparameters.contains("block_update")) {
block_update = hyperparameters["block_update"];
hyperparameters.erase("block_update");
}
Classifier::setHyperparameters(hyperparameters);
}
std::tuple<torch::Tensor&, double, bool> update_weights(torch::Tensor& ytrain, torch::Tensor& ypred, torch::Tensor& weights)

View File

@@ -28,14 +28,15 @@ namespace bayesnet {
std::vector<int> initializeModels();
torch::Tensor X_train, y_train, X_test, y_test;
// Hyperparameters
bool bisection = false; // if true, use bisection stratety to add k models at once to the ensemble
int maxTolerance = 1;
bool bisection = true; // if true, use bisection stratety to add k models at once to the ensemble
int maxTolerance = 3;
std::string order_algorithm; // order to process the KBest features asc, desc, rand
bool convergence = false; //if true, stop when the model does not improve
bool convergence = true; //if true, stop when the model does not improve
bool selectFeatures = false; // if true, use feature selection
std::string select_features_algorithm = Orders.DESC; // Selected feature selection algorithm
FeatureSelect* featureSelector = nullptr;
double threshold = -1;
bool block_update = true;
};
}
#endif