Vita
gp/src/problem.h
Go to the documentation of this file.
1
13#if !defined(VITA_SRC_PROBLEM_H)
14#define VITA_SRC_PROBLEM_H
15
16#include <filesystem>
17#include <string>
18
19#include "kernel/exceptions.h"
20#include "kernel/problem.h"
23
24namespace vita
25{
26
35enum class dataset_t {training = 0, validation, test};
36
43class src_problem : public problem
44{
45public:
46 // --- Constructors ---
48
49 explicit src_problem(const std::filesystem::path &, typing = typing::weak);
50 explicit src_problem(std::istream &, typing = typing::weak);
51
53 static const default_symbols_t default_symbols;
54 src_problem(const std::filesystem::path &, const default_symbols_t &,
55 typing = typing::weak);
56 src_problem(const std::filesystem::path &, const std::filesystem::path &,
57 typing = typing::weak);
58 // --------------------
59
60 bool operator!() const;
61 std::size_t setup_symbols(typing = typing::weak);
62 std::size_t setup_symbols(const std::filesystem::path &,
63 typing = typing::weak);
65
66 const dataframe &data(dataset_t = dataset_t::training) const;
67 dataframe &data(dataset_t = dataset_t::training);
68
70 bool classification() const { return classes() > 1; }
71
72 unsigned categories() const;
73 unsigned classes() const;
74 unsigned variables() const;
75
76 bool is_valid() const override;
77
78private:
79 // Private support methods.
80 bool compatible(const cvect &, const std::vector<std::string> &,
81 const category_set &) const;
82 std::size_t setup_symbols_impl();
83 std::size_t setup_symbols_impl(const std::filesystem::path &);
84
85 // Private data members.
86 dataframe training_;
87 dataframe validation_;
88 symbol_factory factory_;
89};
90
91} // namespace vita
92
93#endif // include guard
Information about the set of categories used in a specific problem.
Definition: category_set.h:68
A 2-dimensional labeled data structure with columns of potentially different types.
Definition: dataframe.h:48
Aggregates the problem-related data needed by an evolutionary program.
Definition: problem.h:24
Provides a GP-specific interface to the generic problem class.
unsigned categories() const
std::size_t setup_symbols(typing=typing::weak)
Sets up the symbol set.
const dataframe & data(dataset_t=dataset_t::training) const
bool classification() const
Just a shorthand for checking number of classes.
bool operator!() const
void setup_terminals(typing)
Inserts variables and states for nominal attributes into the symbol_set.
unsigned classes() const
unsigned variables() const
bool is_valid() const override
src_problem()
New empty instance of src_problem.
An abstract factory for symbols.
Definition: factory.h:39
The main namespace for the project.
dataset_t
Data/simulations are categorised in three sets:
typing
Category/type management of the dataframe columns.
Definition: category_set.h:39