Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
evaluation.h
Go to the documentation of this file.
1
2
#ifndef EVALUATION_H
3
#define EVALUATION_H
4
5
#include <string>
6
7
#include "
../vary/search_space.h
"
8
#include "
../ind/individual.h
"
9
#include "
../data/data.h
"
10
#include "
scorer.h
"
11
#include "
../pop/population.h
"
12
13
using
std::string;
14
15
namespace
Brush
{
16
17
using namespace
Pop
;
18
19
namespace
Eval
{
20
21
template
<ProgramType T>
26
class
Evaluation
{
27
public
:
28
Scorer<T>
S
;
33
Evaluation
(){
34
// TODO: make eval update loss_v accordingly, and set to th same as train loss if there is no batch or no validation
35
36
string
scorer;
37
if
( (T ==
Brush::ProgramType::MulticlassClassifier
)
38
|| (T ==
Brush::ProgramType::Representer
) )
39
scorer =
"multi_log"
;
40
else
if
(T ==
Brush::ProgramType::BinaryClassifier
)
41
scorer =
"log"
;
42
else
43
scorer =
"mse"
;
44
45
this->S.
set_scorer
(scorer);
46
};
47
~Evaluation
(){};
48
53
void
set_scorer
(
string
scorer){this->S.
set_scorer
(scorer);};
54
59
string
get_scorer
(){
return
this->S.
get_scorer
();};
60
70
void
update_fitness
(
Population<T>
& pop,
71
int
island,
72
const
Dataset
& data,
73
const
Parameters
& params,
74
bool
fit=
true
,
75
bool
validation=
false
76
);
77
85
void
assign_fit
(
Individual<T>
& ind,
const
Dataset
& data,
86
const
Parameters
& params,
bool
val=
false
);
87
88
// representation program (TODO: implement)
89
};
90
91
}
//selection
92
}
//brush
93
#endif
Brush::Data::Dataset
holds variable type data.
Definition
data.h:51
Brush::Eval::Evaluation::update_fitness
void update_fitness(Population< T > &pop, int island, const Dataset &data, const Parameters ¶ms, bool fit=true, bool validation=false)
Update the fitness of individuals in a population.
Definition
evaluation.cpp:9
Brush::Eval::Evaluation::~Evaluation
~Evaluation()
Definition
evaluation.h:47
Brush::Eval::Evaluation::set_scorer
void set_scorer(string scorer)
Set the scorer for evaluation.
Definition
evaluation.h:53
Brush::Eval::Evaluation::S
Scorer< T > S
Definition
evaluation.h:28
Brush::Eval::Evaluation::Evaluation
Evaluation()
Constructor for Evaluation class.
Definition
evaluation.h:33
Brush::Eval::Evaluation::get_scorer
string get_scorer()
Get the current scorer.
Definition
evaluation.h:59
Brush::Eval::Evaluation::assign_fit
void assign_fit(Individual< T > &ind, const Dataset &data, const Parameters ¶ms, bool val=false)
Assign fitness to an individual.
Definition
evaluation.cpp:46
Brush::Eval::Scorer
Definition
scorer.h:18
Brush::Eval::Scorer::get_scorer
string get_scorer()
Definition
scorer.h:42
Brush::Eval::Scorer::set_scorer
void set_scorer(string scorer)
Definition
scorer.h:41
Brush::Pop::Individual
Definition
individual.h:15
Brush::Pop::Population
Definition
population.h:12
data.h
individual.h
Brush::Eval
Definition
evaluation.cpp:4
Brush::Pop
Definition
individual.cpp:4
Brush
< nsga2 selection operator for getting the front
Definition
data.cpp:12
Brush::ProgramType::BinaryClassifier
@ BinaryClassifier
Definition
types.h:72
Brush::ProgramType::MulticlassClassifier
@ MulticlassClassifier
Definition
types.h:73
Brush::ProgramType::Representer
@ Representer
Definition
types.h:74
population.h
scorer.h
search_space.h
Brush::Parameters
Definition
params.h:18
src
eval
evaluation.h
Generated by
1.13.2