Skip to content

Commit

Permalink
Implement python bindings for UCCVerifier
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Volgushev <[email protected]>
Co-authored-by: Artem Demchenko <[email protected]>
  • Loading branch information
aartdem and VanyaVolgushev committed Nov 24, 2023
1 parent 3d03c50 commit 9eff38e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/python_bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "py_fd_verifier.h"
#include "py_metric_verifier.h"
#include "py_ucc_algorithm.h"
#include "py_ucc_verifier.h"

INITIALIZE_EASYLOGGINGPP

Expand Down Expand Up @@ -160,6 +161,12 @@ PYBIND11_MODULE(desbordante, module) {
.def("get_num_error_rows", &PyFDVerifier::GetNumErrorRows)
.def("get_highlights", &PyFDVerifier::GetHighlights);

DEFINE_ALGORITHM(UCCVerifier, Algorithm)
.def("ucc_holds", &PyUCCVerifier::UCCHolds)
.def("get_num_clusters_not_ucc", &PyUCCVerifier::GetNumClustersNotUCC)
.def("get_num_rows_not_ucc", &PyUCCVerifier::GetNumRowsNotUCC)
.def("get_clusters_not_ucc", &PyUCCVerifier::GetClustersNotUCC);

DEFINE_ALGORITHM(DataStats, Algorithm).def("get_result_string", &PyDataStats::GetResultString);

DEFINE_ALGORITHM(MetricVerifier, Algorithm).def("mfd_holds", &PyMetricVerifier::MfdHolds);
Expand Down
30 changes: 30 additions & 0 deletions src/python_bindings/py_ucc_verifier.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "algorithms/ucc/ucc_verifier/ucc_verifier.h"
#include "get_algorithm.h"
#include "py_algorithm.h"

namespace python_bindings {

class PyUCCVerifier : public PyAlgorithm<algos::UCCVerifier, PyAlgorithmBase> {
using PyAlgorithmBase::algorithm_;

public:
[[nodiscard]] bool UCCHolds() const {
return GetAlgorithm<algos::UCCVerifier>(algorithm_).UCCHolds();
}

[[nodiscard]] size_t GetNumClustersNotUCC() const {
return GetAlgorithm<algos::UCCVerifier>(algorithm_).GetNumClustersNotUCC();
}

[[nodiscard]] size_t GetNumRowsNotUCC() const {
return GetAlgorithm<algos::UCCVerifier>(algorithm_).GetNumRowsNotUCC();
}

[[nodiscard]] std::vector<model::PLI::Cluster> GetClustersNotUCC() const {
return GetAlgorithm<algos::UCCVerifier>(algorithm_).GetClustersNotUCC();
}
};

} // namespace python_bindings

0 comments on commit 9eff38e

Please sign in to comment.