Brush C++ API
A flexible interpretable machine learning framework
Toggle main menu visibility
Loading...
Searching...
No Matches
bind_evaluator.h
Go to the documentation of this file.
1
#include "
module.h
"
2
#include "
../eval/evaluation.h
"
3
4
namespace
py = pybind11;
5
namespace
br
=
Brush
;
6
namespace
nl
=
nlohmann
;
7
8
using
stream_redirect
= py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>;
9
10
template
<br::ProgramType T>
11
void
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
// Keep the original four-argument Python API. The optional dataset is
18
// used internally by batched Engine runs to score a fixed validation
19
// partition and is not required by the DEAP interface.
20
.def(
"assign_fit"
, &Class::assign_fit,
21
py::arg(
"individual"
), py::arg(
"data"
), py::arg(
"params"
),
22
py::arg(
"validation"
) =
false
,
23
py::arg(
"validation_data"
) =
nullptr
)
24
.def_property(
"scorer"
, &Class::get_scorer, &Class::set_scorer)
25
;
26
}
stream_redirect
py::call_guard< py::scoped_ostream_redirect, py::scoped_estream_redirect > stream_redirect
Definition
bind_engines.h:31
bind_evaluator
void bind_evaluator(py::module &m, string name)
Definition
bind_evaluator.h:11
Brush::Eval::Evaluation
Class for evaluating the fitness of individuals in a population.
Definition
evaluation.h:27
evaluation.h
module.h
Brush
< nsga2 selection operator for getting the front
Definition
bandit.cpp:3
nlohmann
Definition
utils.h:30
src
bindings
bind_evaluator.h
Generated by
1.18.0