14 #ifndef __INSTANCES_H__
15 #define __INSTANCES_H__
37 #include "../tinyxml2/tinyxml2.h"
61 explicit Instances(
const tinyxml2::XMLDocument&);
86 enum Use{Unused, Training, Generalization, Testing};
136 return(
items.size());
139 bool empty(
void)
const;
148 std::string
write_use(
const size_t&)
const;
150 bool is_used(
const size_t&)
const;
169 void set(
const size_t&);
170 void set(
const tinyxml2::XMLDocument&);
184 void set_use(
const size_t&,
const std::string&);
194 void split_sequential_indices(
const double& training_ratio = 0.6,
const double& generalization_ratio = 0.2,
const double& testing_ratio = 0.2);
196 void split_random_indices(
const double& training_ratio = 0.6,
const double& generalization_ratio = 0.2,
const double& testing_ratio = 0.2);
198 void split_instances(
const SplittingMethod& splitting_method = Random,
const double& training_ratio = 0.6,
const double& generalization_ratio = 0.2,
const double& testing_ratio = 0.2);
208 void print(
void)
const;
210 tinyxml2::XMLDocument*
to_XML(
void)
const;
211 void from_XML(
const tinyxml2::XMLDocument&);
const Use & get_use(const size_t &) const
bool empty(void) const
Returns empty if the number of instances is zero, and false otherwise.
tinyxml2::XMLDocument * to_XML(void) const
void set_display(const bool &)
Vector< std::string > write_uses(void) const
Returns the use of every instance (training, generalization, testing) in a string vector...
Item(void)
Default constructor.
std::string to_string(void) const
Returns a string representation of the current instances object.
void set(void)
Sets a instances object with zero instances.
void set_instances_number(const size_t &)
void set_testing(void)
Sets all the instances in the data set for testing.
size_t count_training_instances_number(void) const
Returns the number of instances in the data set which will be used for training.
void print(void) const
Prints to the screen information about the instances object.
std::string write_use(const size_t &) const
virtual ~Instances(void)
Destructor.
static SplittingMethod get_splitting_method(const std::string &)
const bool & get_display(void) const
void set_training(void)
Sets all the instances in the data set for training.
Vector< size_t > arrange_testing_indices(void) const
Returns the indices of the instances which will be used for testing.
size_t count_testing_instances_number(void) const
Returns the number of instances in the data set which will be used for testing.
Vector< size_t > arrange_training_indices(void) const
Returns the indices of the instances which will be used for training.
size_t count_generalization_instances_number(void) const
Returns the number of instances in the data set which will be used for generalization.
void set_generalization(void)
Sets all the instances in the data set for generalization.
void from_XML(const tinyxml2::XMLDocument &)
void convert_time_series(const size_t &)
bool operator==(const Instances &) const
virtual ~Item(void)
Destructor.
Vector< Item > items
Uses of instances (none, training, generalization or testing).
Vector< double > calculate_uses_percentage(void) const
void split_instances(const SplittingMethod &splitting_method=Random, const double &training_ratio=0.6, const double &generalization_ratio=0.2, const double &testing_ratio=0.2)
void split_sequential_indices(const double &training_ratio=0.6, const double &generalization_ratio=0.2, const double &testing_ratio=0.2)
size_t count_unused_instances_number(void) const
void set_use(const size_t &, const Use &)
Vector< std::string > write_abbreviated_uses(void) const
Returns the use of every instance (training, generalization, testing) in a string vector...
void split_random_indices(const double &training_ratio=0.6, const double &generalization_ratio=0.2, const double &testing_ratio=0.2)
Use use
Use of an instance (training, generalization, testing or unused).
bool is_used(const size_t &) const
Item(const Use &new_use)
Use constructor.
size_t count_used_instances_number(void) const
Vector< size_t > count_uses(void) const
void set_uses(const Vector< Use > &)
size_t get_instances_number(void) const
Returns the number of instances in the data set.
Vector< size_t > arrange_generalization_indices(void) const
Returns the indices of the instances which will be used for generalization.
bool display
Display messages to screen.
Vector< Use > arrange_uses(void) const
Returns the use of every instance (training, generalization, testing) in a vector.
Instances & operator=(const Instances &)