dyval.dyval_dataset

class promptbench.dyval.dyval_dataset.DyValDataset(dataset_type, is_trainset=False, num_samples=100, num_nodes_per_sample=10, min_links_per_node=1, max_links_per_node=3, depth=3, num_children_per_node=2, extra_links_per_node=1, add_rand_desc=0, delete_desc=0, add_cycles=0, num_dags=1)

Bases: object

A class for creating and managing datasets for various types of Directed Acyclic Graph (DAG) tasks.

This class can generate datasets for arithmetic, Boolean logic, linear equations, deductive logic, abductive logic, reachability, and max sum path problems using different types of DAGs.

Parameters:

dataset_typestr

The type of dataset to be generated (e.g., ‘arithmetic’, ‘bool_logic’).

is_trainsetbool, optional

Specifies whether the dataset is a training set (default is False).

num_samplesint, optional

The number of samples to generate in the dataset (default is 100).

num_nodes_per_sampleint, optional

The number of nodes per sample (default is 10).

min_links_per_nodeint, optional

The minimum number of links per node (default is 1).

max_links_per_nodeint, optional

The maximum number of links per node (default is 3).

depthint, optional

The depth of the DAG (default is 3).

num_children_per_nodeint, optional

The number of children per node (default is 2).

extra_links_per_nodeint, optional

The number of extra links per node (default is 1).

add_rand_descint, optional

The number of random descriptions to add (default is 0).

delete_descint, optional

The number of descriptions to delete (default is 0).

add_cyclesint, optional

The number of cycles to add to the DAG (default is 0).

num_dagsint, optional

The number of DAGs to generate for linear equations (default is 1).

Methods:

__len__()

Returns the number of samples in the dataset.

__getitem__(key)

Retrieves a specific sample from the dataset.

create_dataset()

Generates the dataset based on the specified parameters.

get_fewshot_examples(shots)

Generates few-shot examples for the dataset.

_generate_sample(**kwargs)

Generates a single sample for the dataset.

create_dataset()
get_fewshot_examples(shots)