13using stream_redirect = py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>;
15template <br::ProgramType PT>
18 using Class = br::Pop::Individual<PT>;
20 using RetType = std::conditional_t<
21 std::is_same_v<Class,Reg>, ArrayXf,
22 std::conditional_t<std::is_same_v<Class,Cls>,
ArrayXb,
23 std::conditional_t<std::is_same_v<Class,MCls>,
ArrayXi, ArrayXXf>>>;
25 py::class_<Class>
ind(m, name.data() );
34 .def(
"init", &Class::init)
35 .def_property(
"objectives", &Class::get_objectives, &Class::set_objectives)
36 .def_property_readonly(
"program", &Class::get_program)
37 .def_property_readonly(
"fitness", &Class::get_fitness)
38 .def(
"get_model", &Class::get_model,
39 py::arg(
"fmt") =
"compact",
40 py::arg(
"pretty") =
false)
41 .
def(
"get_dot_model", &Class::get_dot_model,
42 py::arg(
"extras") =
"")
45 "fit from Dataset object")
50 static_cast<RetType (
Class::*)(
const Dataset &
d)
>(&Class::predict),
51 "predict from Dataset object")
54 "predict from X data")
70 if constexpr (std::is_same_v<Class,Cls>)
72 ind.def(
"predict_proba",
73 static_cast<ArrayXf (
Class::*)(
const Dataset &
d)
>(&Class::predict_proba),
74 "predict from Dataset object")
77 "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_individual(py::module &m, string name)
holds variable type data.
The Engine class represents the core engine of the brush library.
< nsga2 selection operator for getting the front
Eigen::Array< bool, Eigen::Dynamic, 1 > ArrayXb
Pop::Individual< PT::MulticlassClassifier > MulticlassClassifierIndividual
Eigen::Array< int, Eigen::Dynamic, 1 > ArrayXi
Pop::Individual< PT::Representer > RepresenterIndividual
Pop::Individual< PT::BinaryClassifier > ClassifierIndividual
Pop::Individual< PT::Regressor > RegressorIndividual
An individual program, a.k.a. model.