12using stream_redirect = py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>;
17 using RetType = std::conditional_t<
18 std::is_same_v<T,Reg>, ArrayXf,
19 std::conditional_t<std::is_same_v<T,Cls>,
ArrayXb,
20 std::conditional_t<std::is_same_v<T,MCls>,
ArrayXi, ArrayXXf>>>;
22 py::class_<T>
prog(m, name.data() );
23 prog.def(py::init<>())
25 [](
const json&
j){ T
p =
j;
return p; })
28 static_cast<T &(T::*)(
const Dataset &
d)
>(&T::fit),
29 "fit from Dataset object")
34 static_cast<RetType (T::*)(
const Dataset &
d)
>(&T::predict),
35 "predict from Dataset object")
38 "predict from X data")
41 py::arg(
"type") =
"compact",
42 py::arg(
"pretty") =
false,
45 .def(
"get_dot_model", &T::get_dot_model, py::arg(
"extras")=
"")
46 .def(
"get_weights", &T::get_weights)
47 .def(
"size", &T::size, py::arg(
"include_weight")=
true)
48 .def(
"complexity", &T::complexity)
49 .def(
"depth", &T::depth)
54 .def(
"set_search_space", &T::set_search_space)
72 if constexpr (std::is_same_v<T,Cls>)
74 prog.def(
"predict_proba",
75 static_cast<ArrayXf (T::*)(
const Dataset &
d)
>(&T::predict_proba),
76 "predict from Dataset object")
79 "predict from X data")
void bind_engine(py::module &m, string name)
py::call_guard< py::scoped_ostream_redirect, py::scoped_estream_redirect > stream_redirect
void bind_program(py::module &m, string name)
py::call_guard< py::scoped_ostream_redirect, py::scoped_estream_redirect > stream_redirect
holds variable type data.
The Engine class represents the core engine of the brush library.
< nsga2 selection operator for getting the front
Program< PT::Representer > RepresenterProgram
Eigen::Array< bool, Eigen::Dynamic, 1 > ArrayXb
Program< PT::BinaryClassifier > ClassifierProgram
Eigen::Array< int, Eigen::Dynamic, 1 > ArrayXi
Program< PT::Regressor > RegressorProgram
Program< PT::MulticlassClassifier > MulticlassClassifierProgram