Skip to content

SR Benchmark

SRToolkit.dataset.sr_benchmark

SR_benchmark

SR_benchmark(benchmark_name: str, base_dir: str, datasets: List[Union[SR_dataset, Tuple[str, SR_dataset]]] = None, augmentation_map: dict = None, metadata: dict = None)

Initializes an instance of the SR_benchmark class.

Parameters:

Name Type Description Default
benchmark_name str

The name of this benchmark.

required
base_dir str

The directory where the datasets will be stored.

required
datasets List[Union[SR_dataset, Tuple[str, SR_dataset]]]

A list of SR_dataset instances or tuples containing the name of the dataset and an instance of SR_dataset. When name of the dataset is not provided, the dataset will be named 'benchmark_name'_'index of dataset in the list + 1'

None
augmentation_map dict

A dictionary mapping augmenter names to their respective classes.

None
metadata dict

An optional dictionary containing metadata about this benchmark. This could include information such as the name of the benchmark, a citation for the benchmark, number of datasets, etc.

None

Raises:

Type Description
Exception

If elements in the "datasets" argument are not instances of SR_dataset or tuples containing the name of the dataset and an instance of SR_dataset.

Source code in SRToolkit/dataset/sr_benchmark.py
def __init__(self, benchmark_name: str, base_dir: str,
             datasets: List[Union[SR_dataset, Tuple[str, SR_dataset]]] = None,
             augmentation_map: dict = None, metadata: dict = None):
    """
    Initializes an instance of the SR_benchmark class.

    Args:
        benchmark_name: The name of this benchmark.
        base_dir: The directory where the datasets will be stored.
        datasets: A list of SR_dataset instances or tuples containing the name of the dataset and an instance of
            SR_dataset. When name of the dataset is not provided, the dataset will be named
            'benchmark_name'_'index of dataset in the list + 1'
        augmentation_map: A dictionary mapping augmenter names to their respective classes.
        metadata: An optional dictionary containing metadata about this benchmark. This could include information
            such as the name of the benchmark, a citation for the benchmark, number of datasets, etc.

    Raises:
        Exception: If elements in the "datasets" argument are not instances of SR_dataset or tuples containing
            the name of the dataset and an instance of SR_dataset.
    """
    self.benchmark_name = benchmark_name
    self.base_dir = base_dir
    if augmentation_map is None:
        self.augmentation_map = RESULT_AUGMENTERS
    self.datasets = {}
    self.metadata = {} if metadata is None else metadata
    if datasets is not None:
        for i, dataset in enumerate(datasets):
            if isinstance(dataset, SR_dataset):
                self.add_dataset_instance(benchmark_name + "_" + str(i+1), dataset)
            elif isinstance(dataset, tuple) and isinstance(dataset[0], str) and isinstance(dataset[1], SR_dataset):
                self.add_dataset_instance(dataset[0], dataset[1])
            else:
                raise ValueError("[SR_benchmark] Dataset inside the datasets argument must be either a tuple "
                                 "(name, SR_dataset) or a SR_dataset instance.")

add_dataset_instance

add_dataset_instance(dataset_name: str, dataset: SR_dataset)

Adds an instance of the SR_dataset class to the benchmark.

Parameters:

Name Type Description Default
dataset_name str

The name of the dataset.

required
dataset SR_dataset

An instance of the SR_dataset class.

required
Source code in SRToolkit/dataset/sr_benchmark.py
def add_dataset_instance(self, dataset_name: str, dataset: SR_dataset):
    """
    Adds an instance of the SR_dataset class to the benchmark.

    Args:
         dataset_name: The name of the dataset.
         dataset: An instance of the SR_dataset class.
    """
    self.datasets[dataset_name]["sr_dataset"] = dataset
    self.datasets[dataset_name]["num_variables"] = dataset.X.shape[1]

add_dataset

add_dataset(dataset: Union[str, array, Tuple[array, array]], symbol_library: SymbolLibrary, dataset_name: Optional[str] = None, ranking_function: str = 'rmse', max_evaluations: int = -1, ground_truth: Optional[Union[List[str], Node, ndarray]] = None, original_equation: Optional[str] = None, success_threshold: Optional[float] = None, result_augmenters: Optional[List[ResultAugmenter]] = None, seed: Optional[int] = None, dataset_metadata: Optional[dict] = None, **kwargs)

Adds a dataset to the benchmark.

Parameters:

Name Type Description Default
dataset Union[str, array, Tuple[array, array]]

Data used in the dataset. Can be: - A string representing the path to a NumPy archive (.npz) containing the dataset. It should either the absolute path to the data, path relative to the base_dir 'base_dir'/'dataset', or empty, in that case the dataset will be loaded from 'base_dir'/'dataset_name'.npz. The .npz file must contain the features (saved in 'X') and if 'rmse' is used as the ranking function, the target (saved in 'y'). - A 2d numpy array containing the features (X). If 'rmse' is used as the ranking function, ground truth should also be provided to calculate the target (y). Once added, the data will be saved at 'base_dir'/'dataset_name'.npz. - A tuple containing the features (X) and the target (y). If 'bed' is used as the ranking function, the target will be ignored. Once added, the data will be saved at 'base_dir'/'dataset_name'.npz.

required
symbol_library SymbolLibrary

The symbol library to use.

required
dataset_name Optional[str]

The name of the dataset. If None, a name will be generated automatically as 'benchmark_name'_'index+1'.

None
ranking_function str

The ranking function used during evaluation. Can be: 'rmse', 'bed'.

'rmse'
max_evaluations int

The maximum number of expressions to evaluate. Less than 0 means no limit.

-1
ground_truth Optional[Union[List[str], Node, ndarray]]

The ground truth expression. Can either a list of symbols, a SRToolkit.utils.Node, or a numpy array representing behavior of an expressions. When 'bed' is used as the ranking function, ground truth must be provided.

None
original_equation Optional[str]

The original equation from which the ground truth expression was generated.

None
success_threshold Optional[float]

The threshold below which the experiment is considered successful. If None, the threshold will be calculated automatically. See SRToolkit.evaluation.SR_evaluator for more details.

None
result_augmenters Optional[List[ResultAugmenter]]

The list of result augmenters to use.

None
seed Optional[int]

The seed to use for random number generation. If None, number generation will be random.

None
dataset_metadata Optional[dict]

An optional dictionary containing metadata about this dataset. This could include information such as the name of the dataset, a citation for the dataset, number of variables, etc.

None

Other Parameters:

Name Type Description
method str

The method to be used for minimization. Currently, only "L-BFGS-B" is supported/tested. Default is "L-BFGS-B".

tol float

The tolerance for termination. Default is 1e-6.

gtol float

The tolerance for the gradient norm. Default is 1e-3.

max_iter int

The maximum number of iterations. Default is 100.

constant_bounds Tuple[float, float]

A tuple of two elements, specifying the lower and upper bounds for the constant values. Default is (-5, 5).

initialization str

The method to use for initializing the constant values. Currently, only "random" and "mean" are supported. "random" creates a vector with random values sampled within the bounds. "mean" creates a vector where all values are calculated as (lower_bound + upper_bound)/2. Default is "random".

max_constants int

The maximum number of constants allowed in the expression. Default is 8.

max_expr_length int

The maximum length of the expression. Default is -1 (no limit).

num_points_sampled int

The number of points to sample when estimating the behavior of an expression. Default is 64. If num_points_sampled==-1, then the number of points sampled is equal to the number of points in the dataset.

bed_X Optional[ndarray]

Points used for BED evaluation. If None and domain_bounds are given, points are sampled from the domain. If None and domain_bounds are not givem, points are randomly selected from X. Default is None.

num_consts_sampled int

Number of constants sampled for BED evaluation. Default is 32.

domain_bounds Optional[List[Tuple[float, float]]]

Bounds for the domain to be used if bed_X is None to sample random points. Default is None.

Source code in SRToolkit/dataset/sr_benchmark.py
def add_dataset(
    self,
    dataset: Union[str, np.array, Tuple[np.array, np.array]],
    symbol_library: SymbolLibrary,
    dataset_name: Optional[str] = None,
    ranking_function: str = "rmse",
    max_evaluations: int = -1,
    ground_truth: Optional[Union[List[str], Node, np.ndarray]] = None,
    original_equation: Optional[str] = None,
    success_threshold: Optional[float] = None,
    result_augmenters: Optional[List[ResultAugmenter]] = None,
    seed: Optional[int] = None,
    dataset_metadata: Optional[dict] = None,
    **kwargs
):
    """
    Adds a dataset to the benchmark.

    Args:
        dataset: Data used in the dataset. Can be:
            - A string representing the path to a NumPy archive (.npz) containing the dataset. It should either
            the absolute path to the data, path relative to the base_dir 'base_dir'/'dataset', or empty, in that
            case the dataset will be loaded from 'base_dir'/'dataset_name'.npz. The .npz file must contain the
            features (saved in 'X') and if 'rmse' is used as the ranking function, the target (saved in 'y').
            - A 2d numpy array containing the features (X). If 'rmse' is used as the ranking function, ground truth
            should also be provided to calculate the target (y). Once added, the data will be saved at
            'base_dir'/'dataset_name'.npz.
            - A tuple containing the features (X) and the target (y). If 'bed' is used as the ranking function,
            the target will be ignored. Once added, the data will be saved at 'base_dir'/'dataset_name'.npz.
        symbol_library: The symbol library to use.
        dataset_name: The name of the dataset. If None, a name will be generated automatically as
            'benchmark_name'_'index+1'.
        ranking_function: The ranking function used during evaluation. Can be: 'rmse', 'bed'.
        max_evaluations: The maximum number of expressions to evaluate. Less than 0 means no limit.
        ground_truth: The ground truth expression. Can either a list of symbols, a SRToolkit.utils.Node, or a
            numpy array representing behavior of an expressions. When 'bed' is used as the ranking function,
            ground truth must be provided.
        original_equation: The original equation from which the ground truth expression was generated.
        success_threshold: The threshold below which the experiment is considered successful. If None, the
            threshold will be calculated automatically. See SRToolkit.evaluation.SR_evaluator for more details.
        result_augmenters: The list of result augmenters to use.
        seed: The seed to use for random number generation. If None, number generation will be random.
        dataset_metadata: An optional dictionary containing metadata about this dataset. This could include
            information such as the name of the dataset, a citation for the dataset, number of variables, etc.

    Keyword Arguments:
        method (str): The method to be used for minimization. Currently, only "L-BFGS-B" is supported/tested.
            Default is "L-BFGS-B".
        tol (float): The tolerance for termination. Default is 1e-6.
        gtol (float): The tolerance for the gradient norm. Default is 1e-3.
        max_iter (int): The maximum number of iterations. Default is 100.
        constant_bounds (Tuple[float, float]): A tuple of two elements, specifying the lower and upper bounds for
            the constant values. Default is (-5, 5).
        initialization (str): The method to use for initializing the constant values. Currently, only "random" and
            "mean" are supported. "random" creates a vector with random values sampled within the bounds. "mean"
            creates a vector where all values are calculated as (lower_bound + upper_bound)/2. Default is "random".
        max_constants (int): The maximum number of constants allowed in the expression. Default is 8.
        max_expr_length (int): The maximum length of the expression. Default is -1 (no limit).
        num_points_sampled (int): The number of points to sample when estimating the behavior of an expression.
            Default is 64. If num_points_sampled==-1, then the number of points sampled is equal to the number of
            points in the dataset.
        bed_X (Optional[np.ndarray]): Points used for BED evaluation. If None and domain_bounds are given, points
            are sampled from the domain. If None and domain_bounds are not givem, points are randomly selected
            from X. Default is None.
        num_consts_sampled (int): Number of constants sampled for BED evaluation. Default is 32.
        domain_bounds (Optional[List[Tuple[float, float]]]): Bounds for the domain to be used if bed_X is None to
            sample random points. Default is None.
    """
    if dataset_name is None:
        dataset_name = f"{self.benchmark_name}_{len(self.datasets)}+1"

    self.datasets[dataset_name] = {}
    self.datasets[dataset_name]["symbol_library"] = symbol_library
    self.datasets[dataset_name]["ranking_function"] = ranking_function
    self.datasets[dataset_name]["max_evaluations"] = max_evaluations

    self.datasets[dataset_name]["success_threshold"] = success_threshold
    self.datasets[dataset_name]["result_augmenters"] = result_augmenters
    self.datasets[dataset_name]["seed"] = seed
    self.datasets[dataset_name]["dataset_metadata"] = copy.deepcopy(self.metadata).update(dataset_metadata)

    self.datasets[dataset_name]["kwargs"] = kwargs
    self.datasets[dataset_name]["original_equation"] = original_equation
    self.datasets[dataset_name]["ground_truth"] = ground_truth

    if ground_truth is None:
        if ranking_function == "bed":
            raise ValueError("[SR_benchmark.add_dataset] For 'bed' ranking, the ground truth must be provided. ")
        else:
            print(f"[SR_benchmark.add_dataset] 'ground_truth' argument not provided. We recommend providing it "
                  f"for more transparent evaluation.")
    else:
        if original_equation is None:
            if isinstance(ground_truth, str):
                self.datasets[dataset_name]["original_equation"] = "y = " + ground_truth
            elif isinstance(ground_truth, list):
                self.datasets[dataset_name]["original_equation"] = "y = " + "".join(ground_truth)

    if isinstance(dataset, str):
        dataset_path = None
        if os.path.exists(dataset):
            dataset_path = dataset
        elif dataset != "" and os.path.exists(f"{self.base_dir}/{dataset}"):
            dataset_path = f"{self.base_dir}/{dataset}"
        elif os.path.exists(f"{self.base_dir}/{dataset_name}.npz"):
            dataset_path = f"{self.base_dir}/{dataset_name}.npz"

        if dataset_path is None:
            error_msg = (
                f"[SR_benchmark.add_dataset] Could not find the dataset file. "
                f"Expected locations:\n"
                f"- Absolute path: '{dataset}'\n"
                f"- Relative to base_dir: '{self.base_dir}/{dataset}'\n"
                f"- NPZ with the name of the dataset in base_dir: '{self.base_dir}/{dataset_name}.npz'"
            )
            raise FileNotFoundError(error_msg)

        self.datasets[dataset_name]["dataset_path"] = dataset_path

        try:
            data = np.load(self.datasets[dataset_name]["dataset_path"], allow_pickle=False)
        except IOError as e:
            error_msg = (
                f"[SR_benchmark.add_dataset] Could not load dataset from path '{self.datasets[dataset_name]}' "
                f"using np.load. The file may be corrupt or not a valid NumPy archive (.npz, .npy). "
                f"Original error: {e}"
            )
            raise IOError(error_msg) from e

        if ranking_function == "rmse":
            if not (isinstance(data, np.lib.npyio.NpzFile) and "X" in data and "y" in data):
                error_msg = (
                    f"[SR_benchmark.add_dataset] For 'rmse' ranking, the dataset file "
                    f"('{self.datasets[dataset_name]['dataset_path']}') must be a .npz NumPy archive containing "
                    f"both 'X' (features) and 'y' (targets). It should be created via `np.savez(path, X=X, y=y)`."
                )
                raise ValueError(error_msg)

        elif ranking_function == "bed":
            if not (isinstance(data, np.lib.npyio.NpzFile) and "X" in data):
                error_msg = (
                    f"[SR_benchmark.add_dataset] For 'bed' ranking, the dataset file "
                    f"('{self.datasets[dataset_name]['dataset_path']}') must be a .npz NumPy archive "
                    f"containing 'X' (features). It should be created via `np.savez(path, X=X)`."
                )
                raise ValueError(error_msg)

        num_variables = data['X'].shape[1]

    elif isinstance(dataset, np.ndarray):
        if ranking_function == "rmse" and ground_truth is not None:
            try:
                expr = expr_to_executable_function(ground_truth, symbol_library)
                y = expr(dataset, None)
            except Exception as e:
                raise Exception(f"[SR_benchmark.add_dataset] Could not evaluate the ground truth. "
                                f"Original error: {e}")
            if not os.path.isdir(self.base_dir):
                os.makedirs(self.base_dir)
            np.savez(f"{self.base_dir}/{dataset_name}.npz", X=dataset, y=y, allow_pickle=False)
        elif ranking_function == "rmse" and ground_truth is None:
            raise ValueError("[SR_benchmark.add_dataset] For 'rmse' ranking, if the dataset argument is a numpy "
                             "array, the ground truth must be provided in order for the target values to be "
                             "calculated.")
        elif ranking_function == "bed":
            if not os.path.isdir(self.base_dir):
                os.makedirs(self.base_dir)
            np.savez(f"{self.base_dir}/{dataset_name}.npz", X=dataset, allow_pickle=False)

        self.datasets[dataset_name]["dataset_path"] = f"{self.base_dir}/{dataset_name}.npz"
        num_variables = dataset.shape[1]

    elif isinstance(dataset, tuple):
        if not isinstance(dataset[0], np.ndarray) or not isinstance(dataset[1], np.ndarray):
            raise ValueError("[SR_benchmark.add_dataset] When dataset argument is provided as a tuple, both "
                             "values must be a numpy array. The first array represents the features ('X'), "
                             "the second array represents the targets ('y').")
        if ranking_function == "bed":
            print(f"[SR_benchmark.add_dataset] 'bed' ranking only utilizes the array with feature. Array with "
                  f"targets will be ignored.")
        if not os.path.isdir(self.base_dir):
            os.makedirs(self.base_dir)
        np.savez(f"{self.base_dir}/{dataset_name}.npz", X=dataset[0], y=dataset[1], allow_pickle=False)
        self.datasets[dataset_name]["dataset_path"] = f"{self.base_dir}/{dataset_name}.npz"
        num_variables = dataset[0].shape[1]

    else:
        raise ValueError("[SR_benchmark.add_dataset] The dataset argument must be a string, a numpy array, "
                         "or a tuple containing two numpy arrays.")

    self.datasets[dataset_name]["num_variables"] = num_variables

create_dataset

create_dataset(dataset_name: str) -> SR_dataset

Creates an instance of a dataset from the given dataset name.

Parameters:

Name Type Description Default
dataset_name str

The name of the dataset to create.

required

Returns:

Type Description
SR_dataset

A SR_dataset instance containing the data, ground truth expression, and metadata for the given dataset.

Raises:

Type Description
ValueError

If the dataset name is not found in the available datasets.

Source code in SRToolkit/dataset/sr_benchmark.py
def create_dataset(self, dataset_name: str) -> SR_dataset:
    """
    Creates an instance of a dataset from the given dataset name.

    Args:
        dataset_name: The name of the dataset to create.

    Returns:
        A SR_dataset instance containing the data, ground truth expression, and metadata for the given dataset.

    Raises:
        ValueError: If the dataset name is not found in the available datasets.
    """
    if dataset_name in self.datasets:
        if "sr_dataset" in self.datasets[dataset_name]:
            return self.datasets[dataset_name]["sr_dataset"]
        else:
            try:
                return SR_dataset.from_dict(self.datasets[dataset_name], self.augmentation_map)
            except Exception as e:
                raise ValueError(f"[SR_benchmark.create_dataset] Could not create SR_dataset from the given "
                                 f"given dictionary. Original error: {e}")

    else:
        raise ValueError(f"Dataset {dataset_name} not found")

list_datasets

list_datasets(verbose=True, num_variables: int = -1) -> List[str]

Lists the available datasets.

Parameters:

Name Type Description Default
verbose bool

If True, also prints out a description of each dataset.

True
num_variables int

If not -1, only show datasets with the given number of variables.

-1

Returns:

Type Description
List[str]

A list of dataset names.

Source code in SRToolkit/dataset/sr_benchmark.py
def list_datasets(self, verbose=True, num_variables: int = -1) -> List[str]:
    """
    Lists the available datasets.

    Args:
        verbose (bool): If True, also prints out a description of each dataset.
        num_variables (int): If not -1, only show datasets with the given number of variables.

    Returns:
        A list of dataset names.
    """
    datasets = [
        dataset_name
        for dataset_name in self.datasets
        if num_variables < 0
        or self.datasets[dataset_name]["num_variables"] == num_variables
    ]
    datasets = sorted(
        datasets,
        key=lambda dataset_name: (
            self.datasets[dataset_name]["num_variables"],
            dataset_name,
        ),
    )

    if verbose:
        # TODO: Make all names be of equal length for nicer output
        for d in datasets:
            if self.datasets[d]["num_variables"] == 1:
                variable_str = "1 variable"
            elif self.datasets[d]["num_variables"] < 1:
                variable_str = "Amount of variables unknown"
            else:
                variable_str = f"{self.datasets[d]['num_variables']} variables"

            print(
                f"{d}:\t{variable_str}, \tExpression: {self.datasets[d]['original_equation']}"
            )
    return datasets

download_benchmark_data staticmethod

download_benchmark_data(url, directory_path)

Downloads a benchmark dataset from the given url to the given directory path.

This function will first check if the directory_path exists. If not, it will create it. Then it will check if the directory_path is empty. If it is not empty, it will not download the data. If it is empty, it will download the data from the given url and extract it to the directory_path.

Parameters:

Name Type Description Default
url str

The url of the benchmark dataset to download.

required
directory_path str

The path of the directory where the dataset should be downloaded.

required
Source code in SRToolkit/dataset/sr_benchmark.py
@staticmethod
def download_benchmark_data(url, directory_path):
    # Check if directory_path exist
    """
    Downloads a benchmark dataset from the given url to the given directory path.

    This function will first check if the directory_path exists. If not, it will create it. Then it will check if the directory_path is empty. If it is not empty, it will not download the data. If it is empty, it will download the data from the given url and extract it to the directory_path.

    Args:
        url (str): The url of the benchmark dataset to download.
        directory_path (str): The path of the directory where the dataset should be downloaded.
    """
    if not os.path.exists(directory_path):
        os.makedirs(directory_path)

    # Check if directory_path is empty
    if not os.listdir(directory_path):
        # Download data from the url to the directory_path
        http_response = urlopen(url)
        zipfile = ZipFile(BytesIO(http_response.read()))
        zipfile.extractall(path=directory_path)

feynman staticmethod

feynman(dataset_directory: str, seed: Optional[int] = None) -> SR_benchmark

Downloads the Feynman benchmark dataset, sets up symbol libraries, and adds predefined datasets to the benchmark.

This method downloads the Feynman benchmark dataset from a specified URL, initializes symbol libraries for symbolic regression with varying numbers of variables, and adds multiple predefined datasets to the benchmark with their respective equations and metadata.

Examples:

>>> benchmark = SR_benchmark.feynman('data/feynman')
>>> for dataset in benchmark.list_datasets(verbose=False):
...     ds = benchmark.create_dataset(dataset)
...     rmse = ds.create_evaluator().evaluate_expr(ds.ground_truth)
...     if rmse > ds.success_threshold:
...         print(f'Failed dataset: {dataset} with RMSE {rmse}')

Parameters:

Name Type Description Default
dataset_directory str

The directory path where the benchmark dataset will be downloaded and stored or where it will be loaded from.

required
seed Optional[int]

The seed to use for the random number generator. If None, the random number generation will not be seeded

None

Returns:

Name Type Description
SR_benchmark SR_benchmark

An instance of the SR_benchmark class containing the predefined datasets.

Source code in SRToolkit/dataset/sr_benchmark.py
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
    @staticmethod
    def feynman(dataset_directory: str, seed: Optional[int] = None) -> "SR_benchmark":
        """
        Downloads the Feynman benchmark dataset, sets up symbol libraries, and adds predefined datasets to the benchmark.

        This method downloads the Feynman benchmark dataset from a specified URL, initializes symbol libraries for
        symbolic regression with varying numbers of variables, and adds multiple predefined datasets to the benchmark
        with their respective equations and metadata.

        Examples:
            >>> benchmark = SR_benchmark.feynman('data/feynman')
            >>> for dataset in benchmark.list_datasets(verbose=False):
            ...     ds = benchmark.create_dataset(dataset)
            ...     rmse = ds.create_evaluator().evaluate_expr(ds.ground_truth)
            ...     if rmse > ds.success_threshold:
            ...         print(f'Failed dataset: {dataset} with RMSE {rmse}')

        Args:
            dataset_directory: The directory path where the benchmark dataset will be downloaded and stored or where
                it will be loaded from.
            seed: The seed to use for the random number generator. If None, the random number generation will not
                be seeded

        Returns:
            SR_benchmark: An instance of the SR_benchmark class containing the predefined datasets.
        """
        url = "https://raw.githubusercontent.com/smeznar/SymbolicRegressionToolkit/master/data/feynman.zip"

        metadata = {"description": "Feynman benchmark containing 100 equations from the domain of physics. "
                                   "Expressions can contain up to 9 variables.",
                    "citation": """@article{Tegmark2020Feynman,
  title={{AI Feynman: A physics-inspired method for symbolic regression}},
  author={Udrescu, Silviu-Marian and Tegmark, Max},
  journal={Science Advances},
  volume={6},
  number={16},
  pages={eaay2631},
  year={2020},
  publisher={American Association for the Advancement of Science}
}
"""
                    }

        SR_benchmark.download_benchmark_data(url, dataset_directory)

        sl_1v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "u-", "sqrt", "sin", "cos", "exp",
                                                "arcsin", "tanh", "ln", "^2", "^3", "pi", "C"], 1)
        sl_2v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "u-", "sqrt", "sin", "cos", "exp",
                                                "arcsin", "tanh", "ln", "^2", "^3", "pi", "C"], 2)
        sl_3v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "u-", "sqrt", "sin", "cos", "exp",
                                                "arcsin", "tanh", "ln", "^2", "^3", "pi", "C"], 3)
        sl_4v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "u-", "sqrt", "sin", "cos", "exp",
                                                "arcsin", "tanh", "ln", "^2", "^3", "pi", "C"], 4)
        sl_5v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "u-", "sqrt", "sin", "cos", "exp",
                                                "arcsin", "tanh", "ln", "^2", "^3", "pi", "C"], 5)
        sl_6v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "u-", "sqrt", "sin", "cos", "exp",
                                                "arcsin", "tanh", "ln", "^2", "^3", "pi", "C"], 6)
        sl_8v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "u-", "sqrt", "sin", "cos", "exp",
                                                "arcsin", "tanh", "ln", "^2", "^3", "pi", "C"], 8)
        sl_9v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "u-", "sqrt", "sin", "cos", "exp",
                                                "arcsin", "tanh", "ln", "^2", "^3", "pi", "C"], 9)

        benchmark = SR_benchmark("feynman", dataset_directory)
        benchmark.metadata = metadata
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.16.6",
            ranking_function="rmse",
            max_evaluations=100000,
            ground_truth = ["(", "X_2", "+","X_1",")","/","(","1","+","(","X_2","*","X_1",")","/","(","X_0","^2",")",")"], # noqa: F401
            original_equation="v1 = (u+v)/(1+u*v/c^2)",
            success_threshold=1e-7,
            result_augmenters=[],
            seed = seed,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            max_expression_length=50,
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.15.4",
            ranking_function="rmse",
            ground_truth = ["u-", "X_0", "*", "X_1", "*", "cos", "(", "X_2", ")"], # noqa: F401
            original_equation="E_n = -mom*B*cos(theta)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.27.16",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_2", "^2"], # noqa: F401
            original_equation="flux = epsilon*c*Ef^2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_6v,
            dataset_name="I.11.19",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_3", "+", "X_1", "*", "X_4", "+", "X_2", "*", "X_5"], # noqa: F401
            original_equation="A = x1*y1+x2*y2+x3*y3",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.15.3x",
            ranking_function="rmse",
            ground_truth = ["(", "X_0", "-", "X_1", "*", "X_3", ")", "/", "sqrt", "(", "1", "-", "X_1", "^2", "/", "X_2", "^2", ")"], # noqa: F401
            original_equation="x1 = (x-u*t)/sqrt(1-u^2/c^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.10.7",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "sqrt", "(", "1", "-", "X_1", "^2", "/", "X_2", "^2", ")"], # noqa: F401
            original_equation="m = m_0/sqrt(1-v^2/c^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_9v,
            dataset_name="I.9.18",
            ranking_function="rmse",
            ground_truth = ["X_2", "*", "X_0", "*", "X_1", "/", "(", "(", "X_4", "-", "X_3", ")", "^2", "+", "(", "X_6", "-", "X_5", ")", "^2", "+", "(", "X_8", "-", "X_7", ")", "^2", ")"], # noqa: F401
            original_equation="F = G*m1*m2/((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.15.3t",
            ranking_function="rmse",
            ground_truth = ["(", "X_3", "-", "X_2", "*", "X_0", "/", "X_1", "^2", ")", "/", "sqrt", "(", "1", "-", "X_2", "^2", "/", "X_1", "^2", ")"], # noqa: F401
            original_equation="t1 = (t-u*x/c^2)/sqrt(1-u^2/c^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_8v,
            dataset_name="II.36.38",
            ranking_function="rmse",
            ground_truth = ["(", "X_0", "*", "X_1", ")", "/", "(", "X_2", "*", "X_3", ")", "+", "(", "(", "X_0", "*", "X_4", ")", "/", "(", "X_5", "*", "X_6", "^2", "*", "X_2", "*", "X_3", ")", ")", "*", "X_7"], # noqa: F401
            original_equation="f = mom*H/(kb*T)+(mom*alpha)/(epsilon*c**2*kb*T)*M",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.43.43",
            ranking_function="rmse",
            ground_truth = ["(", "1", "/", "(", "X_0", "-", "1", ")", ")", "*", "X_1", "*", "X_3", "/", "X_2"], # noqa: F401
            original_equation="kappa = 1/(gamma-1)*kb*v/A",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.15.5",
            ranking_function="rmse",
            ground_truth = ["u-", "X_0", "*", "X_1", "*", "cos", "(", "X_2", ")"], # noqa: F401
            original_equation="E_n = -p_d*Ef*cos(theta)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.37.4",
            ranking_function="rmse",
            ground_truth = ["X_0", "+", "X_1", "+", "2", "*", "sqrt", "(", "X_0", "*", "X_1", ")", "*", "cos", "(", "X_2", ")"], # noqa: F401
            original_equation="Int = I1+I2+2*sqrt(I1*I2)*cos(delta)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="II.6.11",
            ranking_function="rmse",
            ground_truth = ["(", "1", "/", "(", "4", "*", "pi", "*", "X_0", ")", ")", "*", "X_1", "*", "cos", "(", "X_2", ")", "/", "X_3", "^2"], # noqa: F401
            original_equation="Volt = 1/(4*pi*epsilon)*p_d*cos(theta)/r^2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="III.7.38",
            ranking_function="rmse",
            ground_truth = ["2", "*", "X_0", "*", "X_1", "/", "(", "X_2", "/", "(", "2", "*", "pi", ")", ")"], # noqa: F401
            original_equation="omega = 2*mom*B/(h/(2*pi))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.34.2a",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "/", "(", "2", "*", "pi", "*", "X_2", ")"], # noqa: F401
            original_equation="l = q*v/(2*pi*r)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.13.23",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "sqrt", "(", "1", "-", "X_1", "^2", "/", "X_2", "^2", ")"], # noqa: F401
            original_equation="rho_c = rho_c_0/sqrt(1-v^2/c^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.29.4",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "X_1"], # noqa: F401
            original_equation="k = omega/c",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.38.12",
            ranking_function="rmse",
            ground_truth = ["4", "*", "pi", "*", "X_3", "*", "(", "X_2", "/", "(", "2", "*", "pi", ")", ")", "^2", "/", "(", "X_0", "*", "X_1", "^2", ")"], # noqa: F401
            original_equation="r = 4*pi*epsilon*(h/(2*pi))^2/(m*q^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="III.15.27",
            ranking_function="rmse",
            ground_truth = ["2", "*", "pi", "*", "X_0", "/", "(", "X_1", "*", "X_2", ")"], # noqa: F401
            original_equation="k = 2*pi*alpha/(n*d)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="I.41.16",
            ranking_function="rmse",
            ground_truth = ["(", "X_2", "/", "(", "2", "*", "pi", ")", ")", "*", "X_0", "^3", "/", "(", "pi", "^2", "*", "X_4", "^2", "*", "(", "exp", "(", "(", "X_2", "/", "(", "2", "*", "pi", ")", ")", "*", "X_0", "/", "(", "X_3", "*", "X_1", ")", ")", "-", "1", ")", ")"], # noqa: F401
            original_equation="L_rad = h/(2*pi)*omega^3/(pi^2*c^2*(exp((h/(2*pi))*omega/(kb*T))-1))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.48.20",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_2", "^2", "/", "sqrt", "(", "1", "-", "X_1", "^2", "/", "X_2", "^2", ")"], # noqa: F401
            original_equation="E_n = m*c^2/sqrt(1-v^2/c^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="II.11.20",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "^2", "*", "X_2", "/", "(", "3", "*", "X_3", "*", "X_4", ")"], # noqa: F401
            original_equation="Pol = n_rho*p_d^2*Ef/(3*kb*T)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.25.13",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "X_1"], # noqa: F401
            original_equation="Volt = q/C",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="III.15.12",
            ranking_function="rmse",
            ground_truth = ["2", "*", "X_0", "*", "(", "1", "-", "cos", "(", "X_1", "*", "X_2", ")", ")"], # noqa: F401
            original_equation="E_n = 2*U*(1-cos(k*d))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.24.6",
            ranking_function="rmse",
            ground_truth = ["0.25", "*", "X_0", "*", "(", "X_1", "^2", "+", "X_2", "^2", ")", "*", "X_3", "^2"], # noqa: F401
            original_equation="E_n = 1/2*m*(omega^2+omega_0^2)*1/2*x^2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.34.27",
            ranking_function="rmse",
            ground_truth = ["(", "X_1", "/", "(", "2", "*", "pi", ")", ")", "*", "X_0"], # noqa: F401
            original_equation="E_n =(h/(2*pi))*omega",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.43.31",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_2", "*", "X_1"], # noqa: F401
            original_equation="D = mob*kb*T",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.29.16",
            ranking_function="rmse",
            ground_truth = ["sqrt", "(", "X_0", "^2", "+", "X_1", "^2", "-", "2", "*", "X_0", "*", "X_1", "*", "cos", "(", "X_2", "-", "X_3", ")", ")"], # noqa: F401
            original_equation="x = sqrt(x1^2+x2^2-2*x1*x2*cos(theta1-theta2))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.18.4",
            ranking_function="rmse",
            ground_truth = ["(", "X_0", "*", "X_2", "+", "X_1", "*", "X_3", ")", "/", "(", "X_0", "+", "X_1", ")"], # noqa: F401
            original_equation="r = (m1*r1+m2*r2)/(m1+m2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_6v,
            dataset_name="II.6.15a",
            ranking_function="rmse",
            ground_truth = ["(", "X_1", "/", "(", "4", "*", "pi", "*", "X_0", ")", ")", "*", "(", "3", "*", "X_5", "/", "(", "X_2", "^2", "*", "X_2", "^3", ")", ")", "*", "sqrt", "(", "X_3", "^2", "+", "X_4", "^2", ")"], # noqa: F401
            original_equation="Ef = p_d/(4*pi*epsilon)*3*z/r^5*sqrt(x^2+y^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.30.3",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "sin", "(", "X_2", "*", "X_1", "/", "2", ")", "^2", "/", "sin", "(", "X_1", "/", "2", ")", "^2"], # noqa: F401
            original_equation="Int = Int_0*sin(n*theta/2)^2/sin(theta/2)^2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_6v,
            dataset_name="III.9.52",
            ranking_function="rmse",
            ground_truth = ["(", "X_0", "*", "X_1", "*", "X_2", "/", "(", "X_3", "/", "(", "2", "*", "pi", ")", ")", ")", "*", "sin", "(", "(", "X_4", "-", "X_5", ")", "*", "X_2", "/", "2", ")", "^2", "/", "(", "(", "X_4", "-", "X_5", ")", "*", "X_2", "/", "2", ")", "^2"], # noqa: F401
            original_equation="prob = (p_d*Ef*t/(h/(2*pi)))*sin((omega-omega_0)*t/2)^2/((omega-omega_0)*t/2)^2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.34.2",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_2", "/", "2"], # noqa: F401
            original_equation="mom = q*v*r/2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.39.11",
            ranking_function="rmse",
            ground_truth = ["(", "1", "/", "(", "X_0", "-", "1", ")", ")", "*", "X_1", "*", "X_2"], # noqa: F401
            original_equation="E_n = (1/(gamma-1))*pr*V",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="II.11.28",
            ranking_function="rmse",
            ground_truth = ["1", "+", "X_0", "*", "X_1", "/", "(", "1", "-", "(", "X_0", "*", "X_1", "/", "3", ")", ")"], # noqa: F401
            original_equation="theta = 1+n*alpha/(1-(n*alpha/3))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="II.3.24",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "(", "4", "*", "pi", "*", "X_1", "^2", ")"], # noqa: F401
            original_equation="flux = Pwr/(4*pi*r^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.24.17",
            ranking_function="rmse",
            ground_truth = ["sqrt", "(", "X_0", "^2", "/", "X_1", "^2", "-", "pi", "^2", "/", "X_2", "^2", ")"], # noqa: F401
            original_equation="k = sqrt(omega^2/c^2-pi^2/d^2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="II.13.17",
            ranking_function="rmse",
            ground_truth = ["(", "1", "/", "(", "4", "*", "pi", "*", "X_0", "*", "X_1", "^2", ")", ")", "*", "2", "*", "X_2", "/", "X_3"], # noqa: F401
            original_equation="B = 1/(4*pi*epsilon*c^2)*2*I/r",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.12.5",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1"], # noqa: F401
            original_equation="F = q2*Ef",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="II.35.18",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "(", "exp", "(", "X_3", "*", "X_4", "/", "(", "X_1", "*", "X_2", ")", ")", "+", "exp", "(", "u-", "X_3", "*", "X_4", "/", "(", "X_1", "*", "X_2", ")", ")", ")"], # noqa: F401
            original_equation="n_0/(exp(mom*B/(kb*T))+exp(-mom*B/(kb*T)))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="II.34.11",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_2", "/", "(", "2", "*", "X_3", ")"], # noqa: F401
            original_equation="g_*q*B/(2*m)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.34.29a",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "/", "(", "4", "*", "pi", "*", "X_2", ")"], # noqa: F401
            original_equation="q*h/(4*pi*m)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_6v,
            dataset_name="I.32.17",
            ranking_function="rmse",
            ground_truth = ["(", "0.5", "*", "X_0", "*", "X_1", "*", "X_2", "^2", ")", "*", "(", "8", "*", "pi", "*", "X_3", "^2", "/", "3", ")", "*", "(", "(", "X_4", "^2", "*", "X_4", "^2", ")", "/", "(", "X_4", "^2", "-", "X_5", "^2", ")", "^2", ")"], # noqa: F401
            original_equation="(1/2*epsilon*c*Ef**2)*(8*pi*r**2/3)*(omega**4/(omega**2-omega_0**2)**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="II.35.21",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "tanh", "(", "X_1", "*", "X_2", "/", "(", "X_3", "*", "X_4", ")", ")"], # noqa: F401
            original_equation="n_rho*mom*tanh(mom*B/(kb*T))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="I.44.4",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_2", "*", "ln", "(", "X_4", "/", "X_3", ")"], # noqa: F401
            original_equation="n*kb*T*ln(V2/V1)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="III.4.32",
            ranking_function="rmse",
            ground_truth = ["1", "/", "(", "exp", "(", "(", "X_0", "/", "(", "2", "*", "pi", ")", ")", "*", "X_1", "/", "(", "X_2", "*", "X_3", ")", ")", "-", "1", ")"], # noqa: F401
            original_equation="1/(exp((h/(2*pi))*omega/(kb*T))-1)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.10.9",
            ranking_function="rmse",
            ground_truth = ["(", "X_0", "/", "X_1", ")", "*", "1", "/", "(", "1", "+", "X_2", ")"], # noqa: F401
            original_equation="sigma_den/epsilon*1/(1+chi)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="II.38.3",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_3", "/", "X_2"], # noqa: F401
            original_equation="Y*A*x/d",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.6.2b",
            ranking_function="rmse",
            ground_truth = ["exp", "(", "u-", "(", "(", "(", "X_1", "-", "X_2", ")", "/", "X_0", ")", "^2", ")", "/", "2", ")", "/", "(", "sqrt", "(", "2", "*", "pi", ")", "*", "X_0", ")"], # noqa: F401
            original_equation="exp(-((theta-theta1)/sigma)**2/2)/(sqrt(2*pi)*sigma)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="II.8.31",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "^2", "/", "2"], # noqa: F401
            original_equation="epsilon*Ef**2/2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_1v,
            dataset_name="I.6.2a",
            ranking_function="rmse",
            ground_truth = ["exp", "(", "u-", "X_0", "^2", "/", "2", ")", "/", "sqrt", "(", "2", "*", "pi", ")"], # noqa: F401
            original_equation="exp(-theta**2/2)/sqrt(2*pi)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="III.12.43",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "(", "X_1", "/", "(", "2", "*", "pi", ")", ")"], # noqa: F401
            original_equation="n*(h/(2*pi))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="III.17.37",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "(", "1", "+", "X_1", "*", "cos", "(", "X_2", ")", ")"], # noqa: F401
            original_equation="beta*(1+alpha*cos(theta))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="III.10.19",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "sqrt", "(", "X_1", "^2", "+", "X_2", "^2", "+", "X_3", "^2", ")"], # noqa: F401
            original_equation="mom*sqrt(Bx**2+By**2+Bz**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_6v,
            dataset_name="II.11.7",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "(", "1", "+", "X_4", "*", "X_5", "*", "cos", "(", "X_3", ")", "/", "(", "X_1", "*", "X_2", ")", ")"], # noqa: F401
            original_equation="n_0*(1+p_d*Ef*cos(theta)/(kb*T))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.39.1",
            ranking_function="rmse",
            ground_truth = ["1.5", "*", "X_0", "*", "X_1"], # noqa: F401
            original_equation="3/2*pr*V",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.37.1",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "(", "1", "+", "X_2", ")", "*", "X_1"], # noqa: F401
            original_equation="mom*(1+chi)*B",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.12.4",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_2", "/", "(", "4", "*", "pi", "*", "X_1", "*", "X_2", "^3", ")"], # noqa: F401
            original_equation="q1*r/(4*pi*epsilon*r**3)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="II.27.18",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "^2"], # noqa: F401
            original_equation="epsilon*Ef**2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.12.2",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_3", "/", "(", "4", "*", "pi", "*", "X_2", "*", "X_3", "^3", ")"], # noqa: F401
            original_equation="q1*q2*r/(4*pi*epsilon*r**3)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="III.13.18",
            ranking_function="rmse",
            ground_truth = ["2", "*", "X_0", "*", "X_1", "^2", "*", "X_2", "/", "(", "X_3", "/", "(", "2", "*", "pi", ")", ")"], # noqa: F401
            original_equation="2*E_n*d**2*k/(h/(2*pi))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="II.11.3",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "/", "(", "X_2", "*", "(", "X_3", "^2", "-", "X_4", "^2", ")", ")"], # noqa: F401
            original_equation="q*Ef/(m*(omega_0**2-omega**2))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_6v,
            dataset_name="I.40.1",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "exp", "(", "u-", "X_1", "*", "X_4", "*", "X_2", "/", "(", "X_5", "*", "X_3", ")", ")"], # noqa: F401
            original_equation="n_0*exp(-m*g*x/(kb*T))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="III.21.20",
            ranking_function="rmse",
            ground_truth = ["u-", "X_0", "*", "X_1", "*", "X_2", "/", "X_3"], # noqa: F401
            original_equation="-rho_c_0*q*A_vec/m",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.43.16",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_2", "/", "X_3"], # noqa: F401
            original_equation="mu_drift*q*Volt/d",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.15.10",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "/", "sqrt", "(", "1", "-", "X_1", "^2", "/", "X_2", "^2", ")"], # noqa: F401
            original_equation="m_0*v/sqrt(1-v**2/c**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.30.5",
            ranking_function="rmse",
            ground_truth = ["arcsin", "(", "X_0", "/", "(", "X_2", "*", "X_1", ")", ")"], # noqa: F401
            original_equation="arcsin(lambd/(n*d))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.50.26",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "(", "cos", "(", "X_1", "*", "X_2", ")", "+", "X_3", "*", "cos", "(", "X_1", "*", "X_2", ")", "^2", ")"], # noqa: F401
            original_equation="x1*(cos(omega*t)+alpha*cos(omega*t)**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="I.12.11",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "(", "X_1", "+", "X_2", "*", "X_3", "*", "sin", "(", "X_4", ")", ")"], # noqa: F401
            original_equation="q*(Ef+B*v*sin(theta))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.6.2",
            ranking_function="rmse",
            ground_truth = ["exp", "(", "u-", "(", "(", "X_1", "/", "X_0", ")", "^2", ")", "/", "2", ")", "/", "(", "sqrt", "(", "2", "*", "pi", ")", "*", "X_0", ")"], # noqa: F401
            original_equation="exp(-(theta/sigma)**2/2)/(sqrt(2*pi)*sigma)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.14.4",
            ranking_function="rmse",
            ground_truth = ["0.5", "*", "X_0", "*", "X_1", "^2"], # noqa: F401
            original_equation="1/2*k_spring*x**2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.47.23",
            ranking_function="rmse",
            ground_truth = ["sqrt", "(", "X_0", "*", "X_1", "/", "X_2", ")"], # noqa: F401
            original_equation="sqrt(gamma*pr/rho)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.8.7",
            ranking_function="rmse",
            ground_truth = ["0.6", "*", "X_0", "^2", "/", "(", "4", "*", "pi", "*", "X_1", "*", "X_2", ")"], # noqa: F401
            original_equation="3/5*q**2/(4*pi*epsilon*d)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="III.15.14",
            ranking_function="rmse",
            ground_truth = ["(", "X_0", "/", "(", "2", "*", "pi", ")", ")", "^2", "/", "(", "2", "*", "X_1", "*", "X_2", "^2", ")"], # noqa: F401
            original_equation="(h/(2*pi))**2/(2*E_n*d**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.34.14",
            ranking_function="rmse",
            ground_truth = ["(", "(", "1", "+", "(", "X_1", "/", "X_0", ")", ")", "/", "sqrt", "(", "1", "-", "X_1", "^2", "/", "X_0", "^2", ")", ")", "*", "X_2"], # noqa: F401
            original_equation="((1+v/c)/sqrt(1-v**2/c**2))*omega_0",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="III.8.54",
            ranking_function="rmse",
            ground_truth = ["sin", "(", "X_0", "*", "X_1", "/", "(", "X_2", "/", "(", "2", "*", "pi", ")", ")", ")", "^2"], # noqa: F401
            original_equation="sin(E_n*t/(h/(2*pi)))**2",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.26.2",
            ranking_function="rmse",
            ground_truth = ["arcsin", "(", "X_0", "*", "sin", "(", "X_1", ")", ")"], # noqa: F401
            original_equation="arcsin(n*sin(theta2))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="III.19.51",
            ranking_function="rmse",
            ground_truth = ["(", "u-", "X_0", "*", "(", "X_1", "^2", "*", "X_1", "^2", ")", "/", "(", "(", "2", "*", "(", "4", "*", "pi", "*", "X_4", ")", "^2", ")", "*", "(", "X_2", "/", "(", "2", "*", "pi", ")", ")", "^2", ")", "*", "(", "1", "/", "X_3", "^2", ")", ")"], # noqa: F401
            original_equation="-m*q**4/(2*(4*pi*epsilon)**2*(h/(2*pi))**2)*(1/n**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="III.4.33",
            ranking_function="rmse",
            ground_truth = ["(", "X_0", "/", "(", "2", "*", "pi", ")", ")", "*", "X_1", "/", "(", "exp", "(", "(", "X_0", "/", "(", "2", "*", "pi", ")", ")", "*", "X_1", "/", "(", "X_2", "*", "X_3", ")", ")", "-", "1", ")"], # noqa: F401
            original_equation="(h/(2*pi))*omega/(exp((h/(2*pi))*omega/(kb*T))-1)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.34.1",
            ranking_function="rmse",
            ground_truth = ["X_2", "/", "(", "1", "-", "X_1", "/", "X_0", ")"], # noqa: F401
            original_equation="omega_0/(1-v/c)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="II.11.27",
            ranking_function="rmse",
            ground_truth = ["(", "X_0", "*", "X_1", "/", "(", "1", "-", "(", "X_0", "*", "X_1", "/", "3", ")", ")", ")", "*", "X_2", "*", "X_3"], # noqa: F401
            original_equation="n*alpha/(1-(n*alpha/3))*epsilon*Ef",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.13.34",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "/", "sqrt", "(", "1", "-", "X_1", "^2", "/", "X_2", "^2", ")"], # noqa: F401
            original_equation="rho_c_0*v/sqrt(1-v**2/c**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="II.4.23",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "(", "4", "*", "pi", "*", "X_1", "*", "X_2", ")"], # noqa: F401
            original_equation="q/(4*pi*epsilon*r)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.32.5",
            ranking_function="rmse",
            ground_truth = ["X_0", "^2", "*", "X_1", "^2", "/", "(", "6", "*", "pi", "*", "X_2", "*", "X_3", "^3", ")"], # noqa: F401
            original_equation="q**2*a**2/(6*pi*epsilon*c**3)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="I.13.12",
            ranking_function="rmse",
            ground_truth = ["X_4", "*", "X_0", "*", "X_1", "*", "(", "1", "/", "X_3", "-", "1", "/", "X_2", ")"], # noqa: F401
            original_equation="G*m1*m2*(1/r2-1/r1)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="II.2.42",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "(", "X_2", "-", "X_1", ")", "*", "X_3", "/", "X_4"], # noqa: F401
            original_equation="kappa*(T2-T1)*A/d",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.27.6",
            ranking_function="rmse",
            ground_truth = ["1", "/", "(", "1", "/", "X_0", "+", "X_2", "/", "X_1", ")"], # noqa: F401
            original_equation="1/(1/d1+n/d2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="III.14.14",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "(", "exp", "(", "X_1", "*", "X_2", "/", "(", "X_3", "*", "X_4", ")", ")", "-", "1", ")"], # noqa: F401
            original_equation="I_0*(exp(q*Volt/(kb*T))-1)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.18.12",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "sin", "(", "X_2", ")"], # noqa: F401
            original_equation="r*F*sin(theta)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.18.14",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_2", "*", "sin", "(", "X_3", ")"], # noqa: F401
            original_equation="m*r*v*sin(theta)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="II.21.32",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "(", "4", "*", "pi", "*", "X_1", "*", "X_2", "*", "(", "1", "-", "X_3", "/", "X_4", ")", ")"], # noqa: F401
            original_equation="q/(4*pi*epsilon*r*(1-v/c))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="II.38.14",
            ranking_function="rmse",
            ground_truth = ["X_0", "/", "(", "2", "*", "(", "1", "+", "X_1", ")", ")"], # noqa: F401
            original_equation="Y/(2*(1+sigma))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.34.8",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_2", "/", "X_3"], # noqa: F401
            original_equation="q*v*B/p",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.8.14",
            ranking_function="rmse",
            ground_truth = ["sqrt", "(", "(", "X_1", "-", "X_0", ")", "^2", "+", "(", "X_3", "-", "X_2", ")", "^2", ")"], # noqa: F401
            original_equation="sqrt((x2-x1)**2+(y2-y1)**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="II.6.15b",
            ranking_function="rmse",
            ground_truth = ["(", "X_1", "/", "(", "4", "*", "pi", "*", "X_0", ")", ")", "*", "3", "*", "cos", "(", "X_2", ")", "*", "sin", "(", "X_2", ")", "/", "X_3", "^3"], # noqa: F401
            original_equation="p_d/(4*pi*epsilon)*3*cos(theta)*sin(theta)/r**3",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_2v,
            dataset_name="I.12.1",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1"], # noqa: F401
            original_equation="mu*Nn",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_5v,
            dataset_name="II.34.29b",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_3", "*", "X_4", "*", "X_2", "/", "(", "X_1", "/", "(", "2", "*", "pi", ")", ")"], # noqa: F401
            original_equation="g_*mom*B*Jz/(h/(2*pi))",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.13.4",
            ranking_function="rmse",
            ground_truth = ["0.5", "*", "X_0", "*", "(", "X_1", "^2", "+", "X_2", "^2", "+", "X_3", "^2", ")"], # noqa: F401
            original_equation="1/2*m*(v**2+u**2+w**2)",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_4v,
            dataset_name="I.39.22",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_3", "*", "X_1", "/", "X_2"], # noqa: F401
            original_equation="n*kb*T/V",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )
        benchmark.add_dataset(
            "",
            sl_3v,
            dataset_name="I.14.3",
            ranking_function="rmse",
            ground_truth = ["X_0", "*", "X_1", "*", "X_2"], # noqa: F401
            original_equation="m*g*z",
            max_evaluations=100000,
            max_expression_length=50,
            success_threshold=1e-7,
            dataset_metadata=benchmark.metadata,
            constant_range=[-5.0, 5.0],
            result_augmenters=[],
            seed = seed
        )

        return benchmark

nguyen staticmethod

nguyen(dataset_directory: str, seed: Optional[int] = None) -> SR_benchmark

Downloads and initializes the Nguyen benchmark datasets for symbolic regression.

This method downloads the Nguyen symbolic regression benchmark datasets from a specified URL and initializes a set of datasets using a provided dataset directory. It creates two symbol libraries for equations with one variable and two variables, respectively, and populates the benchmark with various Nguyen equations, each represented with its symbolic tokens and associated symbol library.

Examples:

>>> benchmark = SR_benchmark.nguyen('data/nguyen')
>>> for dataset in benchmark.list_datasets(verbose=False):
...     ds = benchmark.create_dataset(dataset)
...     rmse = ds.create_evaluator().evaluate_expr(ds.ground_truth)
...     if rmse > ds.success_threshold:
...         print(f'Failed dataset: {dataset} with RMSE {rmse}')

Parameters:

Name Type Description Default
dataset_directory str

The directory path where the benchmark dataset will be downloaded and stored or where it will be loaded from.

required
seed Optional[int]

The seed to use for the random number generator. If None, the random number generation will not be seeded

None

Returns:

Name Type Description
SR_benchmark SR_benchmark

An initialized SR_benchmark instance containing the Nguyen datasets.

Source code in SRToolkit/dataset/sr_benchmark.py
    @staticmethod
    def nguyen(dataset_directory: str, seed: Optional[int] = None) -> "SR_benchmark":
        """
        Downloads and initializes the Nguyen benchmark datasets for symbolic regression.

        This method downloads the Nguyen symbolic regression benchmark datasets from a specified URL
        and initializes a set of datasets using a provided dataset directory. It creates two symbol libraries
        for equations with one variable and two variables, respectively, and populates the benchmark with various
        Nguyen equations, each represented with its symbolic tokens and associated symbol library.

        Examples:
            >>> benchmark = SR_benchmark.nguyen('data/nguyen')
            >>> for dataset in benchmark.list_datasets(verbose=False):
            ...     ds = benchmark.create_dataset(dataset)
            ...     rmse = ds.create_evaluator().evaluate_expr(ds.ground_truth)
            ...     if rmse > ds.success_threshold:
            ...         print(f'Failed dataset: {dataset} with RMSE {rmse}')

        Args:
            dataset_directory: The directory path where the benchmark dataset will be downloaded and stored or where
                it will be loaded from.
            seed: The seed to use for the random number generator. If None, the random number generation will not
                be seeded

        Returns:
            SR_benchmark: An initialized SR_benchmark instance containing the Nguyen datasets.
        """
        url = "https://raw.githubusercontent.com/smeznar/SymbolicRegressionToolkit/master/data/nguyen.zip"
        SR_benchmark.download_benchmark_data(url, dataset_directory)
        # we create a SymbolLibrary with 1 and with 2 variables
        # Each library contains +, -, *, /, sin, cos, exp, log, sqrt, ^2, ^3
        sl_1v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "sin", "cos", "exp", "log", "sqrt", "^2", "^3"], 1)
        sl_2v = SymbolLibrary.from_symbol_list(["+", "-", "*", "/", "sin", "cos", "exp", "log", "sqrt", "^2", "^3"], 2)

        metadata = {"description": "Symbolic regression benchmark with 10 expressions that don't contain constant "
                                   "parameters. First 4 are polynomials of different degrees. First eight expressions "
                                   "contain 1 variable, last two expressions contain two variables. This benchmark "
                                   "doesn't contain the original data, only expressions",
                    "citation": """@article{Uy2011,
    author={Uy, Nguyen Quang and Hoai, Nguyen Xuan and O'Neill, Michael and McKay, R. I. and Galv{\'a}n-L{\'o}pez, Edgar},
    title={Semantically-based crossover in genetic programming: application to real-valued symbolic regression},
    journal={Genetic Programming and Evolvable Machines},
    year={2011},
    month={Jun},
    day={01},
    volume={12},
    number={2},
    pages={91-119},
}"""}

        # Add datasets to the benchmark
        benchmark = SR_benchmark("Nguyen", dataset_directory, metadata=metadata)
        benchmark.add_dataset(
			"",
			sl_1v,
			dataset_name="NG-1",
			ranking_function="rmse",
			ground_truth = ["X_0", "+", "X_0", "^2", "+", "X_0", "^3"], # noqa: F401
			original_equation="x+x^2+x^3",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_1v,
			dataset_name="NG-2",
			ranking_function="rmse",
			ground_truth = ["X_0", "+", "X_0", "^2", "+", "X_0", "^3", "+", "X_0", "*", "X_0", "^3"], # noqa: F401
			original_equation="x+x^2+x^3+x^4",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_1v,
			dataset_name="NG-3",
			ranking_function="rmse",
			ground_truth = ["X_0", "+", "X_0", "^2", "+", "X_0", "^3", "+", "X_0", "*", "X_0", "^3", "+", "X_0", "^2", "*", "X_0", "^3"], # noqa: F401
			original_equation="x+x^2+x^3+x^4+x^5",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_1v,
			dataset_name="NG-4",
			ranking_function="rmse",
			ground_truth = ["X_0", "+", "X_0", "^2", "+", "X_0", "^3", "+", "X_0", "*", "X_0", "^3", "+", "X_0", "^2", "*", "X_0", "^3", "+", "X_0", "^3", "*", "X_0", "^3"], # noqa: F401
			original_equation="x+x^2+x^3+x^4+x^5+x^6",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_1v,
			dataset_name="NG-5",
			ranking_function="rmse",
			ground_truth = ["sin", "(", "X_0", "^2", ")", "*", "cos", "(", "X_0", ")", "-", "1"], # noqa: F401
			original_equation="sin(x^2)*cos(x)-1",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_1v,
			dataset_name="NG-6",
			ranking_function="rmse",
			ground_truth = ["sin", "(", "X_0", ")", "+", "sin", "(", "X_0", "+", "X_0", "^2", ")"], # noqa: F401
			original_equation="sin(x)+sin(x+x^2)",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_1v,
			dataset_name="NG-7",
			ranking_function="rmse",
			ground_truth = ["log", "(", "1", "+", "X_0", ")", "+", "log", "(", "1", "+", "X_0", "^2", ")"], # noqa: F401
			original_equation="log(1+x)+log(1+x^2)",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_1v,
			dataset_name="NG-8",
			ranking_function="rmse",
			ground_truth = ["sqrt", "(", "X_0", ")"], # noqa: F401
			original_equation="sqrt(x)",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_2v,
			dataset_name="NG-9",
			ranking_function="rmse",
			ground_truth = ["sin", "(", "X_0", ")", "+", "sin", "(", "X_1", "^2", ")"], # noqa: F401
			original_equation="sin(x)+sin(y^2)",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        benchmark.add_dataset(
			"",
			sl_2v,
			dataset_name="NG-10",
			ranking_function="rmse",
			ground_truth = ["2", "*", "sin", "(", "X_0", ")", "*", "cos", "(", "X_1", ")"], # noqa: F401
			original_equation="2*sin(x)*cos(y)",
			max_evaluations=100000,
			max_expression_length=50,
			success_threshold=1e-7,
			dataset_metadata=benchmark.metadata,
			result_augmenters=[],
			seed = seed
		)

        return benchmark