ResultsDict

class ResultsDict[source]

Bases: UserDict

Class for keeping track of results

__init__(filename, replace=False, lock=True)[source]

initialise empty ResultsDict :param replace: set the replace attribute (default: False)

Methods

__init__

initialise empty ResultsDict :param replace: set the replace attribute (default: False)

clear

contains_dim

equivalent to dim in self['dims']

copy

delete_dim

fromkeys

get

items

keys

load

restore results from file

max

return maximum auc values

min

pop

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem

as a 2-tuple; but raise KeyError if D is empty.

reduce_to_dims

remove all data for dimensions not in dims :param dims: list of dimensions to keep

runs

return the number of runs

save

dump contents to json file

setdefault

update

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

update_dim

update data for given dimension

values

Attributes

replace

if True, updates replace existing data, if False, updates append data

load()[source]

restore results from file

Parameters:
  • filename – input json file

  • replace – set the replace attribute

Returns:

populated ResultsDict

save()[source]

dump contents to json file

Parameters:

filename – output file path

update_dim(dim, replace=False, **kwargs)[source]

update data for given dimension

Parameters:
  • dim – dimension to update

  • auc – new auc value

  • loss – new loss value

  • args – new args data (optional)

if self.contains_dim(dim) == True, behaviour depends on the value of self.replace

delete_dim(dim)[source]
max(field, dim=None)[source]

return maximum auc values

Parameters:
  • field – field to take maximum over

  • dim – if dim=None, return list of values for all dimension, else only return maximum value for dim.

min(field, dim=None)[source]
get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]
contains_dim(dim)[source]

equivalent to dim in self['dims']

reduce_to_dims(dims)[source]

remove all data for dimensions not in dims :param dims: list of dimensions to keep

runs(dim=None)[source]

return the number of runs

Parameters:

dim – if dim is None, return list of number of runs for all dimension, else return number of runs for dimension dim.