module documentation

Tools for (lean) experimentation and collecting data.

See also cma.optimization_tools and cma.utilities.math.test*.

TODO: write some running examples as doctests.

Class ClassFromDict set class attributes from a dict, see also cma.utilities.utils.DictClass2
Class DataDict A (default) dictionary like parameter_value: list_of_measures,
Class Results a container to communicate (changing) results via disk.
Class ResultsPandas WIP ad hoc code for writing (changing) results in a pandas.DataFrame and to disk,
Class TimeWarner context manager to print the time spent iff it exceeds a threshold.
Function copy_file copy src to dest and created dest folder(s) if necessary
Function down_sample return (index, x_down) if y is None, else (x_down, y_down).
Function sp1 return the average of finite entries in data,
Function unique_time_stamp a unique timestamp up to 1/10^decimals seconds
def copy_file(src, dest):

copy src to dest and created dest folder(s) if necessary

def down_sample(x, y=None, len_=500):

return (index, x_down) if y is None, else (x_down, y_down).

Example: plot(*down_sample(mydata))

def sp1(data):

return the average of finite entries in data,

multiplied by the ratio Ndata / Nfinite == len(data) / sum(np.isfinite(data)).

This measure has been called Q-measure or success performance one, sp1. It is computed as the average over all finite entries times the number of all entries divided by the number of finite entries. If all entries are finite this is the average value.

Details: the multiplier operates under the assumption that non-finite entries contribute the same as the average finite entry and resampling can be applied to get a finite entry.

def unique_time_stamp(decimals=2):

a unique timestamp up to 1/10^decimals seconds