Brush C++ API
A flexible interpretable machine learning framework
Toggle main menu visibility
Loading...
Searching...
No Matches
bind_search_space.cpp
Go to the documentation of this file.
1
#include "
module.h
"
2
#include "
../vary/search_space.h
"
3
#include "
../program/program.h
"
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
void
bind_search_space
(py::module &m)
11
{
12
// Notice: We change the interface for SearchSpace a little bit by
13
// constructing it with a Dataset object, rather than initializing it as an
14
// empty struct and then calling init() with the Dataset object.
15
py::class_<br::SearchSpace>(m,
"SearchSpace"
)
16
.def(py::init([](
br::Data::Dataset
data,
bool
weights_init=
true
){
17
SearchSpace
SS
;
18
SS
.init(data, {}, weights_init);
19
return
SS
;
20
}),
21
py::arg(
"data"
),
22
py::arg(
"weights_init"
) = true )
23
.def(py::init<
const
Dataset
&,
const
unordered_map<string,float>&,
24
bool
>(),
25
py::arg(
"data"
),
26
py::arg(
"user_ops"
),
27
py::arg(
"weights_init"
) =
true
)
28
.def(
"__repr__"
, &
br::SearchSpace::repr
,
"Representation for debugging the SearchSpace object"
)
29
.def(
"make_regressor"
, &
br::SearchSpace::make_regressor
,
30
py::arg(
"max_d"
) = 0,
31
py::arg(
"max_size"
) = 0,
32
py::arg(
"params"
) =
Brush::Parameters
() )
33
.def(
"make_classifier"
, &
br::SearchSpace::make_classifier
,
34
py::arg(
"max_d"
) = 0,
35
py::arg(
"max_size"
) = 0,
36
py::arg(
"params"
) =
Brush::Parameters
() )
37
.def(
"make_multiclass_classifier"
,
38
&
br::SearchSpace::make_multiclass_classifier
,
39
py::arg(
"max_d"
) = 0,
40
py::arg(
"max_size"
) = 0,
41
py::arg(
"params"
) =
Brush::Parameters
() )
42
.def(
"make_representer"
, &
br::SearchSpace::make_representer
,
43
py::arg(
"max_d"
) = 0,
44
py::arg(
"max_size"
) = 0,
45
py::arg(
"params"
) =
Brush::Parameters
() )
46
.def(
"print"
,
47
&
br::SearchSpace::print
,
48
stream_redirect
()
49
)
50
;
51
}
stream_redirect
py::call_guard< py::scoped_ostream_redirect, py::scoped_estream_redirect > stream_redirect
Definition
bind_engines.h:31
bind_search_space
void bind_search_space(py::module &m)
Definition
bind_search_space.cpp:10
stream_redirect
py::call_guard< py::scoped_ostream_redirect, py::scoped_estream_redirect > stream_redirect
Definition
bind_search_space.cpp:8
Brush::Data::Dataset
holds variable type data.
Definition
data.h:51
module.h
Brush
< nsga2 selection operator for getting the front
Definition
bandit.cpp:3
Brush::SS
SearchSpace SS
nlohmann
Definition
utils.h:30
program.h
search_space.h
Brush::Parameters
Definition
params.h:20
Brush::SearchSpace
Holds a search space, consisting of operations and terminals and functions, and methods to sample tha...
Definition
search_space.h:84
Brush::SearchSpace::print
void print() const
prints the search space map.
Definition
search_space.cpp:175
Brush::SearchSpace::make_regressor
RegressorProgram make_regressor(int max_d=0, int max_size=0, const Parameters ¶ms=Parameters())
Makes a random regressor program. Convenience wrapper for make_program.
Definition
search_space.cpp:468
Brush::SearchSpace::repr
std::string repr() const
returns a string with a json representation of the search space map
Definition
search_space.h:597
Brush::SearchSpace::make_representer
RepresenterProgram make_representer(int max_d=0, int max_size=0, const Parameters ¶ms=Parameters())
Makes a random representer program. Convenience wrapper for make_program.
Definition
search_space.cpp:484
Brush::SearchSpace::make_multiclass_classifier
MulticlassClassifierProgram make_multiclass_classifier(int max_d=0, int max_size=0, const Parameters ¶ms=Parameters())
Makes a random multiclass classifier program. Convenience wrapper for make_program.
Definition
search_space.cpp:478
Brush::SearchSpace::make_classifier
ClassifierProgram make_classifier(int max_d=0, int max_size=0, const Parameters ¶ms=Parameters())
Makes a random classifier program. Convenience wrapper for make_program.
Definition
search_space.cpp:473
src
bindings
bind_search_space.cpp
Generated by
1.17.0