13using stream_redirect = py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>;
15template <br::ProgramType 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") =
"")
44 static_cast<Class &(Class::*)(
const Dataset &d)
>(&Class::fit),
45 "fit from Dataset object")
47 static_cast<Class &(Class::*)(
const Ref<const ArrayXXf> &X,
const Ref<const ArrayXf> &y)
>(&Class::fit),
50 static_cast<RetType (Class::*)(
const Dataset &d)
>(&Class::predict),
51 "predict from Dataset object")
53 static_cast<RetType (Class::*)(
const Ref<const ArrayXXf> &X)
>(&Class::predict),
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")
76 static_cast<ArrayXf (Class::*)(
const Ref<const ArrayXXf> &X)
>(&Class::predict_proba),
77 "predict from X data")
Brush::RepresenterEngine Rep
Brush::MulticlassClassifierEngine MCls
Brush::ClassifierEngine Cls
py::call_guard< py::scoped_ostream_redirect, py::scoped_estream_redirect > stream_redirect
Brush::RegressorEngine Reg
void bind_individual(py::module &m, string name)
holds variable type data.
Eigen::Array< bool, Eigen::Dynamic, 1 > ArrayXb
< nsga2 selection operator for getting the front
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.