Add smooth strategy to hyperparameter in b_main
Add smooth strategy to reports
This commit is contained in:
@@ -194,6 +194,7 @@ namespace platform {
|
||||
//
|
||||
// Train model
|
||||
//
|
||||
clf->setSmoothing(smooth_type);
|
||||
clf->fit(X_train, y_train, features, className, states);
|
||||
if (!quiet)
|
||||
showProgress(nfold + 1, getColor(clf->getStatus()), "b");
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "bayesnet/BaseClassifier.h"
|
||||
#include "HyperParameters.h"
|
||||
#include "results/Result.h"
|
||||
#include "bayesnet/network/Network.h"
|
||||
|
||||
namespace platform {
|
||||
using json = nlohmann::ordered_json;
|
||||
@@ -24,6 +25,17 @@ namespace platform {
|
||||
{
|
||||
this->discretization_algo = discretization_algo; this->result.setDiscretizationAlgorithm(discretization_algo); return *this;
|
||||
}
|
||||
Experiment& setSmoothSrategy(const std::string& smooth_strategy)
|
||||
{
|
||||
this->smooth_strategy = smooth_strategy; this->result.setSmoothStrategy(smooth_strategy);
|
||||
if (smooth_strategy == "OLD_LAPLACE")
|
||||
smooth_type = bayesnet::Smoothing_t::OLD_LAPLACE;
|
||||
else if (smooth_strategy == "LAPLACE")
|
||||
smooth_type = bayesnet::Smoothing_t::LAPLACE;
|
||||
else if (smooth_strategy == "CESTNIK")
|
||||
smooth_type = bayesnet::Smoothing_t::CESTNIK;
|
||||
return *this;
|
||||
}
|
||||
Experiment& setLanguageVersion(const std::string& language_version) { this->result.setLanguageVersion(language_version); return *this; }
|
||||
Experiment& setDiscretized(bool discretized) { this->discretized = discretized; result.setDiscretized(discretized); return *this; }
|
||||
Experiment& setStratified(bool stratified) { this->stratified = stratified; result.setStratified(stratified); return *this; }
|
||||
@@ -43,6 +55,8 @@ namespace platform {
|
||||
std::vector<PartialResult> results;
|
||||
std::vector<int> randomSeeds;
|
||||
std::string discretization_algo;
|
||||
std::string smooth_strategy;
|
||||
bayesnet::Smoothing_t smooth_type = bayesnet::Smoothing_t::OLD_LAPLACE;
|
||||
HyperParameters hyperparameters;
|
||||
int nfolds{ 0 };
|
||||
int max_name{ 7 }; // max length of dataset name for formatting (default 7)
|
||||
|
Reference in New Issue
Block a user