Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
bind_evaluator.h
Go to the documentation of this file.
1#include "module.h"
3
4namespace py = pybind11;
5namespace br = Brush;
6namespace nl = nlohmann;
7
8using stream_redirect = py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>;
9
10template <br::ProgramType T>
11void bind_evaluator(py::module& m, string name)
12{
13 using Class = br::Eval::Evaluation<T>;
14 // TODO: will this part of c++ be exposed?
15 py::class_<Class> eval(m, name.data() );
16 eval.def(py::init<>())
17 .def("assign_fit", &Class::assign_fit)
18 .def_property("scorer", &Class::get_scorer, &Class::set_scorer)
19 ;
20}
py::call_guard< py::scoped_ostream_redirect, py::scoped_estream_redirect > stream_redirect
void bind_evaluator(py::module &m, string name)
Class for evaluating the fitness of individuals in a population.
Definition evaluation.h:27
< nsga2 selection operator for getting the front
Definition bandit.cpp:3