Rename suffix of proposal classifier to Ld
This commit is contained in:
parent
1d0fd629c9
commit
9e94f4e140
@ -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}")
|
@ -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<string>& features_, string className_, map<string, vector<int>>& states_)
|
||||
KDBLd::KDBLd(int k) : KDB(k), Proposal(KDB::Xv, KDB::yv, features, className) {}
|
||||
KDBLd& KDBLd::fit(torch::Tensor& X_, torch::Tensor& y_, vector<string>& features_, string className_, map<string, vector<int>>& 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<string> KDBNew::graph(const string& name)
|
||||
vector<string> KDBLd::graph(const string& name)
|
||||
{
|
||||
return KDB::graph(name);
|
||||
}
|
19
src/BayesNet/KDBLd.h
Normal file
19
src/BayesNet/KDBLd.h
Normal file
@ -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<string>& features, string className, map<string, vector<int>>& states) override;
|
||||
vector<string> graph(const string& name = "KDB") override;
|
||||
Tensor predict(Tensor& X) override;
|
||||
static inline string version() { return "0.0.1"; };
|
||||
};
|
||||
}
|
||||
#endif // !KDBLD_H
|
@ -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<string>& features, string className, map<string, vector<int>>& states) override;
|
||||
vector<string> graph(const string& name = "KDB") override;
|
||||
Tensor predict(Tensor& X) override;
|
||||
static inline string version() { return "0.0.1"; };
|
||||
};
|
||||
}
|
||||
#endif // !KDBNew_H
|
@ -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<string>& features_, string className_, map<string, vector<int>>& states_)
|
||||
SPODELd::SPODELd(int root) : SPODE(root), Proposal(SPODE::Xv, SPODE::yv, features, className) {}
|
||||
SPODELd& SPODELd::fit(torch::Tensor& X_, torch::Tensor& y_, vector<string>& features_, string className_, map<string, vector<int>>& 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<string> SPODENew::graph(const string& name)
|
||||
vector<string> SPODELd::graph(const string& name)
|
||||
{
|
||||
return SPODE::graph(name);
|
||||
}
|
19
src/BayesNet/SPODELd.h
Normal file
19
src/BayesNet/SPODELd.h
Normal file
@ -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<string>& features, string className, map<string, vector<int>>& states) override;
|
||||
vector<string> graph(const string& name = "SPODE") override;
|
||||
Tensor predict(Tensor& X) override;
|
||||
static inline string version() { return "0.0.1"; };
|
||||
};
|
||||
}
|
||||
#endif // !SPODELD_H
|
@ -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<string>& features, string className, map<string, vector<int>>& states) override;
|
||||
vector<string> graph(const string& name = "SPODE") override;
|
||||
Tensor predict(Tensor& X) override;
|
||||
static inline string version() { return "0.0.1"; };
|
||||
};
|
||||
}
|
||||
#endif // !SPODENew_H
|
@ -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<string>& features_, string className_, map<string, vector<int>>& states_)
|
||||
TANLd::TANLd() : TAN(), Proposal(TAN::Xv, TAN::yv, features, className) {}
|
||||
TANLd& TANLd::fit(torch::Tensor& X_, torch::Tensor& y_, vector<string>& features_, string className_, map<string, vector<int>>& 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<string> TANNew::graph(const string& name)
|
||||
vector<string> TANLd::graph(const string& name)
|
||||
{
|
||||
return TAN::graph(name);
|
||||
}
|
19
src/BayesNet/TANLd.h
Normal file
19
src/BayesNet/TANLd.h
Normal file
@ -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<string>& features, string className, map<string, vector<int>>& states) override;
|
||||
vector<string> graph(const string& name = "TAN") override;
|
||||
Tensor predict(Tensor& X) override;
|
||||
static inline string version() { return "0.0.1"; };
|
||||
};
|
||||
}
|
||||
#endif // !TANLD_H
|
@ -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<string>& features, string className, map<string, vector<int>>& states) override;
|
||||
vector<string> graph(const string& name = "TAN") override;
|
||||
Tensor predict(Tensor& X) override;
|
||||
static inline string version() { return "0.0.1"; };
|
||||
};
|
||||
}
|
||||
#endif // !TANNEW_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:
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user