code/src/exe/Trainer/main.cpp
// Create dataset from list of observations
Create dataset from list of observations
Create dataset from list of observations
std::shared_ptr<data::Dataset> create_dataset(const std::vector<Observation>& r_observations)
{
	std::vector<std::string> feature_names;
	for (const auto& r_observation : r_observations)
	{
		for (const auto& r_entry : r_observation.features)
		{
			feature_names.push_back(r_entry.first);
		}
	}
	auto sp_dataset = std::make_shared<data::Dataset>(feature_names);
	for (const auto& r_observation : r_observations)
	{
		sp_dataset->append_observation(r_observation.features, r_observation.label ? 1.0 : 0.0);
	}
	return sp_dataset;
}
std :: shared_ptr < data :: Dataset > create_dataset ( const std :: vector < Observation > & r_observations ) { std :: vector < std :: string > feature_names ; for ( const auto & r_observation : r_observations ) { for ( const auto & r_entry : r_observation . features ) { feature_names . push_back ( r_entry . first ) ; } } auto sp_dataset = std :: make_shared < data :: Dataset > ( feature_names ) ; for ( const auto & r_observation : r_observations ) { sp_dataset -> append_observation ( r_observation . features , r_observation . label ? 1.0 : 0.0 ) ; } return sp_dataset ; }
Create dataset from list of observations
Create dataset from list of observations
// Collect all available features // Store feature observations