Brush C++ API
A flexible interpretable machine learning framework
Toggle main menu visibility
Loading...
Searching...
No Matches
module.cpp
Go to the documentation of this file.
1
/* Brush
2
3
module.cpp : Python interface to Brush classes and functions, using pybind11
4
5
copyright 2021 William La Cava
6
authors: William La Cava and Joseph D. Romano
7
license: GNU/GPL v3
8
*/
9
10
#define STRINGIFY(x) #x
11
#define MACRO_STRINGIFY(x) STRINGIFY(x)
12
13
#include "
module.h
"
14
15
namespace
py = pybind11;
16
17
// forward declarations ------------------
18
19
// non-templated bindings
20
void
bind_params
(py::module &);
21
void
bind_dataset
(py::module &);
22
void
bind_search_space
(py::module &);
23
void
bind_fitness
(py::module &);
24
25
// templated bindings
26
void
bind_programs
(py::module &);
27
void
bind_evaluators
(py::module &);
28
void
bind_individuals
(py::module &);
29
void
bind_variations
(py::module &);
30
void
bind_selections
(py::module &);
31
void
bind_engines
(py::module &);
32
33
PYBIND11_MODULE
(_brush, m) {
34
35
#ifdef VERSION_INFO
36
m.attr(
"__version__"
) =
MACRO_STRINGIFY
(VERSION_INFO);
37
#else
38
m.attr(
"__version__"
) =
"dev"
;
// TODO: use version file
39
#endif
40
// data structures
41
bind_params
(m);
42
bind_dataset
(m);
43
bind_search_space
(m);
44
bind_fitness
(m);
45
46
// TODO: create a submodule for them
47
bind_evaluators
(m);
48
bind_selections
(m);
49
bind_variations
(m);
50
51
// solutions
52
py::module_ m2 = m.def_submodule(
"program"
,
"Contains Program classes."
);
53
bind_programs
(m2);
54
55
py::module_ m3 = m.def_submodule(
"individual"
,
"Contains Individual classes."
);
56
bind_individuals
(m3);
57
58
py::module_ m4 = m.def_submodule(
"engine"
,
"Learning engines."
);
59
bind_engines
(m4);
60
}
MACRO_STRINGIFY
#define MACRO_STRINGIFY(x)
Definition
module.cpp:11
bind_fitness
void bind_fitness(py::module &)
Definition
bind_fitness.cpp:10
bind_variations
void bind_variations(py::module &)
Definition
bind_variation.cpp:8
bind_programs
void bind_programs(py::module &)
Definition
bind_programs.cpp:12
bind_dataset
void bind_dataset(py::module &)
Definition
bind_dataset.cpp:9
bind_search_space
void bind_search_space(py::module &)
Definition
bind_search_space.cpp:10
bind_selections
void bind_selections(py::module &)
Definition
bind_selection.cpp:8
PYBIND11_MODULE
PYBIND11_MODULE(_brush, m)
Definition
module.cpp:33
bind_engines
void bind_engines(py::module &)
Definition
bind_engines.cpp:8
bind_individuals
void bind_individuals(py::module &)
Definition
bind_individuals.cpp:9
bind_params
void bind_params(py::module &)
Definition
bind_params.cpp:7
bind_evaluators
void bind_evaluators(py::module &)
Definition
bind_evaluator.cpp:10
module.h
src
bindings
module.cpp
Generated by
1.17.0