Skip to content

Commit

Permalink
Add tests of PFDTane algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
iliya-b committed Sep 16, 2024
1 parent c5a46b9 commit 646bc0f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/tests/test_fd_algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "algorithms/fd/fdep/fdep.h"
#include "algorithms/fd/fun/fun.h"
#include "algorithms/fd/hyfd/hyfd.h"
#include "algorithms/fd/pfdtane/pfdtane.h"
#include "algorithms/fd/pyro/pyro.h"
#include "algorithms/fd/tane/pfdtane.h"
#include "algorithms/fd/tane/tane.h"
#include "model/table/relational_schema.h"
#include "test_fd_util.h"
Expand Down
1 change: 1 addition & 0 deletions src/tests/test_fd_mine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "algorithms/algo_factory.h"
#include "algorithms/fd/fd_mine/fd_mine.h"
#include "algorithms/fd/pyro/pyro.h"
#include "algorithms/fd/tane/pfdtane.h"
#include "algorithms/fd/tane/tane.h"
#include "config/error/type.h"
#include "config/names.h"
Expand Down
12 changes: 8 additions & 4 deletions src/tests/test_pfdtane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#include "algo_factory.h"
#include "all_csv_configs.h"
#include "config/names.h"
#include "fd/pfdtane/enums.h"
#include "fd/pfdtane/pfdtane.h"
#include "fd/tane/pfdtane.h"
#include "model/table/column_layout_relation_data.h"
#include "parser/csv_parser/csv_parser.h"

Expand Down Expand Up @@ -51,11 +50,12 @@ TEST_P(TestPFDTaneValidation, ErrorCalculationTest) {
double eps = 0.00001;
auto table = std::make_shared<CSVParser>(p.csv_config);
auto relation = ColumnLayoutRelationData::CreateFrom(*table, true);

for (auto const& [lhs_id, rhs_id, expected_error] : p.fds) {
auto const& lhs = relation->GetColumnData(lhs_id).GetPositionListIndex();
auto const& rhs = relation->GetColumnData(rhs_id).GetPositionListIndex();
config::ErrorType error =
algos::PFDTane::CalculateFdError(lhs, lhs->Intersect(rhs).get(), p.error_measure);
algos::PFDTane::CalculatePFDError(lhs, lhs->Intersect(rhs).get(), p.error_measure);
EXPECT_NEAR(error, expected_error, eps);
}
}
Expand All @@ -64,7 +64,11 @@ TEST_P(TestPFDTaneValidation, ErrorCalculationTest) {
INSTANTIATE_TEST_SUITE_P(
PFDTaneTestMiningSuite, TestPFDTaneMining,
::testing::Values(
PFDTaneMiningParams(44381, 0.3, +algos::ErrorMeasure::per_value, kTestFD)
PFDTaneMiningParams(44381, 0.3, +algos::ErrorMeasure::per_value, kTestFD),
PFDTaneMiningParams(39491, 0.1, +algos::ErrorMeasure::per_value, kIris),
PFDTaneMiningParams(10695, 0.01, +algos::ErrorMeasure::per_value, kIris),
PFDTaneMiningParams(7893, 0.1, +algos::ErrorMeasure::per_value, kNeighbors10k),
PFDTaneMiningParams(41837, 0.01, +algos::ErrorMeasure::per_value, kNeighbors10k)
));

INSTANTIATE_TEST_SUITE_P(
Expand Down

0 comments on commit 646bc0f

Please sign in to comment.