Skip to content

Dict dataset

Dict-Based Dataset.

Authors

Surya Mahadi (made.r.s.mahadi@gdplabs.id)

References

NONE

DictDataset(dataset)

Bases: BaseDataset

Dict-Based Dataset.

This class is a subclass of the BaseDataset class. It is used to store a dataset in a dictionary format.

Attributes:

Name Type Description
dataset list[dict]

The dataset to evaluate.

Initialize the DictDataset class.

Parameters:

Name Type Description Default
dataset Dataset

The dataset to use for the evaluation.

required

from_csv(path, **kwargs) classmethod

Load a dataset from a CSV file.

Parameters:

Name Type Description Default
path str

The path to the CSV file.

required
**kwargs Any

Additional arguments to pass to pandas read_csv.

{}

Returns:

Name Type Description
DictDataset DictDataset

The loaded dataset.

from_jsonl(path, **kwargs) classmethod

Load a dataset from a JSONL file.

Parameters:

Name Type Description Default
path str

The path to the JSONL file.

required
**kwargs Any

Additional arguments to pass to the constructor.

{}

Returns:

Name Type Description
DictDataset DictDataset

The loaded dataset.

load()

Load the dataset.

Returns:

Type Description
list[MetricInput]

list[MetricInput]: The loaded dataset.

validate()

Validate the dataset.

Raises:

Type Description
ValueError

If the dataset is not a list of MetricInput.