pe.data package

Subpackages

Submodules

pe.data.data module

class pe.data.data.Data(data_frame=None, metadata={})[source]

Bases: object

The class that holds the private data or synthetic data from PE.

__init__(data_frame=None, metadata={})[source]

Constructor.

Parameters:
  • data_frame (pandas.DataFrame, optional) – A pandas dataframe that holds the data, defaults to None

  • metadata (dict, optional) – the metadata of the data, defaults to {}

classmethod concat(data_list, metadata=None)[source]

Concatenate the data frames of a list of data objects

Parameters:
  • data_list (list[pe.data.data.Data]) – The list of data objects to concatenate

  • metadata (dict, optional) – The metadata of the concatenated data. When None, the metadata of the list of data objects must be the same and will be used. Defaults to None

Raises:

ValueError – If the metadata of the data objects are not the same

Returns:

The concatenated data object

Return type:

pe.data.data.Data

filter_label_id(label_id)[source]

Filter the data frame according to a label id

Parameters:

label_id (int) – The label id that is used to filter the data frame

Returns:

pe.data.data.Data object with the filtered data frame

Return type:

pe.data.data.Data

load_checkpoint(path)[source]

Load data from a checkpoint

Parameters:

path (str) – The folder that contains the checkpoint

Returns:

Whether the checkpoint is loaded successfully

Return type:

bool

merge(data)[source]

Merge the data object with another data object

Parameters:

data (pe.data.data.Data) – The data object to merge

Raises:

ValueError – If the metadata of data is not the same as the metadata of the current object

Returns:

The merged data object

Return type:

pe.data.data.Data

random_truncate(num_samples)[source]

Randomly truncate the data frame to a certain number of samples

Parameters:

num_samples (int) – The number of samples to randomly truncate

Returns:

A new pe.data.data.Data object with the randomly truncated data frame

Return type:

pe.data.data.Data

save_checkpoint(path)[source]

Save the data to a checkpoint.

Parameters:

path (str) – The folder to save the checkpoint

Raises:
  • ValueError – If the path is None

  • ValueError – If the data frame is empty

set_label_id(label_id)[source]

Set the label id for the data frame

Parameters:

label_id (int) – The label id to set

truncate(num_samples)[source]

Truncate the data frame to a certain number of samples

Parameters:

num_samples (int) – The number of samples to truncate

Returns:

A new pe.data.data.Data object with the truncated data frame

Return type:

pe.data.data.Data