From 9e94f4e140c0c9ebf01ad9de79eca81ce34624e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Montan=CC=83ana?= Date: Sat, 5 Aug 2023 23:23:31 +0200 Subject: [PATCH] Rename suffix of proposal classifier to Ld --- src/BayesNet/CMakeLists.txt | 2 +- src/BayesNet/{KDBNew.cc => KDBLd.cc} | 10 +++++----- src/BayesNet/KDBLd.h | 19 +++++++++++++++++++ src/BayesNet/KDBNew.h | 19 ------------------- src/BayesNet/{SPODENew.cc => SPODELd.cc} | 10 +++++----- src/BayesNet/SPODELd.h | 19 +++++++++++++++++++ src/BayesNet/SPODENew.h | 19 ------------------- src/BayesNet/{TANNew.cc => TANLd.cc} | 10 +++++----- src/BayesNet/TANLd.h | 19 +++++++++++++++++++ src/BayesNet/TANNew.h | 19 ------------------- src/Platform/Models.h | 6 +++--- src/Platform/modelRegister.h | 12 ++++++------ 12 files changed, 82 insertions(+), 82 deletions(-) rename src/BayesNet/{KDBNew.cc => KDBLd.cc} (75%) create mode 100644 src/BayesNet/KDBLd.h delete mode 100644 src/BayesNet/KDBNew.h rename src/BayesNet/{SPODENew.cc => SPODELd.cc} (74%) create mode 100644 src/BayesNet/SPODELd.h delete mode 100644 src/BayesNet/SPODENew.h rename src/BayesNet/{TANNew.cc => TANLd.cc} (76%) create mode 100644 src/BayesNet/TANLd.h delete mode 100644 src/BayesNet/TANNew.h diff --git a/src/BayesNet/CMakeLists.txt b/src/BayesNet/CMakeLists.txt index 5ed617e..d1416ad 100644 --- a/src/BayesNet/CMakeLists.txt +++ b/src/BayesNet/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${BayesNet_SOURCE_DIR}/lib/mdlp) include_directories(${BayesNet_SOURCE_DIR}/lib/Files) add_library(BayesNet bayesnetUtils.cc Network.cc Node.cc BayesMetrics.cc Classifier.cc - KDB.cc TAN.cc SPODE.cc Ensemble.cc AODE.cc TANNew.cc KDBNew.cc SPODENew.cc Mst.cc Proposal.cc) + KDB.cc TAN.cc SPODE.cc Ensemble.cc AODE.cc TANLd.cc KDBLd.cc SPODELd.cc Mst.cc Proposal.cc) target_link_libraries(BayesNet mdlp ArffFiles "${TORCH_LIBRARIES}") \ No newline at end of file diff --git a/src/BayesNet/KDBNew.cc b/src/BayesNet/KDBLd.cc similarity index 75% rename from src/BayesNet/KDBNew.cc rename to src/BayesNet/KDBLd.cc index f2f6e46..d2cbed4 100644 --- a/src/BayesNet/KDBNew.cc +++ b/src/BayesNet/KDBLd.cc @@ -1,9 +1,9 @@ -#include "KDBNew.h" +#include "KDBLd.h" namespace bayesnet { using namespace std; - KDBNew::KDBNew(int k) : KDB(k), Proposal(KDB::Xv, KDB::yv, features, className) {} - KDBNew& KDBNew::fit(torch::Tensor& X_, torch::Tensor& y_, vector& features_, string className_, map>& states_) + KDBLd::KDBLd(int k) : KDB(k), Proposal(KDB::Xv, KDB::yv, features, className) {} + KDBLd& KDBLd::fit(torch::Tensor& X_, torch::Tensor& y_, vector& features_, string className_, map>& states_) { // This first part should go in a Classifier method called fit_local_discretization o fit_float... features = features_; @@ -23,12 +23,12 @@ namespace bayesnet { model.fit(KDB::Xv, KDB::yv, features, className); return *this; } - Tensor KDBNew::predict(Tensor& X) + Tensor KDBLd::predict(Tensor& X) { auto Xt = prepareX(X); return KDB::predict(Xt); } - vector KDBNew::graph(const string& name) + vector KDBLd::graph(const string& name) { return KDB::graph(name); } diff --git a/src/BayesNet/KDBLd.h b/src/BayesNet/KDBLd.h new file mode 100644 index 0000000..b91999b --- /dev/null +++ b/src/BayesNet/KDBLd.h @@ -0,0 +1,19 @@ +#ifndef KDBLD_H +#define KDBLD_H +#include "KDB.h" +#include "Proposal.h" + +namespace bayesnet { + using namespace std; + class KDBLd : public KDB, public Proposal { + private: + public: + explicit KDBLd(int k); + virtual ~KDBLd() = default; + KDBLd& fit(torch::Tensor& X, torch::Tensor& y, vector& features, string className, map>& states) override; + vector graph(const string& name = "KDB") override; + Tensor predict(Tensor& X) override; + static inline string version() { return "0.0.1"; }; + }; +} +#endif // !KDBLD_H \ No newline at end of file diff --git a/src/BayesNet/KDBNew.h b/src/BayesNet/KDBNew.h deleted file mode 100644 index 6b2e0b1..0000000 --- a/src/BayesNet/KDBNew.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef KDBNEW_H -#define KDBNEW_H -#include "KDB.h" -#include "Proposal.h" - -namespace bayesnet { - using namespace std; - class KDBNew : public KDB, public Proposal { - private: - public: - explicit KDBNew(int k); - virtual ~KDBNew() = default; - KDBNew& fit(torch::Tensor& X, torch::Tensor& y, vector& features, string className, map>& states) override; - vector graph(const string& name = "KDB") override; - Tensor predict(Tensor& X) override; - static inline string version() { return "0.0.1"; }; - }; -} -#endif // !KDBNew_H \ No newline at end of file diff --git a/src/BayesNet/SPODENew.cc b/src/BayesNet/SPODELd.cc similarity index 74% rename from src/BayesNet/SPODENew.cc rename to src/BayesNet/SPODELd.cc index 597b077..f7df9b6 100644 --- a/src/BayesNet/SPODENew.cc +++ b/src/BayesNet/SPODELd.cc @@ -1,9 +1,9 @@ -#include "SPODENew.h" +#include "SPODELd.h" namespace bayesnet { using namespace std; - SPODENew::SPODENew(int root) : SPODE(root), Proposal(SPODE::Xv, SPODE::yv, features, className) {} - SPODENew& SPODENew::fit(torch::Tensor& X_, torch::Tensor& y_, vector& features_, string className_, map>& states_) + SPODELd::SPODELd(int root) : SPODE(root), Proposal(SPODE::Xv, SPODE::yv, features, className) {} + SPODELd& SPODELd::fit(torch::Tensor& X_, torch::Tensor& y_, vector& features_, string className_, map>& states_) { // This first part should go in a Classifier method called fit_local_discretization o fit_float... features = features_; @@ -23,12 +23,12 @@ namespace bayesnet { model.fit(SPODE::Xv, SPODE::yv, features, className); return *this; } - Tensor SPODENew::predict(Tensor& X) + Tensor SPODELd::predict(Tensor& X) { auto Xt = prepareX(X); return SPODE::predict(Xt); } - vector SPODENew::graph(const string& name) + vector SPODELd::graph(const string& name) { return SPODE::graph(name); } diff --git a/src/BayesNet/SPODELd.h b/src/BayesNet/SPODELd.h new file mode 100644 index 0000000..789af7f --- /dev/null +++ b/src/BayesNet/SPODELd.h @@ -0,0 +1,19 @@ +#ifndef SPODELD_H +#define SPODELD_H +#include "SPODE.h" +#include "Proposal.h" + +namespace bayesnet { + using namespace std; + class SPODELd : public SPODE, public Proposal { + private: + public: + explicit SPODELd(int root); + virtual ~SPODELd() = default; + SPODELd& fit(torch::Tensor& X, torch::Tensor& y, vector& features, string className, map>& states) override; + vector graph(const string& name = "SPODE") override; + Tensor predict(Tensor& X) override; + static inline string version() { return "0.0.1"; }; + }; +} +#endif // !SPODELD_H \ No newline at end of file diff --git a/src/BayesNet/SPODENew.h b/src/BayesNet/SPODENew.h deleted file mode 100644 index 6d6d008..0000000 --- a/src/BayesNet/SPODENew.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef SPODENEW_H -#define SPODENEW_H -#include "SPODE.h" -#include "Proposal.h" - -namespace bayesnet { - using namespace std; - class SPODENew : public SPODE, public Proposal { - private: - public: - explicit SPODENew(int root); - virtual ~SPODENew() = default; - SPODENew& fit(torch::Tensor& X, torch::Tensor& y, vector& features, string className, map>& states) override; - vector graph(const string& name = "SPODE") override; - Tensor predict(Tensor& X) override; - static inline string version() { return "0.0.1"; }; - }; -} -#endif // !SPODENew_H \ No newline at end of file diff --git a/src/BayesNet/TANNew.cc b/src/BayesNet/TANLd.cc similarity index 76% rename from src/BayesNet/TANNew.cc rename to src/BayesNet/TANLd.cc index 15a1eaf..f0fe110 100644 --- a/src/BayesNet/TANNew.cc +++ b/src/BayesNet/TANLd.cc @@ -1,9 +1,9 @@ -#include "TANNew.h" +#include "TANLd.h" namespace bayesnet { using namespace std; - TANNew::TANNew() : TAN(), Proposal(TAN::Xv, TAN::yv, features, className) {} - TANNew& TANNew::fit(torch::Tensor& X_, torch::Tensor& y_, vector& features_, string className_, map>& states_) + TANLd::TANLd() : TAN(), Proposal(TAN::Xv, TAN::yv, features, className) {} + TANLd& TANLd::fit(torch::Tensor& X_, torch::Tensor& y_, vector& features_, string className_, map>& states_) { // This first part should go in a Classifier method called fit_local_discretization o fit_float... features = features_; @@ -23,12 +23,12 @@ namespace bayesnet { model.fit(TAN::Xv, TAN::yv, features, className); return *this; } - Tensor TANNew::predict(Tensor& X) + Tensor TANLd::predict(Tensor& X) { auto Xt = prepareX(X); return TAN::predict(Xt); } - vector TANNew::graph(const string& name) + vector TANLd::graph(const string& name) { return TAN::graph(name); } diff --git a/src/BayesNet/TANLd.h b/src/BayesNet/TANLd.h new file mode 100644 index 0000000..d9172ac --- /dev/null +++ b/src/BayesNet/TANLd.h @@ -0,0 +1,19 @@ +#ifndef TANLD_H +#define TANLD_H +#include "TAN.h" +#include "Proposal.h" + +namespace bayesnet { + using namespace std; + class TANLd : public TAN, public Proposal { + private: + public: + TANLd(); + virtual ~TANLd() = default; + TANLd& fit(torch::Tensor& X, torch::Tensor& y, vector& features, string className, map>& states) override; + vector graph(const string& name = "TAN") override; + Tensor predict(Tensor& X) override; + static inline string version() { return "0.0.1"; }; + }; +} +#endif // !TANLD_H \ No newline at end of file diff --git a/src/BayesNet/TANNew.h b/src/BayesNet/TANNew.h deleted file mode 100644 index 40609e7..0000000 --- a/src/BayesNet/TANNew.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef TANNEW_H -#define TANNEW_H -#include "TAN.h" -#include "Proposal.h" - -namespace bayesnet { - using namespace std; - class TANNew : public TAN, public Proposal { - private: - public: - TANNew(); - virtual ~TANNew() = default; - TANNew& fit(torch::Tensor& X, torch::Tensor& y, vector& features, string className, map>& states) override; - vector graph(const string& name = "TAN") override; - Tensor predict(Tensor& X) override; - static inline string version() { return "0.0.1"; }; - }; -} -#endif // !TANNEW_H \ No newline at end of file diff --git a/src/Platform/Models.h b/src/Platform/Models.h index 0c1648d..82b5917 100644 --- a/src/Platform/Models.h +++ b/src/Platform/Models.h @@ -6,9 +6,9 @@ #include "TAN.h" #include "KDB.h" #include "SPODE.h" -#include "TANNew.h" -#include "KDBNew.h" -#include "SPODENew.h" +#include "TANLd.h" +#include "KDBLd.h" +#include "SPODELd.h" namespace platform { class Models { private: diff --git a/src/Platform/modelRegister.h b/src/Platform/modelRegister.h index ca0d517..d906216 100644 --- a/src/Platform/modelRegister.h +++ b/src/Platform/modelRegister.h @@ -2,16 +2,16 @@ #define MODEL_REGISTER_H static platform::Registrar registrarT("TAN", [](void) -> bayesnet::BaseClassifier* { return new bayesnet::TAN();}); -static platform::Registrar registrarTN("TANNew", - [](void) -> bayesnet::BaseClassifier* { return new bayesnet::TANNew();}); +static platform::Registrar registrarTN("TANLd", + [](void) -> bayesnet::BaseClassifier* { return new bayesnet::TANLd();}); static platform::Registrar registrarS("SPODE", [](void) -> bayesnet::BaseClassifier* { return new bayesnet::SPODE(2);}); -static platform::Registrar registrarSN("SPODENew", - [](void) -> bayesnet::BaseClassifier* { return new bayesnet::SPODENew(2);}); +static platform::Registrar registrarSN("SPODELd", + [](void) -> bayesnet::BaseClassifier* { return new bayesnet::SPODELd(2);}); static platform::Registrar registrarK("KDB", [](void) -> bayesnet::BaseClassifier* { return new bayesnet::KDB(2);}); -static platform::Registrar registrarKN("KDBNew", - [](void) -> bayesnet::BaseClassifier* { return new bayesnet::KDBNew(2);}); +static platform::Registrar registrarKN("KDBLd", + [](void) -> bayesnet::BaseClassifier* { return new bayesnet::KDBLd(2);}); static platform::Registrar registrarA("AODE", [](void) -> bayesnet::BaseClassifier* { return new bayesnet::AODE();}); #endif \ No newline at end of file