Data Collection and Recording Tools¶
Empirical includes a variety of tools for gathering and recording data. The core of these tools is the DataNode class. DataNodes are containers that you can pass as much data as you like into. When DataNodes are built, they can be given various modifiers (specified as template arguments) which control how much information they will collect about the data they are passed. For instance, the data::Current modifier gives the DataNode the power to remember the last value it was passed, whereas the data::Stats modifier keeps track of a variety of statisticcs about the distribution of data that the node has been passed. Except where otherwise noted, modifiers can be combined freely. Some also have dependencies on simpler modifiers. On the whole, DataNodes are designed to be as light-weight as possible while still keeping track of the desired information.
DataNodes that accept the same type of data and have the same modifiers can be grouped together using a DataManager.
The DataInterface class provides a general interface for interacting with DataNodes of any type. This is useful in cases where you have a collection of different types of DataNodes and want to operate on them without casting.
The DataFile class provides an interface for recording data at regular intervals. This data can come from DataNodes, the return of a specified function, or the contents of a specified variable. DataFiles are useful for collecting data over the course of a computational experiment.
Data Tools API¶
DataNodes¶
DataNode objects track a specific type of data over the course of a run.
Collection: New data can be pushed or pulled. Add(VAL… v) pushes data to a node AddDatum(VAL v) pushes just one datum, but can be used as an action for a signal.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2016-2018
Process: What should happen on Reset() ?
- Trigger an action to process the prior update’s data stored.
- Clear all data.
- Send data to a stream (or stats automatically have a stream that, if non-null data is sent to?)
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Current, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::Current == This module lets you track the current (i.e. most recently added) value
Public Functions
-
DataNodeModule
()¶
-
const VAL_TYPE &
GetCurrent
() const¶ Return the current (most recently added) value.
Protected Types
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>¶
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>¶
Protected Attributes
-
VAL_TYPE
cur_val
¶ Most recent value passed to this node.
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Info, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::Info == This module adds information such as a name, description, and keyword for this node.
Public Functions
-
DataNodeModule
()¶
Protected Types
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>¶
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Log, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::Log == This module lets you log all of the values that have been added since the last re-set
Public Functions
-
DataNodeModule
()
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Archive, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::Archive == This module keeps track of historical values in addition to those added since the last re-set. Every time Reset() is called, all values that have been added since the previous time Reset() are stored in a vector in the archive.
Public Functions
-
DataNodeModule
()
-
const auto &
GetArchive
() const¶ Get all data ever added to this DataNode. Returns a vector of vectors; each vector contains all data from a single time point (interval between resets)
-
const emp::vector<VAL_TYPE> &
GetData
(size_t update) const¶ Get a vector of all data that was added during the.
- Parameters
update
: ‘th interval between resets.
-
const emp::vector<VAL_TYPE> &
GetData
() const¶ Get a vector of all data that has been added since the last reset.
-
size_t
GetResetCount
() const¶ Get the number of time intervals recorded in this DataNode. Note that this is one more than the number of times it has been reset
-
void
Reset
()¶ Reset this DataNode, starting a new grouping of values in the archive. Resetting is useful for tracking data from different time points, such as per update or generation.
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Range, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::Range == This module allows this DataNode to store information (min, max, mean, count, and total) about the distribution of the values that have been added since the last call to Reset().
Public Functions
-
DataNodeModule
()
-
void
AddDatum
(const VAL_TYPE &val) Add.
- Parameters
val
: to this DataNode
-
void
Reset
() Reset DataNode, setting the running calucluations of total, min, mean, and max to 0.
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::FullRange, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::FullRange == This module makes the DataNode store a history of distributional information measured by data::Range beteen calls to Reset(). Series of historical values are stored in vectors (except mean, which is calculated from total and count).
Public Functions
-
DataNodeModule
()
-
double
GetTotal
(size_t update) const¶ Get the sum of all values added to this DataNode during the.
- Parameters
update
: specified.
-
double
GetMean
(size_t update) const¶ Get the mean of all values added to this DataNode during the.
- Parameters
update
: specified.
-
double
GetMin
(size_t update) const¶ Get the minimum of all values added to this DataNode during the.
- Parameters
update
: specified.
-
double
GetMax
(size_t update) const¶ Get the maximum of all values added to this DataNode during the.
- Parameters
update
: specified.
-
size_t
GetResetCount
() const¶ Get the number of time intervals recorded in this DataNode. Note that this is one more than the number of times it has been reset
-
void
Reset
() Store the current range statistics in the archive and reset for a new interval.
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Stats, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::Stats == Note: These statistics are calculated with the assumption that the data this node has recieved is the entire population of measurements we’re interested in, not a sample.
Note 2: Kurtosis is calculated using Snedecor and Cochran (1967)’s formula. A perfect normal distribution has a kurtosis of 0.
Public Functions
-
DataNodeModule
()
-
double
GetVariance
() const¶ Get the variance (squared deviation from the mean) of values added since the last reset.
-
double
GetStandardDeviation
() const¶ Get the standard deviation of values added since the last reset.
-
double
GetSkew
() const¶ Get the skewness of values added since the last reset. This measurement tells you about the shape of the distribution. For a unimodal distribution, negative skew means that the distribution has a longer/thicker tail to the left. Positive skew means that ths distribution has a longer/thicker tail to the right.
-
double
GetKurtosis
() const¶ Get the kurtosis of the values added since the last reset. This is another measurement that describes the shape of the distribution. High kurtosis means that there is more data in the tails of the distribution (i.e. the tails are “heavier”), whereas low kurtosis means that there is less data in the tails. We use Snedecor and Cochran (1967)’s formula to calculate kurtosis. Under this formula, a normal distribution has kurtosis of 0.
-
void
AddDatum
(const VAL_TYPE &val) Add.
- Parameters
val
: to this DataNode
-
void
Reset
() Reset this node (resets current stats to 0)
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Histogram, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::Histogram == Make the DataNode track a histogram of values observed since the last reset.
Public Functions
-
DataNodeModule
()
-
VAL_TYPE
GetHistMin
() const¶ Returns the minimum value this histogram is capable of containing (i.e. the minimum value for the first bin)
-
VAL_TYPE
GetHistMax
() const¶ Returns the maximum value this histogram is capable of containing (i.e. the maximum value for the last bin)
-
size_t
GetHistCount
(size_t bin_id) const¶ Return the count of items in the.
- Parameters
bin_id
: ‘th bin of the histogram
-
double
GetHistWidth
(size_t bin_id) const¶ Return the width of the.
- Parameters
bin_id
: ‘th bin of the histogram
-
const emp::vector<size_t> &
GetHistCounts
() const¶ Return a vector containing the count of items in each bin of the histogram.
-
emp::vector<double>
GetBinMins
() const¶ Return a vector containing the lowest value allowed in each bin.
-
void
SetupBins
(VAL_TYPE _min, VAL_TYPE _max, size_t num_bins)¶ Sets up the ranges of values that go in each bin of the histogram.
- Parameters
_min
: - the lowest value allowed in the histogram_max
: - the largest value allowed in the histogramnum_bins
: - The number of bins the histogram should have. The distance between min and max will be easily divided among this many bins.
-
void
AddDatum
(const VAL_TYPE &val) Add.
- Parameters
val
: to the DataNode
-
void
Reset
() Reset the DataNode (empties the historgram)
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Pull, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...>¶ - #include <DataNode.h>
== data::Pull == This module makes it possible to give the DataNode a function that it can call to calculate new values or sets of values that it will then track. These functions are called every time the PullData method is called on this node, and the values they return are measured as specified by the other modules in this node.
Protected Types
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>¶
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>¶
Protected Functions
-
void
PullData_impl
()¶
-
template<>
-
namespace
emp
¶ If we are in emscripten, make sure to include the header.
This file contains extra analysis tools to use with systematics managers that have non-null DATA_TYPES.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2018
This file contains functions for adding additional data files to Worlds.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2018
Typedefs
-
using
emp::ModPack = typedef emp::IntPack<(int) MODS...>
A shortcut for converting DataNode mod ID’s to IntPacks.
-
using
emp::DataMonitor = typedef DataNode<T, data::Current, data::Info, data::Range, data::Stats, MODS...>
A node that stores data about the most recent value it recieved, as well as the distribution (min, max, count, total, and mean) of values it has recieved since the last reset. It also allows you to give it a name, description, and keyword.
-
using
emp::DataLog = typedef DataNode<T, data::Current, data::Info, data::Log, MODS...>
A node that stores data about the most recent value it recieved, as well as all values it has recieved since the last reset. It also allows you to give it a name, description, and keyword.
-
using
emp::DataArchive = typedef DataNode<T, data::Info, data::Archive, data::FullRange, MODS...>
A node that stores all data it recieves in an archive (vector of vectors). The inner vectors are groups of data that were recieved between resets. This node also keeps a record of the min, max, count, and total of each vector, so you don’t have to recalculate it later. Additionally, it allows you to give it a name, description, and keyword.
Enums
-
enum
data
¶ A set of modifiers are available do describe DataNode.
Values:
-
Current
¶ Track most recent value.
-
Info
¶ Include information (name, keyword, description) for each instance.
-
Log
¶ Track all values since last Reset()
-
Archive
¶ Track Log + ALL values over time (with purge options)
-
Range
¶ Track min, max, mean, total.
-
Histogram
¶ Keep a full histogram.
-
Pull
¶ Enable data collection on request.
Various signals are possible:
-
SignalReset
¶ Include a signal that triggers BEFORE Reset() to process data.
-
SignalData
¶ Include a signal when new data is added (as a group)
-
SignalDatum
¶ Include a signal when each datum is added.
-
SignalRange
¶ Include a signal for data in a range.
-
SignalLimits
¶ Include a signal for data OUTSIDE a range.
-
UNKNOWN
¶ Unknown modifier; will trigger error.
-
-
template <emp::data MOD>
structDataModInfo
¶ - #include <DataNode.h>
Extra info about data modules that we need to know before actually building this DataNode. (for now, just REQUISITES for each module.)
Public Types
-
template<>
usingreqs
= ModPack<>¶
-
template<>
-
template <>
template<>
structDataModInfo
<data::Archive> - #include <DataNode.h>
Public Types
-
template<>
usingreqs
= ModPack<data::Log>
-
template<>
-
template <>
template<>
structDataModInfo
<data::FullRange> - #include <DataNode.h>
Public Types
-
template<>
usingreqs
= ModPack<data::Range>
-
template<>
-
template <>
template<>
structDataModInfo
<data::Stats> - #include <DataNode.h>
Public Types
-
template<>
usingreqs
= ModPack<data::Range>
-
template<>
-
template <emp::data CUR_MOD, emp::data... MODS>
template<>
structDataModuleRequisiteAdd
<CUR_MOD, MODS...>¶ - #include <DataNode.h>
Public Types
-
template<>
usingnext_type
= typename DataModuleRequisiteAdd<MODS...>::type¶
-
template<>
usingthis_req
= typename DataModInfo<CUR_MOD>::reqs¶
-
using
emp::DataModuleRequisiteAdd< CUR_MOD, MODS... >::type = typename next_type::template append<this_req>
-
template<>
-
template <>
template<>
structDataModuleRequisiteAdd
<>¶ - #include <DataNode.h>
Public Types
-
template<>
usingtype
= IntPack<>¶
-
template<>
-
template <typename VAL_TYPE, emp::data... MODS>
classDataNode
: public emp::DataNode_Interface<VAL_TYPE, FormatDataMods<MODS...>::sorted>¶ - #include <DataNode.h>
Public Functions
-
void
Add
()¶
-
template <typename... Ts>
voidAdd
(const VAL_TYPE &val, const Ts&... extras)¶ Methods to provide new data.
-
void
PullData
()¶ Method to retrieve new data.
-
void
Reset
()¶ Methods to reset data.
-
void
PrintCurrent
(std::ostream &os = std::cout) const¶ Methods to Print the templated values that a DataNode can produce.
Private Types
-
template<>
usingparent_t
= DataNode_Interface<VAL_TYPE, typename FormatDataMods<MODS...>::sorted>¶
-
void
-
template <typename VAL_TYPE, int... IMODS>
template<>
classDataNode_Interface
<VAL_TYPE, IntPack<IMODS...>> : public emp::DataNodeModule<VAL_TYPE, (emp::data) IMODS...>¶ - #include <DataNode.h>
Outermost interface to all DataNode modules.
Private Types
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, (emp::data) IMODS...>¶
-
template<>
-
template <typename VAL_TYPE, emp::data... MODS>
classDataNodeModule
¶ - #include <DataNode.h>
Generic form of DataNodeModule (should never be used; trigger error!)
Public Functions
-
DataNodeModule
()
-
-
template <typename VAL_TYPE>
template<>
classDataNodeModule
<VAL_TYPE>¶ - #include <DataNode.h>
Base form of DataNodeModule (available in ALL data nodes.)
Public Types
-
template<>
usingvalue_t
= VAL_TYPE¶
Public Functions
-
DataNodeModule
()
-
size_t
GetCount
() const¶ Return the number of values that have been added to this node since the last reset.
-
size_t
GetResetCount
() const If reset count not tracked, always return 0. If any modifier causes history to be saved, it will override this function and indicate how much history is stored.
-
double
GetTotal
() const
-
double
GetMean
() const
-
double
GetMin
() const
-
double
GetMax
() const
-
double
GetVariance
() const¶
-
double
GetStandardDeviation
() const¶
-
double
GetSkew
() const¶
-
double
GetKurtosis
() const¶
-
void
AddDatum
(const VAL_TYPE &val)
-
void
Reset
()
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Functions
-
void
PullData_impl
()¶
-
template<>
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Archive, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::Archive == This module keeps track of historical values in addition to those added since the last re-set. Every time Reset() is called, all values that have been added since the previous time Reset() are stored in a vector in the archive.
Public Functions
-
DataNodeModule
()
-
const auto &
GetArchive
() const¶ Get all data ever added to this DataNode. Returns a vector of vectors; each vector contains all data from a single time point (interval between resets)
-
const emp::vector<VAL_TYPE> &
GetData
(size_t update) const¶ Get a vector of all data that was added during the.
- Parameters
update
: ‘th interval between resets.
-
const emp::vector<VAL_TYPE> &
GetData
() const Get a vector of all data that has been added since the last reset.
-
size_t
GetResetCount
() const Get the number of time intervals recorded in this DataNode. Note that this is one more than the number of times it has been reset
-
void
Reset
() Reset this DataNode, starting a new grouping of values in the archive. Resetting is useful for tracking data from different time points, such as per update or generation.
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Types
-
template<>
usingthis_t
= DataNodeModule<VAL_TYPE, data::Archive, MODS...>
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Current, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::Current == This module lets you track the current (i.e. most recently added) value
Public Functions
-
DataNodeModule
()
-
const VAL_TYPE &
GetCurrent
() const¶ Return the current (most recently added) value.
-
void
AddDatum
(const VAL_TYPE &val) Add.
- Parameters
val
: to this DataNode
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Types
-
template<>
usingthis_t
= DataNodeModule<VAL_TYPE, data::Current, MODS...>
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>
Protected Attributes
-
VAL_TYPE
cur_val
¶ Most recent value passed to this node.
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::FullRange, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::FullRange == This module makes the DataNode store a history of distributional information measured by data::Range beteen calls to Reset(). Series of historical values are stored in vectors (except mean, which is calculated from total and count).
Public Functions
-
DataNodeModule
()
-
double
GetTotal
() const Get the sum of all values added to this DataNode since the last reset.
-
double
GetMean
() const Get the mean of all values added to this DataNode since the last reset.
-
double
GetMin
() const Get the minimum of all values added to this DataNode since the last reset.
-
double
GetMax
() const Get the maximum of all values added to this DataNode since the last reset.
-
double
GetTotal
(size_t update) const¶ Get the sum of all values added to this DataNode during the.
- Parameters
update
: specified.
-
double
GetMean
(size_t update) const¶ Get the mean of all values added to this DataNode during the.
- Parameters
update
: specified.
-
double
GetMin
(size_t update) const¶ Get the minimum of all values added to this DataNode during the.
- Parameters
update
: specified.
-
double
GetMax
(size_t update) const¶ Get the maximum of all values added to this DataNode during the.
- Parameters
update
: specified.
-
size_t
GetResetCount
() const Get the number of time intervals recorded in this DataNode. Note that this is one more than the number of times it has been reset
-
void
Reset
() Store the current range statistics in the archive and reset for a new interval.
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Types
-
template<>
usingthis_t
= DataNodeModule<VAL_TYPE, data::FullRange, MODS...>
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Histogram, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::Histogram == Make the DataNode track a histogram of values observed since the last reset.
Public Functions
-
DataNodeModule
()
-
VAL_TYPE
GetHistMin
() const¶ Returns the minimum value this histogram is capable of containing (i.e. the minimum value for the first bin)
-
VAL_TYPE
GetHistMax
() const¶ Returns the maximum value this histogram is capable of containing (i.e. the maximum value for the last bin)
-
size_t
GetHistCount
(size_t bin_id) const¶ Return the count of items in the.
- Parameters
bin_id
: ‘th bin of the histogram
-
double
GetHistWidth
(size_t bin_id) const¶ Return the width of the.
- Parameters
bin_id
: ‘th bin of the histogram
-
const emp::vector<size_t> &
GetHistCounts
() const¶ Return a vector containing the count of items in each bin of the histogram.
-
emp::vector<double>
GetBinMins
() const¶ Return a vector containing the lowest value allowed in each bin.
-
void
SetupBins
(VAL_TYPE _min, VAL_TYPE _max, size_t num_bins)¶ Sets up the ranges of values that go in each bin of the histogram.
- Parameters
_min
: - the lowest value allowed in the histogram_max
: - the largest value allowed in the histogramnum_bins
: - The number of bins the histogram should have. The distance between min and max will be easily divided among this many bins.
-
void
AddDatum
(const VAL_TYPE &val) Add.
- Parameters
val
: to the DataNode
-
void
Reset
() Reset the DataNode (empties the historgram)
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Types
-
template<>
usingthis_t
= DataNodeModule<VAL_TYPE, data::Histogram, MODS...>
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Info, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::Info == This module adds information such as a name, description, and keyword for this node.
Public Functions
-
DataNodeModule
()
-
void
SetInfo
(const std::string &_n, const std::string &_d = "", const std::string &_k = "") Set this DataNode’s name to.
- Parameters
_ndescription
: to_dand
: keyword to_k
:
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Types
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Log, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::Log == This module lets you log all of the values that have been added since the last re-set
Public Functions
-
DataNodeModule
()
-
const emp::vector<VAL_TYPE> &
GetData
() const Get a vector of all data added since the last reset.
-
void
AddDatum
(const VAL_TYPE &val) Add.
- Parameters
val
: to this DataNode
-
void
Reset
() Reset this DataNode (clear the current log of data)
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Types
-
template<>
usingthis_t
= DataNodeModule<VAL_TYPE, data::Log, MODS...>
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Pull, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::Pull == This module makes it possible to give the DataNode a function that it can call to calculate new values or sets of values that it will then track. These functions are called every time the PullData method is called on this node, and the values they return are measured as specified by the other modules in this node.
Public Functions
-
DataNodeModule
()
-
void
AddPull
(const std::function<VAL_TYPE()> &fun)
-
void
PrintDebug
(std::ostream &os = std::cout)
Protected Types
-
template<>
usingthis_t
= DataNodeModule<VAL_TYPE, data::Pull, MODS...>
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>
Protected Functions
-
void
PullData_impl
()
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Range, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::Range == This module allows this DataNode to store information (min, max, mean, count, and total) about the distribution of the values that have been added since the last call to Reset().
Public Functions
-
DataNodeModule
()
-
double
GetTotal
() const Get the sum of all values added to this DataNode since the last reset.
-
double
GetMean
() const Get the mean of all values added to this DataNode since the last reset.
-
double
GetMin
() const Get the min of all values added to this DataNode since the last reset.
-
double
GetMax
() const Get the max of all values added to this DataNode since the last reset.
-
void
AddDatum
(const VAL_TYPE &val) Add.
- Parameters
val
: to this DataNode
-
void
Reset
() Reset DataNode, setting the running calucluations of total, min, mean, and max to 0.
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Types
-
template<>
usingthis_t
= DataNodeModule<VAL_TYPE, data::Range, MODS...>
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>
-
-
template <typename VAL_TYPE, emp::data... MODS>
template<>
classDataNodeModule
<VAL_TYPE, data::Stats, MODS...> : public emp::DataNodeModule<VAL_TYPE, MODS...> - #include <DataNode.h>
== data::Stats == Note: These statistics are calculated with the assumption that the data this node has recieved is the entire population of measurements we’re interested in, not a sample.
Note 2: Kurtosis is calculated using Snedecor and Cochran (1967)’s formula. A perfect normal distribution has a kurtosis of 0.
Public Functions
-
DataNodeModule
()
-
double
GetVariance
() const Get the variance (squared deviation from the mean) of values added since the last reset.
-
double
GetStandardDeviation
() const Get the standard deviation of values added since the last reset.
-
double
GetSkew
() const Get the skewness of values added since the last reset. This measurement tells you about the shape of the distribution. For a unimodal distribution, negative skew means that the distribution has a longer/thicker tail to the left. Positive skew means that ths distribution has a longer/thicker tail to the right.
-
double
GetKurtosis
() const Get the kurtosis of the values added since the last reset. This is another measurement that describes the shape of the distribution. High kurtosis means that there is more data in the tails of the distribution (i.e. the tails are “heavier”), whereas low kurtosis means that there is less data in the tails. We use Snedecor and Cochran (1967)’s formula to calculate kurtosis. Under this formula, a normal distribution has kurtosis of 0.
-
void
AddDatum
(const VAL_TYPE &val) Add.
- Parameters
val
: to this DataNode
-
void
Reset
() Reset this node (resets current stats to 0)
-
void
PrintDebug
(std::ostream &os = std::cout) Print debug information (useful for figuring out which modifiers you included)
Protected Types
-
template<>
usingthis_t
= DataNodeModule<VAL_TYPE, data::Stats, MODS...>
-
template<>
usingparent_t
= DataNodeModule<VAL_TYPE, MODS...>
-
template<>
usingbase_t
= DataNodeModule<VAL_TYPE>
-
-
template <emp::data... MODS>
structFormatDataMods
¶ - #include <DataNode.h>
A template that will determing requisites, sort, make unique the data mods provided. The final, sorted IntPack of the requisites plus originals is in ‘sorted’.
DataManagers¶
DataManager handles a set of DataNode objects with the same tracking settings.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2017-2018
-
namespace
emp
¶ If we are in emscripten, make sure to include the header.
This file contains extra analysis tools to use with systematics managers that have non-null DATA_TYPES.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2018
This file contains functions for adding additional data files to Worlds.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2018
-
template <typename VAL_TYPE, emp::data... MODS>
classDataManager
¶ - #include <DataManager.h>
DataManagers handle sets of DataNode objects that all have the same tracking settings.
Public Functions
-
DataManager
()¶
-
~DataManager
()¶
-
size_t
GetSize
() const¶ Returns the number of DataNodes in this DataManager.
-
auto &
GetNodes
() const¶ Returns the std::map mapping node names (strings) to DataNodes.
-
node_t &
New
(const std::string &name)¶ Creates and adds a new DataNode, with the name specified in.
- Parameters
name.
:
-
void
Delete
(const std::string &name)¶ Deletes the DataNode with the name
- Parameters
name.
: Throws an error if there is no node with that name in this manager.
-
const node_t &
Get
(const std::string &name) const¶ Returns a const reference to the node named
- Parameters
name.
: Throws an error if there is no node with that name in this manager
-
node_t &
Get
(const std::string &name)¶ Returns a reference to the node named
- Parameters
name.
: Throws an error if there is no node with that name in this manager
-
template <typename... Ts>
voidAddData
(const std::string &name, Ts... extra)¶ Adds data to a node in the DataManager.
Example:
- Parameters
name
: is the node to add the data to. All subsequent arguments are the data to add to that node, and should be of whatever type all of the nodes in this maanger expect.
DataManager<int, data::Current, data::Range> my_data_manager; my_data_manager.Add(“my_node_name”); my_data_manager.AddData(“my_node_name”, 1, 2, 3, 4, 5);
-
void
ResetAll
()¶ Resets all nodes in this manager. For nodes without the data::Archive attribute, this clears all of their data except current. For nodes with the data::Archive attribute, this creates a new vector to start storing data, retaining the old one in the archive.
Private Types
-
template<>
usingdata_t
= VAL_TYPE¶
-
DataInterfaces¶
DataInterface is a generic interface to a DataNode.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2016-2018
-
namespace
emp
If we are in emscripten, make sure to include the header.
This file contains extra analysis tools to use with systematics managers that have non-null DATA_TYPES.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2018
This file contains functions for adding additional data files to Worlds.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2018
Functions
-
template <typename VAL_TYPE, emp::data... EXTRA>
DataInterface *MakeDataInterface
()¶
-
class
DataInterface
¶ - #include <DataInterface.h>
A generic interface to a DataNode (so that you don’t need to know the node’s exact type)
Subclassed by emp::DataInterface_Impl< VAL_TYPE, EXTRA >
Public Functions
-
virtual
~DataInterface
()¶
-
virtual size_t
GetCount
() const = 0¶
-
virtual size_t
GetResetCount
() const = 0¶
-
virtual double
GetTotal
() const = 0¶
-
virtual double
GetMean
() const = 0¶
-
virtual double
GetMin
() const = 0¶
-
virtual double
GetMax
() const = 0¶
-
virtual double
GetVariance
() const = 0¶
-
virtual double
GetStandardDeviation
() const = 0¶
-
virtual double
GetSkew
() const = 0¶
-
virtual double
GetKurtosis
() const = 0¶
-
virtual void
PullData
() = 0¶
-
virtual void
Reset
() = 0¶
-
virtual void
GetName
() = 0¶
-
virtual void
GetDescription
() = 0¶
-
virtual void
GetKeyword
() = 0¶
-
virtual
-
template <typename VAL_TYPE, emp::data... EXTRA>
classDataInterface_Impl
: public emp::DataInterface¶ - #include <DataInterface.h>
Public Functions
-
DataInterface_Impl
()¶
-
DataInterface_Impl
(node_t *n)¶
-
DataInterface_Impl
(const DataInterface_Impl&)¶
-
DataInterface_Impl
(DataInterface_Impl&&)¶
-
~DataInterface_Impl
()¶
-
DataInterface_Impl &
operator=
(const DataInterface_Impl&)¶
-
DataInterface_Impl &
operator=
(DataInterface_Impl&&)¶
-
size_t
GetCount
() const¶ Returns the number values added to this node since the last reset.
-
size_t
GetResetCount
() const¶ Returns the number of times this node has been reset.
-
double
GetTotal
() const¶ Returns the sum of values added since the last reset. Requires that the data::Range or data::FullRange be added to the DataNode
-
double
GetMean
() const¶ Returns the mean of the values added since the last reset. Requires that the data::Range or data::FullRange be added to the DataNode
-
double
GetMin
() const¶ Returns the minimum of the values added since the last reset. Requires that the data::Range or data::FullRange be added to the DataNode
-
double
GetMax
() const¶ Returns the maximum of the values added since the last reset. Requires that the data::Range or data::FullRange be added to the DataNode
-
double
GetVariance
() const¶ Returns the variance of the values added since the last reset. Requires that the data::Stats or data::FullStats be added to the DataNode
-
double
GetStandardDeviation
() const¶ Returns the standard deviation of the values added since the last reset. Requires that the data::Stats or data::FullStats be added to the DataNode
-
double
GetSkew
() const¶ Returns the skewness of the values added since the last reset. Requires that the data::Stats or data::FullStats be added to the DataNode
-
double
GetKurtosis
() const¶ Returns the kurtosis of the values added since the last reset. Requires that the data::Stats or data::FullStats be added to the DataNode
-
void
PullData
()¶ Runs the Pull function for this DataNode and records the resulting values. Requires that the data::Pull module was added to this DataNode, and that a pull function was specified.
-
void
Reset
()¶ Reset this node. The exact effects of this depend on the modules that this node has, but in general it prepares the node to recieve a new set of data.
-
void
PrintDebug
(std::ostream &os = std::cout)¶ Print debug information about this node to
- Parameters
os.
: Useful for tracking which modifiers are included.
-
void
GetName
()¶ Returns this node’s name. Requires that the data::Info module was added to this DataNode, and that a name was set.
-
void
GetDescription
()¶ Returns this node’s description. Requires that the data::Info module was added to this DataNode, and that a description was set.
-
void
GetKeyword
()¶ Returns this node’s keyword. Requires that the data::Info module was added to this DataNode, and that a keyword was set.
-
DataFiles¶
DataFile objects use DataNode objects to dynamically fill out file contents.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2016-2018
-
namespace
emp
If we are in emscripten, make sure to include the header.
This file contains extra analysis tools to use with systematics managers that have non-null DATA_TYPES.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2018
This file contains functions for adding additional data files to Worlds.
- Note
- This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
- Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
- 2018
Functions
-
template <typename CONTAINER>
ContainerDataFile<CONTAINER>MakeContainerDataFile
(std::function<CONTAINER(void)> fun, const std::string &filename, const std::string &b = "", const std::string &s = ",", const std::string &e = "n", )¶ Convenience function for building a container data file.
- Parameters
fun
: is the function to call to update the container
-
template <typename CONTAINER>
classContainerDataFile
: public emp::DataFile¶ - #include <DataFile.h>
Sometimes you may want a data file where a set of functions is run on every item in a container every time you write to the file. ContainerDataFiles do that.
Note: CONTAINER type can be a pointer to a container and the datafile will handle derefeferencing it appropriately.
Public Functions
-
ContainerDataFile
(const std::string &filename, const std::string &b = "", const std::string &s = ",", const std::string &e = "n")¶
-
~ContainerDataFile
()¶
-
void
SetUpdateContainerFun
(const fun_update_container_t fun)¶ Tell this file what function to run to update the contents of the container that data is being calculated on.
-
void
PrintHeaderKeys
()¶ Print a header containing the name of each column.
-
void
PrintHeaderComment
(const std::string &cstart = "# ")¶ Print a header containing comments describing all of the columns.
-
const container_t
GetCurrentRows
() const¶
-
void
OutputLine
(const data_t d)¶
-
void
Update
()¶ Run all of the functions and print the results as a new line in the file.
-
void
Update
(size_t update)¶ Update the file with an additional set of lines.
-
size_t
Add
(const std::function<void(std::ostream&, data_t)> &fun, const std::string &key, const std::string &desc, )¶ If a function takes an ostream, pass in the correct one. Generic function for adding a column to the DataFile. In practice, you probably want to call one of the more specific ones.
-
template <typename T>
size_tAddContainerFun
(const std::function<T(const data_t)> &fun, const std::string &key = "", const std::string &desc = "", )¶ Add a function that returns a value to be printed to the file.
-
const std::string &
GetLineBegin
() const¶ Returns the string that is printed at the beginning of each line.
-
const std::string &
GetSpacer
() const¶ Returns the string that is printed between elements on each line (i.e. the delimeter).
-
void
SetTiming
(time_fun_t fun)¶ Provide a timing function with a bool(size_t update) signature. The timing function is called with the update, and returns a bool to indicate if files should print this update.
-
void
SetTimingOnce
(size_t print_time)¶ Setup this file to print only once, at the specified update. Note that this timing function can be replaced at any time, even after being triggered.
-
void
SetTimingRepeat
(size_t step)¶ Setup this file to print every ‘step’ updates.
-
void
SetTimingRange
(size_t first, size_t step, size_t last)¶ Setup this file to print only in a specified time range, and a given frequency (step).
-
void
SetSpacer
(const std::string &_in)¶ Print.
- Parameters
_in
: between elements (i.e. make_in
: the delimeter).
-
void
SetupLine
(const std::string &b, const std::string &s, const std::string &e)¶ Set line begin character (.
- Parameters
b)column
: delimeter (s)and
: line end character (e)
:
-
size_t
Add
(const std::function<void(std::ostream&)> &fun, const std::string &key, const std::string &desc, )¶ If a function takes an ostream, pass in the correct one. Generic function for adding a column to the DataFile. In practice, you probably want to call one of the more specific ones.
-
template <typename T>
size_tAddFun
(const std::function<T()> &funconst std::string &key = "", const std::string &desc = "", )¶ Add a function that returns a value to be printed to the file.
-
template <typename T>
size_tAddVar
(const T &var, const std::string &key = "", const std::string &desc = "")¶ Add a function that always prints the current value of.
- Parameters
var.
:
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddCurrent
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the current value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Current modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddMean
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the mean value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddTotal
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the total value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddMin
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the minimum value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddMax
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the maximum value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddVariance
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the variance from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddStandardDeviation
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the standard deviation from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddSkew
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the skewness from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddKurtosis
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the kurtosis from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.
-
template <typename VAL_TYPE, emp::data... MODS>
voidAddStats
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add multiple functions that pull common stats measurements (mean, variance, min, and max) from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Stats or data::FullStats modifier.key
: anddesc
: will have the name of the stat appended to the beginning. Note: excludes standard deviation, because it is easily calculated from variance
-
template <typename VAL_TYPE, emp::data... MODS>
voidAddAllStats
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add multiple functions that pull all stats measurements (mean, variance, min, max, skew, and kurtosis) from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.key
: anddesc
: will have the name of the stat appended to the beginning. Note: excludes standard deviation, because it is easily calculated from variance
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddHistBin
(DataNode<VAL_TYPE, MODS...> &node, size_t bin_id, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the count of the
- Parameters
bin_id
: ‘th bin of the histogram fromnode.
: Requires thatnode
: have the data::Histogram modifier and at least bins. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddInferiority
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the inferiority (mean divided by max) from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
Protected Types
-
template<>
usingraw_container_t
= typename remove_ptr_type<container_t>::type¶
-
template<>
usingdata_t
= typename raw_container_t::value_type¶
-
template<>
usingfun_update_container_t
= std::function<container_t(void)>¶
Protected Attributes
-
fun_update_container_t
update_container_fun
¶
-
container_t
current_rows
¶
-
FunctionSet<container_fun_t>
container_funs
¶
-
time_fun_t
timing_fun
¶ Function to determine updates to print on (default: all)
-
-
class
DataFile
¶ - #include <DataFile.h>
Keep track of everything associated with periodically printing data to a file. Maintain a set of functions for calculating the desired measurements at each point in time that they are required. It also handles the formating of the file.
Subclassed by emp::ContainerDataFile< CONTAINER >
Public Functions
-
DataFile
(const std::string &in_filename, const std::string &b = "", const std::string &s = ",", const std::string &e = "n")¶
-
DataFile
(std::ostream &in_os, const std::string &b = "", const std::string &s = ",", const std::string &e = "n")¶
-
virtual
~DataFile
()¶
-
const std::string &
GetLineBegin
() const¶ Returns the string that is printed at the beginning of each line.
-
const std::string &
GetSpacer
() const¶ Returns the string that is printed between elements on each line (i.e. the delimeter).
-
void
SetTiming
(time_fun_t fun)¶ Provide a timing function with a bool(size_t update) signature. The timing function is called with the update, and returns a bool to indicate if files should print this update.
-
void
SetTimingOnce
(size_t print_time)¶ Setup this file to print only once, at the specified update. Note that this timing function can be replaced at any time, even after being triggered.
-
void
SetTimingRepeat
(size_t step)¶ Setup this file to print every ‘step’ updates.
-
void
SetTimingRange
(size_t first, size_t step, size_t last)¶ Setup this file to print only in a specified time range, and a given frequency (step).
-
void
SetSpacer
(const std::string &_in)¶ Print.
- Parameters
_in
: between elements (i.e. make_in
: the delimeter).
-
void
SetupLine
(const std::string &b, const std::string &s, const std::string &e)¶ Set line begin character (.
- Parameters
b)column
: delimeter (s)and
: line end character (e)
:
-
virtual void
PrintHeaderKeys
()¶ Print a header containing the name of each column.
-
virtual void
PrintHeaderComment
(const std::string &cstart = "# ")¶ Print a header containing comments describing all of the columns.
-
virtual void
Update
()¶ Run all of the functions and print the results as a new line in the file.
-
void
Update
(size_t update)¶ If Update is called with an update number, call the full version of update only if the update value passes the timing function (that is, the timing function returns true).
-
size_t
Add
(const std::function<void(std::ostream&)> &fun, const std::string &key, const std::string &desc, ) If a function takes an ostream, pass in the correct one. Generic function for adding a column to the DataFile. In practice, you probably want to call one of the more specific ones.
-
template <typename T>
size_tAddFun
(const std::function<T()> &funconst std::string &key = "", const std::string &desc = "", ) Add a function that returns a value to be printed to the file.
-
template <typename T>
size_tAddVar
(const T &var, const std::string &key = "", const std::string &desc = "")¶ Add a function that always prints the current value of.
- Parameters
var.
:
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddCurrent
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the current value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Current modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddMean
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the mean value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddTotal
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the total value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddMin
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the minimum value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddMax
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the maximum value from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddVariance
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the variance from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddStandardDeviation
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the standard deviation from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddSkew
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the skewness from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddKurtosis
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the kurtosis from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.
-
template <typename VAL_TYPE, emp::data... MODS>
voidAddStats
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add multiple functions that pull common stats measurements (mean, variance, min, and max) from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Stats or data::FullStats modifier.key
: anddesc
: will have the name of the stat appended to the beginning. Note: excludes standard deviation, because it is easily calculated from variance
-
template <typename VAL_TYPE, emp::data... MODS>
voidAddAllStats
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add multiple functions that pull all stats measurements (mean, variance, min, max, skew, and kurtosis) from the DataNode
- Parameters
node
: Requires thatnode
: have the data::Stats or data::FullStats modifier.key
: anddesc
: will have the name of the stat appended to the beginning. Note: excludes standard deviation, because it is easily calculated from variance
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddHistBin
(DataNode<VAL_TYPE, MODS...> &node, size_t bin_id, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the count of the
- Parameters
bin_id
: ‘th bin of the histogram fromnode.
: Requires thatnode
: have the data::Histogram modifier and at least bins. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
-
template <typename VAL_TYPE, emp::data... MODS>
size_tAddInferiority
(DataNode<VAL_TYPE, MODS...> &node, const std::string &key = "", const std::string &desc = "", const bool &reset = false, const bool &pull = false)¶ Add a function that always pulls the inferiority (mean divided by max) from the DataNode
- Parameters
node.
: Requires thatnode
: have the data::Range or data::FullRange modifier. Ifreset
: is set true, we will call Reset on that DataNode after pulling the current value from the node
Protected Attributes
-
time_fun_t
timing_fun
¶ Function to determine updates to print on (default: all)
-
-
namespace
internal
¶ -
template <typename container_t>
structupdate_impl
¶ - #include <DataFile.h>
Public Functions
-
void
Update
(ContainerDataFile<container_t> *df)¶
-
void
-
template <typename container_t>
template<>
structupdate_impl
<container_t *>¶ - #include <DataFile.h>
Public Functions
-
void
Update
(ContainerDataFile<container_t *> *df)¶
-
void
-
template <typename container_t>
template<>
structupdate_impl
<Ptr<container_t>>¶ - #include <DataFile.h>
Public Functions
-
void
Update
(ContainerDataFile<Ptr<container_t>> *df)¶
-
void
-
template <typename container_t>