Dict dataset
Dict-Based Dataset.
References
NONE
DictDataset(dataset, name=None)
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, name=None, **kwargs)
classmethod
Load a dataset from a CSV file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path |
str
|
The path to the CSV file. |
required |
name |
str | None
|
The name of the dataset. |
None
|
**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. |