Implement SPnDE and A2DE

This commit is contained in:
2024-05-05 01:35:17 +02:00
parent 8115f25c06
commit f806015b29
7 changed files with 153 additions and 0 deletions

View File

@@ -21,4 +21,5 @@ if(ENABLE_TESTING)
add_test(NAME Ensemble COMMAND TestBayesNet "[Ensemble]")
add_test(NAME Models COMMAND TestBayesNet "[Models]")
add_test(NAME BoostAODE COMMAND TestBayesNet "[BoostAODE]")
add_test(NAME A2DE COMMAND TestBayesNet "[A2DE]")
endif(ENABLE_TESTING)

26
tests/TestA2DE.cc Normal file
View File

@@ -0,0 +1,26 @@
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
#include <type_traits>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "bayesnet/ensembles/A2DE.h"
#include "TestUtils.h"
TEST_CASE("Fit and Score", "[A2DE]")
{
auto raw = RawDatasets("glass", true);
auto clf = bayesnet::A2DE();
clf.fit(raw.Xv, raw.yv, raw.features, raw.className, raw.states);
std::cout << "Score A2DE: " << clf.score(raw.Xv, raw.yv) << std::endl;
// REQUIRE(clf.getNumberOfNodes() == 90);
// REQUIRE(clf.getNumberOfEdges() == 153);
// REQUIRE(clf.getNotes().size() == 2);
// REQUIRE(clf.getNotes()[0] == "Used features in initialization: 6 of 9 with CFS");
// REQUIRE(clf.getNotes()[1] == "Number of models: 9");
}