DiSMEC++
dismec::TrainingStatsGatherer Class Reference

#include <statistics.h>

Classes

struct  StatData
 

Public Member Functions

 TrainingStatsGatherer (std::string source, std::string target_file)
 
 ~TrainingStatsGatherer ()
 
void setup_minimizer (thread_id_t thread, stats::Tracked &minimizer)
 NOTE: these functions will be called concurrently. More...
 
void setup_initializer (thread_id_t thread, stats::Tracked &initializer)
 
void setup_objective (thread_id_t thread, stats::Tracked &objective)
 
void setup_postproc (thread_id_t thread, stats::Tracked &objective)
 
std::unique_ptr< ResultStatsGatherercreate_results_gatherer (thread_id_t thread, const std::shared_ptr< const TrainingSpec > &spec)
 
void finalize ()
 
nlohmann::json to_json () const
 

Private Types

using thread_id_t = dismec::parallel::thread_id_t
 
using collection_ptr_t = std::shared_ptr< stats::StatisticsCollection >
 

Private Member Functions

void add_accu (const std::string &key, thread_id_t thread, const std::shared_ptr< stats::StatisticsCollection > &accumulator)
 

Private Attributes

std::unordered_map< std::string, StatDatam_Merged
 
std::vector< std::unordered_map< std::string, collection_ptr_t > > m_PerThreadCollections
 
std::mutex m_Lock
 
std::string m_TargetFile
 
std::unique_ptr< nlohmann::jsonm_Config
 

Detailed Description

Definition at line 29 of file statistics.h.

Member Typedef Documentation

◆ collection_ptr_t

Definition at line 51 of file statistics.h.

◆ thread_id_t

Constructor & Destructor Documentation

◆ TrainingStatsGatherer()

TrainingStatsGatherer::TrainingStatsGatherer ( std::string  source,
std::string  target_file 
)

Definition at line 21 of file statistics.cpp.

References m_Config.

◆ ~TrainingStatsGatherer()

TrainingStatsGatherer::~TrainingStatsGatherer ( )

Definition at line 64 of file statistics.cpp.

References m_TargetFile, and to_json().

Member Function Documentation

◆ add_accu()

void TrainingStatsGatherer::add_accu ( const std::string &  key,
parallel::thread_id_t  thread,
const std::shared_ptr< stats::StatisticsCollection > &  accumulator 
)
private

◆ create_results_gatherer()

std::unique_ptr< ResultStatsGatherer > TrainingStatsGatherer::create_results_gatherer ( parallel::thread_id_t  thread,
const std::shared_ptr< const TrainingSpec > &  spec 
)

Definition at line 162 of file statistics.cpp.

References add_accu().

◆ finalize()

void TrainingStatsGatherer::finalize ( )

Definition at line 46 of file statistics.cpp.

References m_Merged, and m_PerThreadCollections.

◆ setup_initializer()

void TrainingStatsGatherer::setup_initializer ( thread_id_t  thread,
stats::Tracked initializer 
)

Definition at line 35 of file statistics.cpp.

References add_accu(), and dismec::stats::Tracked::get_stats().

◆ setup_minimizer()

void TrainingStatsGatherer::setup_minimizer ( thread_id_t  thread,
stats::Tracked minimizer 
)

NOTE: these functions will be called concurrently.

Definition at line 31 of file statistics.cpp.

References add_accu(), and dismec::stats::Tracked::get_stats().

◆ setup_objective()

void TrainingStatsGatherer::setup_objective ( thread_id_t  thread,
stats::Tracked objective 
)

Definition at line 39 of file statistics.cpp.

References add_accu().

◆ setup_postproc()

void TrainingStatsGatherer::setup_postproc ( thread_id_t  thread,
stats::Tracked objective 
)

Definition at line 42 of file statistics.cpp.

References add_accu(), and dismec::stats::Tracked::get_stats().

◆ to_json()

nlohmann::json TrainingStatsGatherer::to_json ( ) const

Definition at line 72 of file statistics.cpp.

References m_Merged.

Referenced by ~TrainingStatsGatherer().

Member Data Documentation

◆ m_Config

std::unique_ptr<nlohmann::json> dismec::TrainingStatsGatherer::m_Config
private

Definition at line 61 of file statistics.h.

Referenced by add_accu(), and TrainingStatsGatherer().

◆ m_Lock

std::mutex dismec::TrainingStatsGatherer::m_Lock
private

Definition at line 55 of file statistics.h.

Referenced by add_accu().

◆ m_Merged

std::unordered_map<std::string, StatData> dismec::TrainingStatsGatherer::m_Merged
private

Definition at line 50 of file statistics.h.

Referenced by finalize(), and to_json().

◆ m_PerThreadCollections

std::vector<std::unordered_map<std::string, collection_ptr_t> > dismec::TrainingStatsGatherer::m_PerThreadCollections
private

Definition at line 53 of file statistics.h.

Referenced by add_accu(), and finalize().

◆ m_TargetFile

std::string dismec::TrainingStatsGatherer::m_TargetFile
private

Definition at line 57 of file statistics.h.

Referenced by ~TrainingStatsGatherer().


The documentation for this class was generated from the following files: