Skip to content

Commit

Permalink
Merge branch 'Desbordante:main' into readme_update
Browse files Browse the repository at this point in the history
  • Loading branch information
mechanicpanic committed Apr 27, 2024
2 parents 70caa13 + 49c1450 commit 5a6fa23
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
5 changes: 5 additions & 0 deletions examples/datasets/rules_book_rows.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bread,Butter,Milk,
Eggs,Milk,Yogurt,
Bread,Cheese,Eggs,Milk
Eggs,Milk,Yogurt,
Cheese,Milk,Yogurt,
2 changes: 1 addition & 1 deletion src/core/algorithms/algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "algorithms/cfd/mining_algorithms.h"
#include "algorithms/fd/mining_algorithms.h"
#include "algorithms/fd/verification_algorithms.h"
#include "algorithms/gfd/mining_algorithms.h"
#include "algorithms/gfd/verification_algorithms.h"
#include "algorithms/ind/mining_algorithms.h"
#include "algorithms/metric/verification_algorithms.h"
#include "algorithms/od/mining_algorithms.h"
Expand Down
File renamed without changes.
24 changes: 21 additions & 3 deletions src/python_bindings/ar/bind_ar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,33 @@ namespace py = pybind11;
namespace python_bindings {
void BindAr(py::module_& main_module) {
using namespace algos;
using model::ArIDs;
using model::ARStrings;

auto ar_module = main_module.def_submodule("ar");
py::class_<ARStrings>(ar_module, "AssociativeRule")
py::class_<ARStrings>(ar_module, "ARStrings")
.def("__str__", &ARStrings::ToString)
.def_readonly("left", &ARStrings::left)
.def_readonly("right", &ARStrings::right)
.def_readonly("confidence", &ARStrings::confidence);
BindPrimitive<Apriori>(ar_module, &ARAlgorithm::GetArStringsList, "ArAlgorithm", "get_ars",
{"Apriori"}, py::return_value_policy::move);

py::class_<ArIDs>(ar_module, "ArIDs")
.def_readonly("left", &ArIDs::left)
.def_readonly("right", &ArIDs::right)
.def_readonly("confidence", &ArIDs::confidence);

py::class_<ARAlgorithm, Algorithm>(ar_module, "ArAlgorithm")
.def("get_ars", &ARAlgorithm::GetArStringsList,
py::return_value_policy::reference_internal)
.def("get_itemnames", &ARAlgorithm::GetItemNamesVector)
.def("get_ar_ids", &ARAlgorithm::GetArIDsList);

auto algos_module = ar_module.def_submodule("algorithms");
auto default_algorithm =
detail::RegisterAlgorithm<Apriori, ARAlgorithm>(algos_module, "Apriori");
algos_module.attr("Default") = default_algorithm;

// Perhaps in the future there will be a need for:
// default_algorithm.def("get_frequent_list", &Apriori::GetFrequentList);
}
} // namespace python_bindings
2 changes: 1 addition & 1 deletion src/python_bindings/gfd/bind_gfd_verification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "algorithms/gfd/mining_algorithms.h"
#include "algorithms/gfd/verification_algorithms.h"
#include "py_util/bind_primitive.h"

namespace {
Expand Down

0 comments on commit 5a6fa23

Please sign in to comment.