plexus.data.TestDataCache module

class plexus.data.TestDataCache.TestDataCache(**parameters)

Bases: DataCache

A simple test data cache that generates sample data for testing purposes.

Initialize the DataCache instance with the given parameters.

Parameters

**parametersdict

Arbitrary keyword arguments that are used to initialize the Parameters instance.

Raises

ValidationError

If the provided parameters do not pass validation.

class Parameters(*, class_name: str = 'DataCache', num_rows: int = 100, columns: list = ['text', 'label'])

Bases: Parameters

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

columns: list
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

num_rows: int
__init__(**parameters)

Initialize the DataCache instance with the given parameters.

Parameters

**parametersdict

Arbitrary keyword arguments that are used to initialize the Parameters instance.

Raises

ValidationError

If the provided parameters do not pass validation.

load_dataframe(data=None, fresh=False)

Generate a test dataframe with sample data.

Returns

pd.DataFrame

A test dataframe with sample text and labels