anml.data package

Submodules

Data Specifications

Gives data specifications that are used in Data.

A Data class can be subclassed for use in applications that have other standard columns outside of the three default

exception DataSpecCompatibilityError[source]

Bases: anml.exceptions.ANMLError

Error raised when the data specs are not compatible with the data frame to be used.

class DataSpecs(col_obs, col_obs_se=None, col_groups=None)[source]

Bases: object

col_groups: List[str] = None
col_obs: str
col_obs_se: str = None

Data Management

Data is managed and processed using Data with specifications provided through one or more instances of DataSpecs.

class Data(data_specs=None, param_set=None)[source]

Bases: object

A data manager that takes data as inputs along with data specs and transforms into primitive types for use in the optimization.

Parameters
  • data_specs (Union[DataSpecs, List[DataSpecs], None]) – A data specification object, or list of data specification objects that indicate what the columns of a data frame represent.

  • param_set (Union[ParameterSet, List[ParameterSet], None]) – A parameter set that has covariate specifications, or list of these sets.

data

A dictionary of numpy ndarrays keyed by the column attribute in _data_specs, extracted from the data frame after doing self.process_data(). If _data_specs has multiple elements, then the values will be a list of numpy ndarrays, in the order of _data_specs.

covariates
property data_spec_col_attributes
detach_data_specs()[source]

Remove existing data specs.

detach_param_set()[source]

Remove existing parameter set.

property multi_param_set
property multi_spec
process_data(df)[source]

Process a data frame and attach to this instance with existing data specs.

Parameters

df (DataFrame) – A pandas.DataFrame with all of the information that the existing data specifications needs.

set_data_specs(data_specs)[source]

Updates the data specifications, or sets them if they are empty.

Parameters

data_specs (Union[DataSpecs, List[DataSpecs]]) – A data specification object, or list of data specification objects that indicate what the columns of a data frame represent.

set_param_set(param_set)[source]
exception DataError[source]

Bases: anml.exceptions.ANMLError

Base error for the data module.

exception DataTypeError[source]

Bases: anml.data.data.DataError

Error raised when the data type is not understood.

exception EmptySpecsError[source]

Bases: anml.data.data.DataError

Error raise when an operation can’t be performed because there are no specifications associated with the Data instance.

Module contents