Giter VIP home page Giter VIP logo

deep-symbolic-optimization's Introduction

Deep Symbolic Optimization

Deep Symbolic Optimization (DSO) is a deep learning framework for symbolic optimization tasks. The package dso includes the core symbolic optimization algorithms, as well as support for two particular symbolic optimization tasks: (1) symbolic regression (recovering tractable mathematical expressions from an input dataset) and (2) discovering symbolic policies for reinforcement learning environments. In the code, these tasks are referred to as regression and control, respectively. We also include a simple interface for defining new tasks.

On symbolic regression, DSO was benchmarked against the SRBench benchmark set and achieves state-of-the-art in both symbolic solution rate and accuracy solution rate:

DSO also won 1st place in the Real-World Track of the 2022 SRBench Symbolic Regression Competition held at the GECCO 2022 conference.

This repository contains code supporting the following publications:

  1. Petersen et al. 2021 Deep symbolic regression: Recovering mathematical expressions from data via risk-seeking policy gradients. ICLR 2021. Oral Paper
  2. Landajuela et al. 2021 Discovering symbolic policies with deep reinforcement learning. ICML 2021. Paper
  3. Mundhenk et al. 2021 Symbolic Regression via Neural-Guided Genetic Programming Population Seeding. NeurIPS 2021 Paper
  4. Landajuela et al. 2022 A Unified Framework for Deep Symbolic Regression. NeurIPS 2022 Paper
  5. Landajuela et al. 2021 Improving exploration in policy gradient search: Application to symbolic optimization. Math-AI @ ICLR 2021. Paper
  6. Kim et al. 2020 An interactive visualization platform for deep symbolic regression. IJCAI 2020. Paper
  7. Petersen et al. 2021 Incorporating domain knowledge into neural-guided search via in situ priors and constraints AutoML @ ICML 2021. Paper
  8. Kim et al. 2021 Distilling Wikipedia mathematical knowledge into neural network models. Math-AI @ ICLR 2021. Paper
  9. Silva et al. 2022 Leveraging Language Models to Efficiently Learn Symbolic Optimization Solutions ALA Workshop 2022. Paper
  10. Glatt et al. 2022 Deep Symbolic Optimization for Electric Component Sizing in Fixed Topology Power Converters AI for Design and Manufacturing (ADAM) @ AAAI 2022. Paper

Installation

Installation - Core package

The core package has been tested on Python3.6+ on Unix and OSX. To install the core package (and the default regression task), we highly recommend first creating a Python 3 virtual environment, e.g.,

python3 -m venv venv3 # Create a Python 3 virtual environment
source venv3/bin/activate # Activate the virtual environment

Then, from the repository root:

pip install --upgrade setuptools pip
export CFLAGS="-I $(python -c "import numpy; print(numpy.get_include())") $CFLAGS" # Needed on Mac to prevent fatal error: 'numpy/arrayobject.h' file not found
pip install -e ./dso # Install DSO package and core dependencies

The regression task is installed by default. It doesn't require any of the installation options below.

Installation - control task

There are a few additional dependencies to run the control task. Install them using:

pip install -e ./dso[control]

Installation - all tasks

To install all dependencies for all tasks, use the all option:

pip install -e ./dso[all]

Getting started

DSO relies on configuring runs via a JSON file, then launching them via a simple command-line or a few lines of Python.

Method 1: Running DSO via command-line interface

After creating your config file, simply run:

python -m dso.run path/to/config.json

After training, results are saved to a timestamped directory in the path given in the "logdir" parameter (default ./log).

Method 2: Running DSO via Python interface

The Python interface lets users instantiate and customize DSO models via Python scripts, an interactive Python shell, or an iPython notebook. The core DSO model is dso.core.DeepSymbolicOptimizer. After creating your config file, you can use:

from dso import DeepSymbolicOptimizer

# Create and train the model
model = DeepSymbolicOptimizer("path/to/config.json")
model.train()

After training, results are saved to a timestamped directory in the path given in config["training"]["logdir"] (default ./log).

Configuring runs

A single JSON file is used to configure each run. This file specifies the symbolic optimization task and all hyperparameters.

Each configuration JSON file has a number of top-level keys that control various parts of the DSO framework. The important top-level keys are:

  • "experiment" configures the experiment, namely the log directory and random number seed.
  • "task" configures the task, e.g., the dataset for symbolic regression, or the Gym environment for the control task. See below for task-specific configuration.
  • "logging" configures the output files for the execution of the algorithm, such as "save_all_iterations" to save detailed statistics for every iteration.
  • "training" configures training hyperparameters like "n_samples" (the total number of samples to generate) and "epsilon" (the risk factor used by the risk-seeking policy gradient).
  • "policy" configures policy hyperparameters like "max_length" and "num_layers".
  • "policy_optimizer" configures policy optimization hyperparameters like "learning_rate" and "optimizer".
  • "gp_meld" configures genetic programming hyperparameters.
  • "prior" configures the priors and constraints on the search space.

Any parameters not included in your config file assume default values found in config/config_common.json, config/config_regression.json (for regression runs), and config/config_control.json (for control runs).

Configuring runs for symbolic regression

Here are simple example contents of a JSON file for the regression task:

{
  "task" : {
    "task_type" : "regression",
    "dataset" : "path/to/my_dataset.csv",
    "function_set" : ["add", "sub", "mul", "div", "sin", "cos", "exp", "log", "poly"]
  }
}

This configures DSO to learn symbolic expressions to fit your custom dataset, using the tokens specified in function_set (see dso/functions.py for a list of supported tokens).

You can test symbolic regression out of the box with a default configuration, after running setup, with a command such as:

python -m dso.run dso/config/config_regression.json --b Nguyen-7

This will run DSO on the regression task with benchmark Nguyen-7.

If you want to include optimized floating-point constants in the search space, simply include "const" in the function_set list. Note that constant optimization uses an inner-optimization loop, which leads to much longer runtimes (~hours instead of ~minutes).

If you want to include the powerful LINEAR token (called poly in the code)--introduced in the unified deep symbolic regression (uDSR) NeurIPS 2022 paper--in the search space, simply include "poly" in the function_set list. Polynomial optimization adds a bit of overhead, but not nearly as much as the const token; thus, we highly recommend this token for most applications.

You can further configure the LINEAR/poly token by adjusting the poly_optimizer_params in the config, for example:

{
  "task" : {
    "task_type" : "regression",
    "dataset" : "path/to/my_dataset.csv",
    "function_set" : ["add", "sub", "mul", "div", "sin", "cos", "exp", "log", "poly"]
    "poly_optimizer_params" : {
      "degree": 3,
      "coef_tol": 1e-6,
      "regressor": "dso_least_squares"
      "regressor_params": {}
    }
  }
}

Within poly_optimizer_params, degree specifies the degree of the polynomials to be fit, coef_tol is a threshold value used to remove terms with sufficiently small coefficients, and regressor is the underlying regressor used to learn the polynomial coefficients. The default regressor is our in-house implementation of least squares called dso_least_squares, which optimizes the fitting process during the expression-learning loop. Other than dso_least_squares, we also support sklearn regressors linear_regression, lasso, and ridge. Depending on the regressor, parameters can be configured through regressor_params.

Configuring runs for learning symbolic control policies

Here's a simple example for the control task:

{
  "task" : {
    "task_type" : "control",
    "env" : "MountainCarContinuous-v0",
    "function_set" : ["add", "sub", "mul", "div", "sin", "cos", "exp", "log", 1.0, 5.0, 10.0]
  }
}

This configures DSO to learn a symbolic policy for MountainCarContinuous-v0, using the tokens specified in function_set (see dso/functions.py for a list of supported tokens).

For environments with multi-dimensional action spaces, DSO requires a pre-trained "anchor" policy. DSO is run once per action dimension, and the "action_spec" parameter is updated each run. For an environment with N action dimesions, "action_spec" is a list of length N. A single element should be null, meaning that is the symbolic action to be learned. Any number of elements can be "anchor", meaning the anchor policy will determine those actions. Any number of elements can be expression traversals (e.g., ["add", "x1", "x2"]), meaning that fixed symbolic policy will determine those actions.

Here's an example workflow for HopperBulletEnv-v0, which has three action dimensions. First, learn a symbolic policy for the first action by running DSO with a config like:

{
  "task" : {
    "task_type" : "control",
    "name" : "HopperBulletEnv-v0",
    "function_set" : ["add", "sub", "mul", "div", "sin", "cos", "exp", "log", 1.0, 5.0, 10.0],
    "action_spec" : [null, "anchor", "anchor"],
    "anchor" : "path/to/anchor.pkl"
  }
}

where "path/to/anchor.pkl" is a path to a stable_baselines model. (The environments used in the ICML paper have default values for anchor, so you do not have to specify one.) After running, let's say the best expression has traversal ["add", "x1", "x2"]. To launch the second round of DSO, update the config's action_spec to use the fixed symbolic policy for the first action, learn a symbolic policy for the second action, and use the anchor again for the third action:

"action_spec" : [["add", "x1", "x2"], null, "anchor"]

After running DSO, say the second action's traversal is ["div", "x3", "x4"]. Finally, update the action_spec to:

"action_spec" : [["add", "x1", "x2"], ["div", "x3", "x4"], null]

and rerun DSO. The final result is a fully symbolic policy.

Configuring runs for learning decision tree policies

DSO can also be configured to learn a decision tree policy. This is done by specifying decision_tree_threshold_set in "task", which is a set of thresholds on the values of state variables when making a decision. In particular, for each threshold tj in decision_tree_threshold_set, StateChecker tokens xi < tj for all state variables xi will be added to the Library.

For example, for MountainCarContinuous-v0, here is an example config:

{
  "task" : {
    "task_type" : "control",
    "env" : "MountainCarContinuous-v0",
    "function_set" : ["add", "sub", "mul", "div", "sin", "cos", "exp", "log", 1.0, 5.0, 10.0]
    "decision_tree_threshold_set" : [-0.05, 0.0, 0.01]
  }
}

Other than the functions specified in function_set, this will also add x1 < -0.05, x1 < 0.0, x1 < 0.01, x2 < -0.05, x2 < 0.0, and x2 < 0.01 to the Library because MountainCarContinuous-v0 has two state variables. With these StateChecker tokens, decision tree policies like "if x1 < -0.05 and x2 < 0.0, the action is exp(x1) + 1.0; otherwise, the action is sin(10 * x2)" can be sampled.

Using the Neural-Guided Genetic Programming Population Seeding Controller

To include the genetic programming inner-loop optimizer introduced in NeurIPS 2021, insert a field in your config for "gp_meld". You can play with the different parameters. The most important part is to set "run_gp_meld" to true.

{
  "gp_meld" : {
    "run_gp_meld" : true,
    "verbose" : false,
    "generations" : 20,
    "p_crossover" : 0.5,
    "p_mutate" : 0.5,
    "tournament_size" : 5,
    "train_n" : 50,
    "mutate_tree_max" : 3,
    "parallel_eval" : true
  }
}

Sklearn interface

The regression task supports an additional sklearn-like regressor interface to make it easy to try out deep symbolic regression on your own data:

from dso import DeepSymbolicRegressor

# Generate some data
np.random.seed(0)
X = np.random.random((10, 2))
y = np.sin(X[:,0]) + X[:,1] ** 2

# Create the model
model = DeepSymbolicRegressor() # Alternatively, you can pass in your own config JSON path

# Fit the model
model.fit(X, y) # Should solve in ~10 seconds

# View the best expression
print(model.program_.pretty())

# Make predictions
model.predict(2 * X)

Analyzing results

Each run of DSO saves a timestamped log directory in config["training"]["logdir"]. Inside this directory is:

  • dso_ExperimentName_0.csv: This file contains batch-wise summary statistics for each epoch. The suffix _0 means the random number seed was 0. (See "Advanced usage" for batch runs with multiple seeds.)
  • dso_ExperimnetName_0_summary.csv: This file contains summary statistics for the entire training run.
  • dso_ExperimnetName_0_hof.csv: This file contains statistics of the "hall of fame" (best sequences discovered during training). Edit `config["training"]["hof"] to set the number of hall-of-famers to record.
  • dso_ExperimnetName_0_pf.csv: This file contains statistics of the Pareto front of sequences discovered during training. This is a reward-complexity front.
  • config.json: This is a "dense" version of the configuration used for your run. It explicitly includes all parameters.

Advanced usage

Batch runs

DSO's command-line interface supports a multiprocessing-parallelized batch mode to run multiple tasks in parallel. This is recommended for large runs. Batch-mode DSO is launched with:

python -m dso.run path/to/config.json [--runs] [--n_cores_task] [--b] [--seed]

The option --runs (default 1) defines how many independent tasks (with different random number seeds) to perform. The regression task is computationally expedient enough to run multiple tasks in parallel. For the control task, we recommend running with the default --runs=1.

The option --n_cores_task (default 1) defines how many parallel processes to use across the --runs tasks. Each task is assigned a single core, so --n_cores_task should be less than or equal to --runs. (To use multiple cores within a single task, i.e., to parallelize reward computation, see the n_cores_batch configuration parameter.)

The option --seed, if provided, will override the parameter "seed" in your config.

By default, DSO will use the task specification found in the configuration JSON. The option --b (default None) is used to specify the named task(s) via command-line. For example, --b=path/to/mydata.csv runs DSO on the given dataset (regression task), and --b=MountainCarContinuous-v0 runs the environment MountainCarContinuous-v0 (control task). This is useful for running benchmark problems.

For example, to train 100 independent runs on the Nguyen-1 benchmark using 12 cores, using seeds 500 through 599:

python -m dso.run --b=Nguyen-1 --runs=100 --n_cores_task=12 --seed=500

Adding custom tasks and priors

DSO supports adding custom tasks and priors from your own modules.

To add new tasks, the task_type keyword in the config file can be used in the following format: <module>.<source>:<function> specifying the source implementing a make_task function.

For example:

{
  "task" : {
    "task_type" : "custom_mod.my_source:make_task"
  }
}

Similarly, new priors can be added by specifying the source where the Prior class can be found in the prior group of the config file.

For example:

 "prior": {
      "uniform_arity" : {
         "on" : true
      },
      "custom_mod.my_source:CustomPrior" : {
         "loc" : 10,
         "scale" : 5,
         "on" : true
      }
  }

Policy optimizers

DSO supports a variety of policy optimizers based the following objective structure:

$$J(\theta) = \sum_{i=1}^N J(\tau; \theta) \text{ with } J(\tau; \theta) \propto \log(p(\tau|\theta)).$$

The objective can be specified by overriding the _set_up method of PolicyOptimizer. Current DSO supports the following policy optimizers:

Policy gradient optimizers

Given a batch $\mathcal{T} = {\tau^{(i)}}_{i=1}^N$ of designs such that $\tau^{(i)} \sim p( \cdot | \theta)\ \forall 1 \leq i \leq N$:

$$\nabla_\theta J_\textrm{pg}(\theta; \varepsilon) \approx \frac{1}{\varepsilon N}\sum_{i=1}^N \left( R(\tau^{(i)}) - b \right) \cdot \mathbf{1}_{R(\tau^{(i)}) \geq \tilde{R}_\varepsilon(\theta) } \nabla_\theta \log p(\tau^{(i)} | \theta)$$

where

$$\tilde{R}_\varepsilon(\theta) = \textrm{Q}_{1-\varepsilon}(\mathcal{T} )$$

(the empirical quantile).

Vanilla policy gradient

We take:

$$b = \textrm{EWMA}_n \text{ with } \textrm{EWMA}(n) = \alpha \bar{R} + (1 - \alpha) \textrm{EWMA}_{n-1} \text{ and }\bar{R} = \frac{1}{N} \sum_{i=1}^N R(\tau)$$ $$\varepsilon = 1.0$$

Configuration:

   training.epsilon: 1.0,
   training.baseline : "ewma_R",
   policy_optimizer.policy_optimizer_type : "pg"

Risk-seeking policy gradient

$$b = \tilde{R}_\varepsilon(\theta)$$ $$\varepsilon = 0.05$$

Configuration:

   training.epsilon: 0.05,
   training.baseline : "R_e",
   policy_optimizer.policy_optimizer_type : "pg"

Priority queue training

Given a maximum reward priority queue (MRPQ):

$$\nabla_\theta J_\textrm{MRPQ}(\theta)= \frac{1}{k}\sum_{\tau\in\textrm{MRPQ}}\nabla_\theta \log p(\tau|\theta)$$

Proximal policy optimization

Given a batch $\mathcal{T} = {\tau^{(i)}}_{i=1}^N$ of designs such that $\tau^{(i)} \sim p( \cdot | \theta) \forall i$:

For $1=1,\dots,K$ do:

$$\theta \leftarrow \theta + \alpha \nabla J_{\text{PPO}}$$

with

$$J_{\text{PPO}} (\theta) =\mathbb{E}_{\tau \sim \mathcal{T}} [ \min (r(\theta) (R(\tau) - b), \text{clip}(r(\theta), 1-\epsilon, 1 + \epsilon) (R(\tau ) - b) ]$$

Code dependency map

The map of core dependencies is depicted here.

Citing this work

To cite this work, please cite the papers according to the most relevant tasks and/or methods.

To cite the regression task, please use:

@inproceedings{petersen2021deep,
  title={Deep symbolic regression: Recovering mathematical expressions from data via risk-seeking policy gradients},
  author={Petersen, Brenden K and Landajuela, Mikel and Mundhenk, T Nathan and Santiago, Claudio P and Kim, Soo K and Kim, Joanne T},
  booktitle={Proc. of the International Conference on Learning Representations},
  year={2021}
}

To cite the control task, please use:

@inproceedings{landajuela2021discovering,
  title={Discovering symbolic policies with deep reinforcement learning},
  author={Landajuela, Mikel and Petersen, Brenden K and Kim, Sookyung and Santiago, Claudio P and Glatt, Ruben and Mundhenk, Nathan and Pettit, Jacob F and Faissol, Daniel},
  booktitle={International Conference on Machine Learning},
  pages={5979--5989},
  year={2021},
  organization={PMLR}
}

To cite the neural-guided genetic programming population seeding method, please use:

@inproceedings{mundhenk2021seeding,
  title={Symbolic Regression via Neural-Guided Genetic Programming Population Seeding},
  author={T. Nathan Mundhenk and Mikel Landajuela and Ruben Glatt and Claudio P. Santiago and Daniel M. Faissol and Brenden K. Petersen},
  booktitle={Advances in Neural Information Processing Systems},
  year={2021}
}

To cite the unified deep symbolic regression (uDSR) method or the LINEAR/poly token, please use:

@inproceedings{landajuela2022unified,
title={A Unified Framework for Deep Symbolic Regression},
  author={Mikel Landajuela and Chak Lee and Jiachen Yang and Ruben Glatt and Claudio P. Santiago and Ignacio Aravena and Terrell N. Mundhenk and Garrett Mulcahy and Brenden K. Petersen},
  booktitle={Advances in Neural Information Processing Systems},
  year={2022}
}

Release

LLNL-CODE-647188

deep-symbolic-optimization's People

Contributors

brendenpetersen avatar f-leno avatar glatt1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep-symbolic-optimization's Issues

About customized task

Hi, I am new to the field of SR and have read your latest paper and am very interested in trying to see if it will work using the SR approach on my own data and task.

I currently think my task is very different from the regression task, so I think I should use the control(not sure what it means) or customized task in DSO.
My goal is to construct a new expression in the original dataset and evaluate this expression and get a score. Ultimately, I would like to reconstruct the best expression by using SR, by "best" I mean the expression that scores the highest in my own evaluation process.

I'm curious if I can do this by doing a control/customized task in the config? If so, could you have a rough example to show?

Problems with parallelization within a batch using `const` token

Hello Again,

So I've been trying to get the parallelization working for this, and when I set n_cores_batch = 2 in the config.json file it keeps giving me the error below. I'm not sure what is causing this issue, and it persists with any other value for n_cores_batch other than 1. Do you have any insight into why this might be?

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/home/software/anaconda/3/envs/dso-sw/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/home/software/anaconda/3/envs/dso-sw/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/nas0/tluchko/sandbox/deep-symbolic-optimization/dso/dso/train.py", line 28, in work
    optimized_constants = p.optimize()
  File "/nas0/tluchko/sandbox/deep-symbolic-optimization/dso/dso/program.py", line 393, in optimize
    optimized_constants = Program.const_optimizer(f, x0)
TypeError: 'NoneType' object is not callable
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "rundso.py", line 9, in <module>
    model.train()
  File "/nas0/tluchko/sandbox/deep-symbolic-optimization/dso/dso/core.py", line 90, in train
    **self.config_training))
  File "/nas0/tluchko/sandbox/deep-symbolic-optimization/dso/dso/train.py", line 278, in learn
    results = pool.map(work, programs_to_optimize)
  File "/home/software/anaconda/3/envs/dso-sw/lib/python3.7/multiprocessing/pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/software/anaconda/3/envs/dso-sw/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
TypeError: 'NoneType' object is not callable

Trouble defining a Log Directory

Hi Brenden,

I am having trouble setting a log directory for it to save the results to. I’ve set it in my config.json Similarly to the config_common.json file you have in your repository. I have a directory named ./log but for some reason it keeps giving me the same error WARNING: logdir not provided results will not be saved to file. Could you specify exactly where the logdir needs to be set so I can check to see where the issue is? For reference I am running DSO from a python script (I.e. similarly to the scipy interface).

Installing: tensorflow 1.14 requirement

Hi,
It seems that installing the package needs a specific version of tensorflow (1.14). I am using the subsystem of windows (Linux) to create a virtual environment and install the package as noted in the instruction. But I faced with an error " Could not find a version that satisfies the requirement tensorflow==1.14"
I can't install the specific version of tensorflow requested and I am hesitating that should I switch all packages (python, NumPy and so on) to a compatible version with the old tensorflow one or not.

Crashes after a few minutes with 100 entries of csv data.

I have data with 9 variables and a result. So I have a csv file with samples that look like:

x1,x2,x3,x4,x5,x6,x7,x8,x9,y

Using a simple config:

{
  "task" : {
    "task_type" : "regression",
    "dataset" : "data.csv",
    "function_set" : ["add", "sub", "mul", "div", "neg", "n2", "n3"]
  }
}

This is running on an RTX 3090. It sits on "Running DSO for 1 seeds" for a bit then spikes to over 24 GBs of memory and then crashes.

python -m dso.run config.json
Running DSO for 1 seeds
-- BUILDING PRIOR -------------------
WARNING: Skipping invalid 'RelationalConstraint' with arguments {'targets': [], 'effectors': [], 'relationship': None}. Reason: Prior disabled.
WARNING: Skipping invalid 'RepeatConstraint' with arguments {'tokens': 'const', 'min_': None, 'max_': 3}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'TrigConstraint' with arguments {}. Reason: There are no target Tokens.
WARNING: Skipping invalid 'ConstConstraint' with arguments {}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'NoInputsConstraint' with arguments {}. Reason: All terminal tokens are input variables, so allsequences will have an input variable.
WARNING: Skipping invalid 'LanguageModelPrior' with arguments {'weight': None}. Reason: Prior disabled.
LengthConstraint: Sequences have minimum length 4.
LengthConstraint: Sequences have maximum length 30.
RelationalConstraint: [neg] cannot be a child of [neg].
UniformArityPrior: Activated.
SoftLengthPrior: No description available.
-------------------------------------
2021-09-16 02:49:06.352759: E tensorflow/stream_executor/cuda/cuda_blas.cc:428] failed to run cuBLAS routine: CUBLAS_STATUS_EXECUTION_FAILED
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
    return fn(*args)
  File "C:\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "C:\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.InternalError: 2 root error(s) found.
  (0) Internal: Blas GEMM launch failed : a.shape=(1000, 57), b.shape=(57, 128), m=1000, n=128, k=57
         [[{{node controller/policy/rnn/while/LinearWrapper/LinearWrapper/multi_rnn_cell/cell_0/lstm_cell/MatMul}}]]
         [[controller/policy/rnn/while/Exit_6/_39]]
  (1) Internal: Blas GEMM launch failed : a.shape=(1000, 57), b.shape=(57, 128), m=1000, n=128, k=57
         [[{{node controller/policy/rnn/while/LinearWrapper/LinearWrapper/multi_rnn_cell/cell_0/lstm_cell/MatMul}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "...\deep-symbolic-optimization\dso\dso\run.py", line 124, in <module>
    main()
  File "C:\Python37\lib\site-packages\click\core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "C:\Python37\lib\site-packages\click\core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "C:\Python37\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python37\lib\site-packages\click\core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "...\deep-symbolic-optimization\dso\dso\run.py", line 109, in main
    result, summary_path = train_dso(config)
  File "...\deep-symbolic-optimization\dso\dso\run.py", line 31, in train_dso
    result = model.train()
  File "...\deep-symbolic-optimization\dso\dso\core.py", line 90, in train
    **self.config_training))
  File "...\deep-symbolic-optimization\dso\dso\train.py", line 259, in learn
    actions, obs, priors = controller.sample(batch_size)
  File "...\deep-symbolic-optimization\dso\dso\controller.py", line 626, in sample
    actions, obs, priors = self.sess.run([self.actions, self.obs, self.priors], feed_dict=feed_dict)
  File "C:\Python37\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
    run_metadata_ptr)
  File "C:\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
    feed_dict_tensor, options, run_metadata)
  File "C:\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
    run_metadata)
  File "C:\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InternalError: 2 root error(s) found.
  (0) Internal: Blas GEMM launch failed : a.shape=(1000, 57), b.shape=(57, 128), m=1000, n=128, k=57
         [[node controller/policy/rnn/while/LinearWrapper/LinearWrapper/multi_rnn_cell/cell_0/lstm_cell/MatMul (defined at ...\deep-symbolic-optimization\dso\dso\controller.py:25) ]]
         [[controller/policy/rnn/while/Exit_6/_39]]
  (1) Internal: Blas GEMM launch failed : a.shape=(1000, 57), b.shape=(57, 128), m=1000, n=128, k=57
         [[node controller/policy/rnn/while/LinearWrapper/LinearWrapper/multi_rnn_cell/cell_0/lstm_cell/MatMul (defined at ...\deep-symbolic-optimization\dso\dso\controller.py:25) ]]
0 successful operations.
0 derived errors ignored.

Original stack trace for 'controller/policy/rnn/while/LinearWrapper/LinearWrapper/multi_rnn_cell/cell_0/lstm_cell/MatMul':
  File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "...\deep-symbolic-optimization\dso\dso\run.py", line 124, in <module>
    main()
  File "C:\Python37\lib\site-packages\click\core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "C:\Python37\lib\site-packages\click\core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "C:\Python37\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python37\lib\site-packages\click\core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "...\deep-symbolic-optimization\dso\dso\run.py", line 109, in main
    result, summary_path = train_dso(config)
  File "...\deep-symbolic-optimization\dso\dso\run.py", line 31, in train_dso
    result = model.train()
  File "...\deep-symbolic-optimization\dso\dso\core.py", line 82, in train
    self.setup()
  File "...\deep-symbolic-optimization\dso\dso\core.py", line 62, in setup
    self.controller = self.make_controller()
  File "...\deep-symbolic-optimization\dso\dso\core.py", line 134, in make_controller
    **self.config_controller)
  File "...\deep-symbolic-optimization\dso\dso\controller.py", line 438, in __init__
    _, _, loop_state = tf.nn.raw_rnn(cell=cell, loop_fn=loop_fn)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\rnn.py", line 1252, in raw_rnn
    swap_memory=swap_memory)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3501, in while_loop
    return_same_structure)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3012, in BuildLoop
    pred, body, original_loop_vars, loop_vars, shape_invariants)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2937, in _BuildLoop
    body_result = body(*packed_vars_for_body)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\rnn.py", line 1201, in body
    (next_output, cell_state) = cell(current_input, state)
  File "...\deep-symbolic-optimization\dso\dso\controller.py", line 25, in __call__
    outputs, state = self.cell(inputs, state, scope=scope)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\rnn_cell_impl.py", line 248, in __call__
    return super(RNNCell, self).__call__(inputs, state)
  File "C:\Python37\lib\site-packages\tensorflow\python\layers\base.py", line 537, in __call__
    outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 634, in __call__
    outputs = call_fn(inputs, *args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 146, in wrapper
    ), args, kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 446, in converted_call
    return _call_unconverted(f, args, kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 253, in _call_unconverted
    return f(*args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\rnn_cell_impl.py", line 1719, in call
    cur_inp, new_state = cell(cur_inp, cur_state)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\rnn_cell_impl.py", line 385, in __call__
    self, inputs, state, scope=scope, *args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\layers\base.py", line 537, in __call__
    outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 634, in __call__
    outputs = call_fn(inputs, *args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 146, in wrapper
    ), args, kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 446, in converted_call
    return _call_unconverted(f, args, kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 253, in _call_unconverted
    return f(*args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\rnn_cell_impl.py", line 1027, in call
    array_ops.concat([inputs, m_prev], 1), self._kernel)
  File "C:\Python37\lib\site-packages\tensorflow\python\util\dispatch.py", line 180, in wrapper
    return target(*args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\math_ops.py", line 2647, in matmul
    a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)
  File "C:\Python37\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 6295, in mat_mul
    name=name)
  File "C:\Python37\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "C:\Python37\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "C:\Python37\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
    op_def=op_def)
  File "C:\Python37\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in __init__
    self._traceback = tf_stack.extract_stack()

The data for reference:

10,10,10,13.33749,10.16646,19.20067,11.72338,20,11,10
11,10,10,13.33749,10.16646,19.20067,11.72338,20,11,10.08056
12,10,10,13.33749,10.16646,19.20067,11.72338,20,11,10.20316
13,10,10,13.33749,10.16646,19.20067,11.72338,20,11,10.35009
14,10,10,13.33749,10.16646,19.20067,11.72338,20,11,10.51071
15,10,10,13.33749,10.16646,19.20067,11.72338,20,11,10.67702
16,10,10,13.33749,10.16646,19.20067,11.72338,20,11,10.84145
17,10,10,13.33749,10.16646,19.20067,11.72338,20,11,10.99478
18,10,10,13.33749,10.16646,19.20067,11.72338,20,11,11.12228
19,10,10,13.33749,10.16646,19.20067,11.72338,20,11,11.19015
20,10,10,13.33749,10.16646,19.20067,11.72338,20,11,11
10,10,10,13.34984,10.3317,18.97691,12.83873,20,12,10
11,10,10,13.34984,10.3317,18.97691,12.83873,20,12,10.14675
12,10,10,13.34984,10.3317,18.97691,12.83873,20,12,10.3607
13,10,10,13.34984,10.3317,18.97691,12.83873,20,12,10.61526
14,10,10,13.34984,10.3317,18.97691,12.83873,20,12,10.89402
15,10,10,13.34984,10.3317,18.97691,12.83873,20,12,11.18464
16,10,10,13.34984,10.3317,18.97691,12.83873,20,12,11.47558
17,10,10,13.34984,10.3317,18.97691,12.83873,20,12,11.75313
18,10,10,13.34984,10.3317,18.97691,12.83873,20,12,11.9959
19,10,10,13.34984,10.3317,18.97691,12.83873,20,12,12.15667
20,10,10,13.34984,10.3317,18.97691,12.83873,20,12,12
10,10,10,13.37002,10.49461,18.83674,13.8655,20,13,10
11,10,10,13.37002,10.49461,18.83674,13.8655,20,13,10.20966
12,10,10,13.37002,10.49461,18.83674,13.8655,20,13,10.50974
13,10,10,13.37002,10.49461,18.83674,13.8655,20,13,10.86614
14,10,10,13.37002,10.49461,18.83674,13.8655,20,13,11.25744
15,10,10,13.37002,10.49461,18.83674,13.8655,20,13,11.66739
16,10,10,13.37002,10.49461,18.83674,13.8655,20,13,12.08092
17,10,10,13.37002,10.49461,18.83674,13.8655,20,13,12.4804
18,10,10,13.37002,10.49461,18.83674,13.8655,20,13,12.8389
19,10,10,13.37002,10.49461,18.83674,13.8655,20,13,13.09863
20,10,10,13.37002,10.49461,18.83674,13.8655,20,13,13
10,10,10,13.39751,10.6543,18.73781,14.85455,20,14,10
11,10,10,13.39751,10.6543,18.73781,14.85455,20,14,10.26982
12,10,10,13.39751,10.6543,18.73781,14.85455,20,14,10.65275
13,10,10,13.39751,10.6543,18.73781,14.85455,20,14,11.10799
14,10,10,13.39751,10.6543,18.73781,14.85455,20,14,11.60937
15,10,10,13.39751,10.6543,18.73781,14.85455,20,14,12.13692
16,10,10,13.39751,10.6543,18.73781,14.85455,20,14,12.67214
17,10,10,13.39751,10.6543,18.73781,14.85455,20,14,13.19363
18,10,10,13.39751,10.6543,18.73781,14.85455,20,14,13.66927
19,10,10,13.39751,10.6543,18.73781,14.85455,20,14,14.03163
20,10,10,13.39751,10.6543,18.73781,14.85455,20,14,14
10,10,10,13.43162,10.8101,18.66418,15.82558,20,15,10
11,10,10,13.43162,10.8101,18.66418,15.82558,20,15,10.32723
12,10,10,13.43162,10.8101,18.66418,15.82558,20,15,10.79024
13,10,10,13.43162,10.8101,18.66418,15.82558,20,15,11.34215
14,10,10,13.43162,10.8101,18.66418,15.82558,20,15,11.95223
15,10,10,13.43162,10.8101,18.66418,15.82558,20,15,12.59681
16,10,10,13.43162,10.8101,18.66418,15.82558,20,15,13.25395
17,10,10,13.43162,10.8101,18.66418,15.82558,20,15,13.89849
18,10,10,13.43162,10.8101,18.66418,15.82558,20,15,14.49307
19,10,10,13.43162,10.8101,18.66418,15.82558,20,15,14.96088
20,10,10,13.43162,10.8101,18.66418,15.82558,20,15,15
10,10,10,13.47162,10.96158,18.60772,16.7883,20,16,10
11,10,10,13.47162,10.96158,18.60772,16.7883,20,16,10.38178
12,10,10,13.47162,10.96158,18.60772,16.7883,20,16,10.92224
13,10,10,13.47162,10.96158,18.60772,16.7883,20,16,11.56893
14,10,10,13.47162,10.96158,18.60772,16.7883,20,16,12.28676
15,10,10,13.47162,10.96158,18.60772,16.7883,20,16,13.04832
16,10,10,13.47162,10.96158,18.60772,16.7883,20,16,13.82817
17,10,10,13.47162,10.96158,18.60772,16.7883,20,16,14.59724
18,10,10,13.47162,10.96158,18.60772,16.7883,20,16,15.31285
19,10,10,13.47162,10.96158,18.60772,16.7883,20,16,15.88854
20,10,10,13.47162,10.96158,18.60772,16.7883,20,16,16
10,10,10,13.51676,11.10856,18.56355,17.7479,20,17,10
11,10,10,13.51676,11.10856,18.56355,17.7479,20,17,10.4334
12,10,10,13.51676,11.10856,18.56355,17.7479,20,17,11.04867
13,10,10,13.51676,11.10856,18.56355,17.7479,20,17,11.78835
14,10,10,13.51676,11.10856,18.56355,17.7479,20,17,12.61312
15,10,10,13.51676,11.10856,18.56355,17.7479,20,17,13.49183
16,10,10,13.51676,11.10856,18.56355,17.7479,20,17,14.39545
17,10,10,13.51676,11.10856,18.56355,17.7479,20,17,15.29083
18,10,10,13.51676,11.10856,18.56355,17.7479,20,17,16.12971
19,10,10,13.51676,11.10856,18.56355,17.7479,20,17,16.81559
20,10,10,13.51676,11.10856,18.56355,17.7479,20,17,17
10,10,10,13.5663,11.25099,18.52847,18.70725,20,18,10
11,10,10,13.5663,11.25099,18.52847,18.70725,20,18,10.4821
12,10,10,13.5663,11.25099,18.52847,18.70725,20,18,11.1695
13,10,10,13.5663,11.25099,18.52847,18.70725,20,18,12.00034
14,10,10,13.5663,11.25099,18.52847,18.70725,20,18,12.93125
15,10,10,13.5663,11.25099,18.52847,18.70725,20,18,13.92736
16,10,10,13.5663,11.25099,18.52847,18.70725,20,18,14.95593
17,10,10,13.5663,11.25099,18.52847,18.70725,20,18,15.97958
18,10,10,13.5663,11.25099,18.52847,18.70725,20,18,16.94411
19,10,10,13.5663,11.25099,18.52847,18.70725,20,18,17.74245
20,10,10,13.5663,11.25099,18.52847,18.70725,20,18,18
10,10,10,13.61956,11.38895,18.50028,19.66792,20,19,10
11,10,10,13.61956,11.38895,18.50028,19.66792,20,19,10.52792
12,10,10,13.61956,11.38895,18.50028,19.66792,20,19,11.28475
13,10,10,13.61956,11.38895,18.50028,19.66792,20,19,12.20486
14,10,10,13.61956,11.38895,18.50028,19.66792,20,19,13.24107
15,10,10,13.61956,11.38895,18.50028,19.66792,20,19,14.35482
16,10,10,13.61956,11.38895,18.50028,19.66792,20,19,15.50958
17,10,10,13.61956,11.38895,18.50028,19.66792,20,19,16.6635
18,10,10,13.61956,11.38895,18.50028,19.66792,20,19,17.75617
19,10,10,13.61956,11.38895,18.50028,19.66792,20,19,18.66927
20,10,10,13.61956,11.38895,18.50028,19.66792,20,19,19

I had it running on my CPU (was extremely slow, so I stopped it) earlier with a lot more data so I assume it's a bug somewhere. It's possible I'm doing something wrong. Googling that error leads me to stuff like: https://stackoverflow.com/a/52132342/254381

Maybe you're familiar with this already. I'll investigate more tomorrow.

Also for future reference since I can't find any FAQ. Does this project work with large datasets? I have some problems I want to try on it where my data ranges from 330 MBs to upwards of 15+ TB. I assume that is outside the scope of this project?

"Illegal Hardware Instruction"

Hi Brenden,

Sorry to bother you again! When I was trying to run the example config file, I encountered the error saying "illegal hardware instruction" as shown in the figure. Do you have any idea about why this happens? I am currently using a macbook with M1 pro chip. Thank you so much!

hardware issue

Jiayi

How to implement binary power function?

Hi,

Thanks for creating this awesome package! I would like to add a binary power function to represent terms such as x**1.54 , x**x or (sin(x))**x etc. I found the function definitions in function.py to currently only implement particular powers, e.g. x^2, x^3, x^4. Is it possible to add a "generic" power operator and if so, how would I do that? I am guessing something similar to
Token(np.power, "pow", arity=2, complexity=??) but what does the complexity parameter represent and what value should I set it to?

Thanks a lot for you help!

ValueError in train.py

Hello,

I am using the control task of DSO. I recently reinstall everything and ran an ancient program that used to work with my previous installation. My goal is to find control law for simple chaotic dynamical systems (Dadras, Rössler, Lorenz etc...). I created gym environements for them, but now I get this error when launch DSO on the Dadras system (not the Lorenz):

MY COMMAND:
python -m dso.run ~/Bureau/Scripts/Python/DSO/config/DS.json

THE OUTPUT:

WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.


== EXPERIMENT SETUP START ===========
Task type            : control
Environment          : DS-v0
Starting seed        : 0
Runs                 : 1
== EXPERIMENT SETUP END =============

== TRAINING SEED 0 START ============
/home/remi/deep-symbolic-optimization-master/dso/dso/prior.py:757: RuntimeWarning: divide by zero encountered in log
  self.logit_adjust[tokens] -= np.log(len(tokens))
-- BUILDING PRIOR START -------------
WARNING: Skipping invalid 'RelationalConstraint' with arguments {'targets': [], 'effectors': [], 'relationship': None}. Reason: Prior disabled.
WARNING: Skipping invalid 'RepeatConstraint' with arguments {'tokens': 'const', 'min_': None, 'max_': 3}. Reason: Prior disabled.
WARNING: Skipping invalid 'InverseUnaryConstraint' with arguments {}. Reason: There are no inverse unary Token pairs in the Library.
WARNING: Skipping invalid 'TrigConstraint' with arguments {}. Reason: There are no target Tokens.
WARNING: Skipping invalid 'ConstConstraint' with arguments {}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'LanguageModelPrior' with arguments {'weight': None}. Reason: Prior disabled.
LengthConstraint: Sequences have minimum length 4.
                  Sequences have maximum length 30.
NoInputsConstraint: Sequences contain at least one input variable Token.
UniformArityPrior: Activated.
SoftLengthPrior: No description available.
-- BUILDING PRIOR END ---------------

WARNING: max_length (256) will be overridden by value from LengthConstraint (30).
-- RUNNING EPOCHS START -------------
/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/site-packages/numpy/core/fromnumeric.py:3373: RuntimeWarning: Mean of empty slice.
  out=out, **kwargs)
/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/site-packages/numpy/core/_methods.py:170: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
WOLA []
Traceback (most recent call last):
  File "/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/remi/deep-symbolic-optimization-master/dso/dso/run.py", line 156, in <module>
    main()
  File "/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/remi/deep-symbolic-optimization-master/dso/dso/run.py", line 139, in main
    result, summary_path = train_dso(config)
  File "/home/remi/deep-symbolic-optimization-master/dso/dso/run.py", line 33, in train_dso
    result = model.train()
  File "/home/remi/deep-symbolic-optimization-master/dso/dso/core.py", line 83, in train
    **self.config_training))
  File "/home/remi/deep-symbolic-optimization-master/dso/dso/train.py", line 472, in learn
    p_r_best = programs[np.argmax(r)]
  File "<__array_function__ internals>", line 6, in argmax
  File "/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 1188, in argmax
    return _wrapfunc(a, 'argmax', axis=axis, out=out)
  File "/home/remi/anaconda3/envs/DSO_env_6/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 58, in _wrapfunc
    return bound(*args, **kwds)
ValueError: attempt to get argmax of an empty sequence

As stated by the error message, the problem comes from train.py at line 471, where the variable r is empty, causing the error. I just started to study the code, but I don't think I will have time to understand everything. Maybe an expert could tell me if that error is normal or not.

I don't get this error when working with another dynamical system (Lorenz system for example). My gym environment is the same for Lorenz and Dadras (apart from its behavior, that is to say the equations of the dynamical system).

Looking forward to an answer. Thanks and regards!
Rémi

IndexError: pop from empty list when using "neg_rmse"

My program:

from dso import DeepSymbolicRegressor
import pandas as pd

df = pd.read_csv("/path/to/file/ml_data.csv")

inputs = df[["1", "2"]].values[0:100]
labels = df[["y"]].values[:, 0][0:100]

# Create the model
model = DeepSymbolicRegressor({
    "task": {
      "task_type" : "regression",      
      "function_set": ["add", "sub", "mul", "div", "sin", "cos", "exp", "log"],      
      "metric" : "neg_rmse",     # <- when changing this to "inv_nrmse" it works
      "metric_params" : [],      
      "extra_metric_test" : None,      
      "extra_metric_test_params" : [],      
      "threshold" : 1e-12,      
      "protected" : False,      
      "reward_noise" : 0.0,      
      "reward_noise_type" : "r",      
      "normalize_variance" : False,      
      "decision_tree_threshold_set" : []
    }
}) 

# Fit the model
model.fit(inputs, labels)  # Should solve in ~10 seconds

After 1 epoch of training, this is the error that is outputted. If I switch the metric to "inv_nrmse" then the error doesn't happen and the model trains just fine. Am I configuring something incorrectly?

Traceback (most recent call last):
  File "dsr.py", line 35, in <module>
    model.fit(inputs, labels)  # Should solve in ~10 seconds
  File "/dso/dso/task/regression/sklearn.py", line 33, in fit
    train_result = self.train()
  File "/deep-symbolic-optimization/dso/dso/core.py", line 83, in train
    **self.config_training))
  File "/deep-symbolic-optimization/dso/dso/train.py", line 263, in learn
    deap_programs, deap_actions, deap_obs, deap_priors = gp_controller(actions)
  File "deep-symbolic-optimization/dso/dso/gp/gp_controller.py", line 221, in __call__
    nevals = self.algorithm(self.hof, i) # Run one generation
  File "/deep-symbolic-optimization/dso/dso/gp/base.py", line 159, in __call__
    population, invalid_ind, uncached_ind = self._eval(offspring)
  File "deep-symbolic-optimization/dso/dso/gp/base.py", line 100, in _eval
    p = programs.pop(0)
IndexError: pop from empty list

Issue with requirements.txt

Hi, I traid to install the package, but at the requirements.txt stage, the following issue appears:

`Collecting pytest (from -r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/a1/cf/7f67585bd2fc0359ec482cf3c430bce3ef6d3f40bc468137225a733e3069/pytest-6.2.2-py3-none-any.whl
Collecting cython (from -r requirements.txt (line 2))
Cache entry deserialization failed, entry ignored
Using cached https://files.pythonhosted.org/packages/19/49/91ebe4a00bf894d08dd9680cd9dfb05936eb2848eebd9402b43885aa74cf/Cython-0.29.21-cp36-cp36m-manylinux1_x86_64.whl
Collecting numpy (from -r requirements.txt (line 3))
Using cached https://files.pythonhosted.org/packages/45/b2/6c7545bb7a38754d63048c7696804a0d947328125d81bf12beaa692c3ae3/numpy-1.19.5-cp36-cp36m-manylinux1_x86_64.whl
Collecting tensorflow==1.14 (from -r requirements.txt (line 4))
Cache entry deserialization failed, entry ignored
Using cached https://files.pythonhosted.org/packages/de/f0/96fb2e0412ae9692dbf400e5b04432885f677ad6241c088ccc5fe7724d69/tensorflow-1.14.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting numba (from -r requirements.txt (line 5))
Using cached https://files.pythonhosted.org/packages/46/e1/cbbc7c7967d9b10e54c852bf5bece0222a63bfb809d3354014c957ef1bda/numba-0.52.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-i90e2pu4/numpy-1.20.0/setup.py", line 30, in
# Patch for #2555 to make wheels without libpython
RuntimeError: Python version >= 3.7 required.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-b2ynfpb2/numba/setup.py", line 415, in <module>
    setup(**metadata)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/__init__.py", line 128, in setup
    _install_setup_requires(attrs)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/__init__.py", line 123, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/dist.py", line 513, in fetch_build_eggs
    replace_conflicting=True,
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
    replace_conflicting=replace_conflicting
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1057, in best_match
    return self.obtain(req, installer)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1069, in obtain
    return installer(requirement)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/dist.py", line 580, in fetch_build_egg
    return cmd.easy_install(req)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 698, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 724, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 909, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1177, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1163, in run_setup
    run_setup(setup_script, args)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/home/aaron/deep-symbolic-regression/venv3/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-i90e2pu4/numpy-1.20.0/setup.py", line 30, in <module>
    # Patch for #2555 to make wheels without libpython
RuntimeError: Python version >= 3.7 required.

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-b2ynfpb2/numba/
`

I tried to remove the TensorFlow version from it, but still didn't work.

6 Tests failing

Dear Brenden and DSO team,

I love the project and am building on top of it & using it, however running the tests in dso/dso/test/ folder, some of them fail on a clean install. Is this to be expected ? I.e. the tests are not maintained or should a user expect all the tests to pass ?

Any indication would most helpful, fine if some are expected to fail, just useful to know before I start looking into them all.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED test/test_core.py::test_model_parity[config/config_regression.json] - ...
FAILED test/test_multiobject.py::test_multiobject_repeat - IndexError: pop fr...
FAILED test/test_multiobject.py::test_multiobject_relational - IndexError: po...
FAILED test/test_multiobject.py::test_multiobject_trig - IndexError: pop from...
FAILED test/test_prior.py::test_length[minmax3] - RecursionError: maximum rec...
FAILED test/test_prior.py::test_state_checker - AssertionError: *** Failed to...
=========== 6 failed, 29 passed, 81492 warnings in 727.94s (0:12:07) ===========

Here is my pytest output, from cd ./dso/dso, pytest ./test:

============================= test session starts ==============================
platform linux -- Python 3.7.11, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/sam/code/discovery/deep-symbolic-optimization/dso
collected 35 items

test/test_constant.py ..                                                 [  5%]
test/test_core.py ..F                                                    [ 14%]
test/test_multiobject.py ..FF......F                                     [ 45%]
test/test_prior.py ............F...F                                     [ 94%]
test/custom_tasks/test_custom_task_prior.py ..                           [100%]

=================================== FAILURES ===================================
_______________ test_model_parity[config/config_regression.json] _______________

model = <dso.core.DeepSymbolicOptimizer object at 0x7f4958422ed0>
cached_results = array([ 0.00158688,  0.00255992, -0.0027501 , ..., -0.00092246,
        0.00182365, -0.00466506], dtype=float32)
config = {'controller': {'cell': 'lstm', 'entropy_gamma': 0.7, 'entropy_weight': 0.03, 'initializer': 'zeros', ...}, 'experimen...ate_tree_max': 3, 'p_crossover': 0.5, 'p_mutate': 0.5, ...}, 'postprocess': {'save_plots': True, 'show_count': 5}, ...}

    @pytest.mark.parametrize("config", ["config/config_regression.json"])
    def test_model_parity(model, cached_results, config):
        """Compare results to last"""
    
        config = load_config(config)
        config["experiment"]["logdir"] = None # Turn off saving results
        model.set_config(config)
        model.config_training.update(CONFIG_TRAINING_OVERRIDE)
        model.train()
        results = model.sess.run(tf.trainable_variables())
    
        cached_results = np.concatenate([a.flatten() for a in cached_results])
        results = np.concatenate([a.flatten() for a in results])
>       np.testing.assert_array_almost_equal(results, cached_results)
E       AssertionError: 
E       Arrays are not almost equal to 6 decimals
E       
E       Mismatched elements: 6907 / 6953 (99.3%)
E       Max absolute difference: 0.00728797
E       Max relative difference: 1216.0376
E        x: array([ 0.    ,  0.    ,  0.    , ..., -0.0025,  0.0025, -0.0025],
E             dtype=float32)
E        y: array([ 0.001587,  0.00256 , -0.00275 , ..., -0.000922,  0.001824,
E              -0.004665], dtype=float32)

test/test_core.py:57: AssertionError
---------------------------- Captured stdout setup -----------------------------
WARNING: Task type not specified. Falling back to default task type 'regression' to load config.

-- BUILDING DATASET START -----------
Benchmark path                 : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/benchmarks.csv
Generated data for benchmark   : Nguyen-1
Function set path              : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/function_sets.csv
Function set                   : Koza --> ['add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log']
-- BUILDING DATASET END -------------

WARNING: logdir not provided. Results will not be saved to file.
-- BUILDING PRIOR START -------------
WARNING: Skipping invalid 'RelationalConstraint' with arguments {'targets': [], 'effectors': [], 'relationship': None}. Reason: Prior disabled.
WARNING: Skipping invalid 'RepeatConstraint' with arguments {'tokens': 'const', 'min_': None, 'max_': 10}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'ConstConstraint' with arguments {}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'NoInputsConstraint' with arguments {}. Reason: All terminal tokens are input variables, so allsequences will have an input variable.
WARNING: Skipping invalid 'UniformArityPrior' with arguments {}. Reason: Prior disabled.
WARNING: Skipping invalid 'LanguageModelPrior' with arguments {'weight': None}. Reason: Prior disabled.
LengthConstraint: Sequences have minimum length 4.
                  Sequences have maximum length 256.
RelationalConstraint: [exp] cannot be a child of [log].
InverseUnaryConstraint: RelationalConstraint: [log] cannot be a child of [exp].
TrigConstraint: [sin, cos] cannot be a descendant of [sin, cos].
SoftLengthPrior: No description available.
-- BUILDING PRIOR END ---------------

entropy gamma  0.7
----------------------------- Captured stdout call -----------------------------

-- BUILDING DATASET START -----------
Benchmark path                 : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/benchmarks.csv
Generated data for benchmark   : Nguyen-1
Function set path              : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/function_sets.csv
Function set                   : Koza --> ['add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log']
-- BUILDING DATASET END -------------

WARNING: logdir not provided. Results will not be saved to file.
-- BUILDING PRIOR START -------------
WARNING: Skipping invalid 'RelationalConstraint' with arguments {'targets': [], 'effectors': [], 'relationship': None}. Reason: Prior disabled.
WARNING: Skipping invalid 'RepeatConstraint' with arguments {'tokens': 'const', 'min_': None, 'max_': 10}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'ConstConstraint' with arguments {}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'NoInputsConstraint' with arguments {}. Reason: All terminal tokens are input variables, so allsequences will have an input variable.
WARNING: Skipping invalid 'UniformArityPrior' with arguments {}. Reason: Prior disabled.
WARNING: Skipping invalid 'LanguageModelPrior' with arguments {'weight': None}. Reason: Prior disabled.
LengthConstraint: Sequences have minimum length 4.
                  Sequences have maximum length 256.
RelationalConstraint: [exp] cannot be a child of [log].
InverseUnaryConstraint: RelationalConstraint: [log] cannot be a child of [exp].
TrigConstraint: [sin, cos] cannot be a descendant of [sin, cos].
SoftLengthPrior: No description available.
-- BUILDING PRIOR END ---------------

entropy gamma  0.7
-- RUNNING EPOCHS START -------------
[00:00:00:00.68] Training epoch 1/10, current best R: 0.8360

	** New best
	Reward: 0.8360189339258013
	Count Off-policy: 1
	Count On-policy: 0
	Originally on Policy: False
	Invalid: False
	Traversal: mul,sub,div,log,div,x1,x1,exp,x1,sub,x1,add,x1,x1,exp,x1
	Expression:
	      x₁
	  x₁⋅ℯ  

-- RUNNING EPOCHS END ---------------

-- EVALUATION START ----------------
Invalid expressions: 277 of 1609 (17.2%).
Error type counts:
  log: 253 (91.3%)
  exp: 6 (2.2%)
  true_divide: 18 (6.5%)
Error node counts:
  invalid: 231 (83.4%)
  divide: 40 (14.4%)
  overflow: 6 (2.2%)

Priority queue entry 0:
	Reward: 0.8360189339258013
	Count Off-policy: 1
	Count On-policy: 0
	Originally on Policy: False
	Invalid: False
	Traversal: mul,sub,div,log,div,x1,x1,exp,x1,sub,x1,add,x1,x1,exp,x1
	Expression:
	      x₁
	  x₁⋅ℯ  

-- EVALUATION END ------------------
___________________________ test_multiobject_repeat ____________________________

model = <dso.core.DeepSymbolicOptimizer object at 0x7f49b438e110>

    def test_multiobject_repeat(model):
        Program.set_n_objects(2)
        config_prior_length = deepcopy(model.config_prior["length"])
        config_prior_length["min_"] = 3
        model.config_prior = {} # turn off all other priors
        model.config_prior["repeat"] = {
            "tokens" : ["sin", "cos"],
            "min_" : None, # Not yet supported
            "max_" : 2,
            "on": True
        }
        model.config_prior["length"] = config_prior_length
        model.config_training.update(CONFIG_TRAINING_OVERRIDE)
>       model.train()

test/test_multiobject.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
core.py:84: in train
    **self.config_training))
train.py:264: in learn
    deap_programs, deap_actions, deap_obs, deap_priors = gp_controller(actions)
gp/gp_controller.py:221: in __call__
    nevals = self.algorithm(self.hof, i) # Run one generation
gp/base.py:149: in __call__
    offspring = self._var_and(offspring)
gp/base.py:122: in _var_and
    offspring[i], = self.toolbox.mutate(offspring[i])
gp/utils.py:74: in wrapper
    new_inds = list(func(*args, **kwargs))
gp/utils.py:100: in multi_mutate
    individual = gp.mutShrink(individual)
/home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/deap/gp.py:857: in mutShrink
    if len(individual) < 3 or individual.height <= 1:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = [<deap.gp.Primitive object at 0x7f49585008f0>, <deap.gp.Primitive object at 0x7f49581ce170>, <deap.gp.Primitive object...al object at 0x7f4958533cd0>, <deap.gp.Terminal object at 0x7f4958533cd0>, <deap.gp.Terminal object at 0x7f4958533cd0>]

    @property
    def height(self):
        """Return the height of the tree, or the depth of the
        deepest node.
        """
        stack = [0]
        max_depth = 0
        for elem in self:
>           depth = stack.pop()
E           IndexError: pop from empty list

/home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/deap/gp.py:161: IndexError
---------------------------- Captured stdout setup -----------------------------
WARNING: Task type not specified. Falling back to default task type 'regression' to load config.
----------------------------- Captured stdout call -----------------------------

-- BUILDING DATASET START -----------
Benchmark path                 : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/benchmarks.csv
Generated data for benchmark   : Nguyen-1
Function set path              : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/function_sets.csv
Function set                   : Koza --> ['add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log']
-- BUILDING DATASET END -------------

WARNING: logdir not provided. Results will not be saved to file.
-- BUILDING PRIOR START -------------

RepeatConstraint: [sin, cos] cannot occur more than 2 times.
LengthConstraint: Sequences have minimum length 3.
                  Sequences have maximum length 256.
-- BUILDING PRIOR END ---------------

entropy gamma  0.7
-- RUNNING EPOCHS START -------------
_________________________ test_multiobject_relational __________________________

model = <dso.core.DeepSymbolicOptimizer object at 0x7f4968180890>

    def test_multiobject_relational(model):
        Program.set_n_objects(2)
    
        # Constrain x1 - x1 or x1 / x1
        targets = "x1"
        effectors = "sub,div"
    
        # Need multiple input variables for this particular constraint otherwise this
        # RelationalConstraint cannot be used with the LengthConstraint simultaneously.
        model.config_task["dataset"] = "Nguyen-12"
    
        config_prior_length = deepcopy(model.config_prior["length"])
        config_prior_length["min_"] = None
        model.config_prior = {} # Turn off all other Priors
        model.config_prior["relational"] = {
            "targets" : targets,
            "effectors" : effectors,
            "relationship" : "uchild",
            "on": True
        }
        model.config_prior["length"] = config_prior_length
        model.config_training.update(CONFIG_TRAINING_OVERRIDE)
>       model.train()

test/test_multiobject.py:88: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
core.py:84: in train
    **self.config_training))
train.py:264: in learn
    deap_programs, deap_actions, deap_obs, deap_priors = gp_controller(actions)
gp/gp_controller.py:221: in __call__
    nevals = self.algorithm(self.hof, i) # Run one generation
gp/base.py:149: in __call__
    offspring = self._var_and(offspring)
gp/base.py:122: in _var_and
    offspring[i], = self.toolbox.mutate(offspring[i])
gp/utils.py:74: in wrapper
    new_inds = list(func(*args, **kwargs))
gp/utils.py:100: in multi_mutate
    individual = gp.mutShrink(individual)
/home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/deap/gp.py:857: in mutShrink
    if len(individual) < 3 or individual.height <= 1:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = [<deap.gp.Primitive object at 0x7f48e8730350>, <deap.gp.Primitive object at 0x7f48e8730350>, <deap.gp.Primitive object...al object at 0x7f4854535820>, <deap.gp.Terminal object at 0x7f4abb6ea690>, <deap.gp.Terminal object at 0x7f4854535820>]

    @property
    def height(self):
        """Return the height of the tree, or the depth of the
        deepest node.
        """
        stack = [0]
        max_depth = 0
        for elem in self:
>           depth = stack.pop()
E           IndexError: pop from empty list

/home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/deap/gp.py:161: IndexError
---------------------------- Captured stdout setup -----------------------------
WARNING: Task type not specified. Falling back to default task type 'regression' to load config.
----------------------------- Captured stdout call -----------------------------

-- BUILDING DATASET START -----------
Benchmark path                 : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/benchmarks.csv
Generated data for benchmark   : Nguyen-12
Function set path              : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/function_sets.csv
Function set                   : Koza --> ['add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log']
-- BUILDING DATASET END -------------

WARNING: logdir not provided. Results will not be saved to file.
-- BUILDING PRIOR START -------------

RelationalConstraint: [x1] cannot be the only unique child of [sub, div].
                  Sequences have maximum length 256.
-- BUILDING PRIOR END ---------------

entropy gamma  0.7
-- RUNNING EPOCHS START -------------
____________________________ test_multiobject_trig _____________________________

model = <dso.core.DeepSymbolicOptimizer object at 0x7f480c6cb210>

    def test_multiobject_trig(model):
    
        Program.set_n_objects(2)
        config_prior_length = deepcopy(model.config_prior["length"])
        config_prior_length["min_"] = 2
        model.config_prior = {} # Turn off all other Priors
        model.config_prior["trig"] = {"on": True}
        model.config_prior["length"] = config_prior_length
        model.config_training.update(CONFIG_TRAINING_OVERRIDE)
>       model.train()

test/test_multiobject.py:192: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
core.py:84: in train
    **self.config_training))
train.py:264: in learn
    deap_programs, deap_actions, deap_obs, deap_priors = gp_controller(actions)
gp/gp_controller.py:221: in __call__
    nevals = self.algorithm(self.hof, i) # Run one generation
gp/base.py:149: in __call__
    offspring = self._var_and(offspring)
gp/base.py:122: in _var_and
    offspring[i], = self.toolbox.mutate(offspring[i])
gp/utils.py:74: in wrapper
    new_inds = list(func(*args, **kwargs))
gp/utils.py:100: in multi_mutate
    individual = gp.mutShrink(individual)
/home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/deap/gp.py:857: in mutShrink
    if len(individual) < 3 or individual.height <= 1:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = [<deap.gp.Primitive object at 0x7f4968758a70>, <deap.gp.Primitive object at 0x7f49b47f1230>, <deap.gp.Primitive object...al object at 0x7f49a83cb820>, <deap.gp.Terminal object at 0x7f49a83cb820>, <deap.gp.Terminal object at 0x7f49a83cb820>]

    @property
    def height(self):
        """Return the height of the tree, or the depth of the
        deepest node.
        """
        stack = [0]
        max_depth = 0
        for elem in self:
>           depth = stack.pop()
E           IndexError: pop from empty list

/home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/deap/gp.py:161: IndexError
---------------------------- Captured stdout setup -----------------------------
WARNING: Task type not specified. Falling back to default task type 'regression' to load config.
----------------------------- Captured stdout call -----------------------------

-- BUILDING DATASET START -----------
Benchmark path                 : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/benchmarks.csv
Generated data for benchmark   : Nguyen-1
Function set path              : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/function_sets.csv
Function set                   : Koza --> ['add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log']
-- BUILDING DATASET END -------------

WARNING: logdir not provided. Results will not be saved to file.
-- BUILDING PRIOR START -------------

TrigConstraint: [sin, cos] cannot be a descendant of [sin, cos].
LengthConstraint: Sequences have minimum length 2.
                  Sequences have maximum length 256.
-- BUILDING PRIOR END ---------------

entropy gamma  0.7
-- RUNNING EPOCHS START -------------
_____________________________ test_length[minmax3] _____________________________

self = div,sin,log,exp,log,sin,mul,mul,x1,div,sub,exp,add,div,exp,cos,sin,div,log,cos,sub,sub,sub,x1,div,add,x1,log,cos,cos,s...x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1,x1

    @cached_property
    def sympy_expr(self):
        """
        Returns the attribute self.sympy_expr.
    
        This is actually a bit complicated because we have to go: traversal -->
        tree --> serialized tree --> SymPy expression
        """
    
        if Program.n_objects == 1:
            tree = self.traversal.copy()
            tree = build_tree(tree)
            tree = convert_to_sympy(tree)
            try:
>               expr = parse_expr(tree.__repr__()) # SymPy expression

program.py:556: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[RecursionError('maximum recursion depth exceeded while calling a Python object') raised in repr()] Node object at 0x7f474c449b90>

    def __repr__(self):
>       children_repr = ",".join(repr(child) for child in self.children)

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <list_iterator object at 0x7f474c4ae1d0>

>   children_repr = ",".join(repr(child) for child in self.children)

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <[RecursionError('maximum recursion depth exceeded while calling a Python object') raised in repr()] Node object at 0x7f474c449b50>

    def __repr__(self):
>       children_repr = ",".join(repr(child) for child in self.children)

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <list_iterator object at 0x7f474c4ae210>

>   children_repr = ",".join(repr(child) for child in self.children)

.
.
.

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Mul(cos(Mul(log(cos(cos(x1))),Add(x1,Add(log(sin(sin(Mul(Mul(Mul(Mul(sin(cos(Add(Add(exp(Mul(Mul(x1,x1),cos(cos(log(lo...,-1))))),Pow(x1,-1))))))),Mul(x1,-1))),Pow(x1,-1)),Mul(x1,-1)),x1),-1)))),x1),Pow(x1,-1)),Pow(x1,-1)),x1)))),x1)))),x1)

    def __repr__(self):
>       children_repr = ",".join(repr(child) for child in self.children)

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <list_iterator object at 0x7f474c4a77d0>

>   children_repr = ",".join(repr(child) for child in self.children)

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = cos(Mul(log(cos(cos(x1))),Add(x1,Add(log(sin(sin(Mul(Mul(Mul(Mul(sin(cos(Add(Add(exp(Mul(Mul(x1,x1),cos(cos(log(log(lo...w(x1,-1))))),Pow(x1,-1))))))),Mul(x1,-1))),Pow(x1,-1)),Mul(x1,-1)),x1),-1)))),x1),Pow(x1,-1)),Pow(x1,-1)),x1)))),x1))))

    def __repr__(self):
>       children_repr = ",".join(repr(child) for child in self.children)

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <list_iterator object at 0x7f474c4a7810>

>   children_repr = ",".join(repr(child) for child in self.children)

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Mul(log(cos(cos(x1))),Add(x1,Add(log(sin(sin(Mul(Mul(Mul(Mul(sin(cos(Add(Add(exp(Mul(Mul(x1,x1),cos(cos(log(log(log(Ad...ow(x1,-1))))),Pow(x1,-1))))))),Mul(x1,-1))),Pow(x1,-1)),Mul(x1,-1)),x1),-1)))),x1),Pow(x1,-1)),Pow(x1,-1)),x1)))),x1)))

    def __repr__(self):
>       children_repr = ",".join(repr(child) for child in self.children)

.
.
.

program.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = sin(sin(x1))

    def __repr__(self):
>       children_repr = ",".join(repr(child) for child in self.children)
E       RecursionError: maximum recursion depth exceeded while calling a Python object

program.py:621: RecursionError

During handling of the above exception, another exception occurred:

model = <dso.core.DeepSymbolicOptimizer object at 0x7f49682a1a50>
minmax = (10, None)

    @pytest.mark.parametrize("minmax", [(10, 10), (4, 30), (None, 10), (10, None),
                                            (10, 10), (4, 30), (None, 10),])
    # NOTE: This test doesn't use a fixture cause n_objects has to be specified before building a fixture
    def test_length(model, minmax):
        """Test cases for LengthConstraint (for single- and multi-object Programs)."""
    
        min_, max_ = minmax
        model.setup()
    
        model.config_training.update(CONFIG_TRAINING_OVERRIDE)
        model.config_prior = {} # Turn off all other Priors
        model.config_prior["length"] = {"min_" : min_, "max_" : max_, "on" : True}
        model.config_training.update(CONFIG_TRAINING_OVERRIDE)
>       model.train()

test/test_prior.py:513: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
core.py:84: in train
    **self.config_training))
train.py:514: in learn
    results_add = logger.save_results(positional_entropy, top_samples_per_batch, r_history, pool, epoch, nevals)
train_stats.py:322: in save_results
    results = list(map(hof_work, hof))
train_stats.py:16: in hof_work
    return [p.r, p.on_policy_count, p.off_policy_count, repr(p.sympy_expr), repr(p), p.evaluate]
utils.py:71: in __get__
    value = self.getter(obj)
program.py:558: in sympy_expr
    expr = tree.__repr__()
program.py:621: in __repr__
    children_repr = ",".join(repr(child) for child in self.children)
program.py:621: in <genexpr>
    children_repr = ",".join(repr(child) for child in self.children)
program.py:621: in __repr__
    children_repr = ",".join(repr(child) for child in self.children)
.
.
.
program.py:621: in __repr__
    children_repr = ",".join(repr(child) for child in self.children)
program.py:621: in <genexpr>
    children_repr = ",".join(repr(child) for child in self.children)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = sin(sin(x1))

    def __repr__(self):
>       children_repr = ",".join(repr(child) for child in self.children)
E       RecursionError: maximum recursion depth exceeded while calling a Python object

program.py:621: RecursionError
---------------------------- Captured stdout setup -----------------------------
WARNING: Task type not specified. Falling back to default task type 'regression' to load config.
----------------------------- Captured stdout call -----------------------------

-- BUILDING DATASET START -----------
Benchmark path                 : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/benchmarks.csv
Generated data for benchmark   : Nguyen-1
Function set path              : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/function_sets.csv
Function set                   : Koza --> ['add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log']
-- BUILDING DATASET END -------------

WARNING: logdir not provided. Results will not be saved to file.
-- BUILDING PRIOR START -------------
WARNING: Skipping invalid 'RelationalConstraint' with arguments {'targets': [], 'effectors': [], 'relationship': None}. Reason: Prior disabled.
WARNING: Skipping invalid 'RepeatConstraint' with arguments {'tokens': 'const', 'min_': None, 'max_': 10}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'ConstConstraint' with arguments {}. Reason: Uses Tokens not in the Library.
WARNING: Skipping invalid 'NoInputsConstraint' with arguments {}. Reason: All terminal tokens are input variables, so allsequences will have an input variable.
WARNING: Skipping invalid 'UniformArityPrior' with arguments {}. Reason: Prior disabled.
WARNING: Skipping invalid 'LanguageModelPrior' with arguments {'weight': None}. Reason: Prior disabled.
LengthConstraint: Sequences have minimum length 4.
                  Sequences have maximum length 256.
RelationalConstraint: [exp] cannot be a child of [log].
InverseUnaryConstraint: RelationalConstraint: [log] cannot be a child of [exp].
TrigConstraint: [sin, cos] cannot be a descendant of [sin, cos].
SoftLengthPrior: No description available.
-- BUILDING PRIOR END ---------------

entropy gamma  0.7

-- BUILDING DATASET START -----------
Benchmark path                 : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/benchmarks.csv
Generated data for benchmark   : Nguyen-1
Function set path              : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/function_sets.csv
Function set                   : Koza --> ['add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log']
-- BUILDING DATASET END -------------

WARNING: logdir not provided. Results will not be saved to file.
-- BUILDING PRIOR START -------------

LengthConstraint: Sequences have minimum length 10.
-- BUILDING PRIOR END ---------------

entropy gamma  0.7
WARNING: Maximum length not constrained. Sequences will stop at 256 and complete by repeating the first input variable.
-- RUNNING EPOCHS START -------------
[00:00:00:00.64] Training epoch 1/10, current best R: 0.4574

	** New best
	Reward: 0.45740543982896903
	Count Off-policy: 0
	Count On-policy: 1
	Originally on Policy: True
	Invalid: False
	Traversal: cos,sin,exp,exp,cos,div,x1,div,cos,sin,cos,x1,x1
	Expression:
	     ⎛   ⎛ ⎛    ⎛         2       ⎞⎞⎞⎞
	     ⎜   ⎜ ⎜    ⎜       x₁        ⎟⎟⎟⎟
	     ⎜   ⎜ ⎜ cos⎜─────────────────⎟⎟⎟⎟
	     ⎜   ⎜ ⎜    ⎝cos(sin(cos(x₁)))⎠⎟⎟⎟
	     ⎜   ⎜ ⎝ℯ                      ⎠⎟⎟
	  cos⎝sin⎝ℯ                         ⎠⎠

[00:00:00:00.99] Training epoch 2/10, current best R: 0.6751

	** New best
	Reward: 0.6751417305614582
	Count Off-policy: 0
	Count On-policy: 1
	Originally on Policy: True
	Invalid: False
	Traversal: mul,sin,x1,mul,exp,sin,x1,cos,cos,x1
	Expression:
	   sin(x₁)                     
	  ℯ       ⋅sin(x₁)⋅cos(cos(x₁))

[00:00:00:03.25] Training epoch 10/10, current best R: 0.6751
[00:00:00:03.25] Ending training after epoch 10/10, current best R: 0.6751
-- RUNNING EPOCHS END ---------------

-- EVALUATION START ----------------
----------------------------- Captured stderr call -----------------------------
Exception ignored in: <function GPController.__del__ at 0x7f49a81b45f0>
Traceback (most recent call last):
  File "/home/sam/code/discovery/deep-symbolic-optimization/dso/dso/gp/gp_controller.py", line 270, in __del__
    del self.creator.FitnessMin
AttributeError: FitnessMin
______________________________ test_state_checker ______________________________

model = <dso.core.DeepSymbolicOptimizer object at 0x7f46ec4f9910>

    def test_state_checker(model):
        """Test cases for StateCheckerConstraint."""
    
        # set non-empty decision_tree_threshold_set so as to add StateCheckers to Library
        model.config_task["decision_tree_threshold_set"] = [0.2, 0.4, 0.6, 0.8]
        model.config_prior = {} # Turn off all other Priors
        model.config_prior["state_checker"] = {"on" : True}
        model.config_training.update(CONFIG_TRAINING_OVERRIDE)
>       model.train()

test/test_prior.py:570: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
core.py:75: in train
    self.setup()
core.py:68: in setup
    self.prior = self.make_prior()
core.py:141: in make_prior
    prior = make_prior(Program.library, self.config_prior)
prior.py:43: in make_prior
    prior_class = import_custom_source(prior_type)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

import_source = 'state_checker'

    def import_custom_source(import_source):
        """
        Provides a way to import custom modules. The return will be a reference to the desired source
        Parameters
        ----------
            import_source : import path
                Source to import from, for most purposes: <module_name>:<class or function name>
    
        Returns
        -------
            mod : ref
                reference to the imported module
        """
    
        # Partially validates if the import_source is in correct format
        regex = '[\w._]+:[\w._]+' #lib_name:class_name
        m = re.match(pattern=regex, string=import_source)
        # Partial matches mean that the import will fail
>       assert m is not None and m.end() == len(import_source), "*** Failed to import malformed source string: "+import_source
E       AssertionError: *** Failed to import malformed source string: state_checker

utils.py:214: AssertionError
---------------------------- Captured stdout setup -----------------------------
WARNING: Task type not specified. Falling back to default task type 'regression' to load config.
----------------------------- Captured stdout call -----------------------------

-- BUILDING DATASET START -----------
Benchmark path                 : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/benchmarks.csv
Generated data for benchmark   : Nguyen-1
Function set path              : /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/task/regression/function_sets.csv
Function set                   : Koza --> ['add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log']
-- BUILDING DATASET END -------------

WARNING: logdir not provided. Results will not be saved to file.
=============================== warnings summary ===============================
../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py:15
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py:15: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/util/nest.py:1286
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/util/nest.py:1286: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    _pywrap_tensorflow.RegisterType("Mapping", _collections.Mapping)

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/util/nest.py:1287
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/util/nest.py:1287: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    _pywrap_tensorflow.RegisterType("Sequence", _collections.Sequence)

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/training/tracking/object_identity.py:61
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/training/tracking/object_identity.py:61: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    class ObjectIdentityDictionary(collections.MutableMapping):

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/training/tracking/object_identity.py:112
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/training/tracking/object_identity.py:112: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    class ObjectIdentitySet(collections.MutableSet):

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/training/tracking/data_structures.py:374
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/training/tracking/data_structures.py:374: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    class _ListWrapper(List, collections.MutableSequence,

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/generator_io.py:26
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/generator_io.py:26: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    from collections import Container

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/contrib/labeled_tensor/python/ops/_typecheck.py:133
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/contrib/labeled_tensor/python/ops/_typecheck.py:133: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    return (isinstance(instance, collections.Iterable) and

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/contrib/labeled_tensor/python/ops/core.py:722
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/contrib/labeled_tensor/python/ops/core.py:722: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    tc.Tuple(string_types, collections.Hashable))),

../../../../../anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/contrib/labeled_tensor/python/ops/core.py:1058
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/contrib/labeled_tensor/python/ops/core.py:1058: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    @tc.accepts(string_types, collections.Callable)

dso/test/test_constant.py: 22 warnings
dso/test/test_core.py: 85 warnings
dso/test/test_multiobject.py: 374 warnings
dso/test/test_prior.py: 506 warnings
dso/test/custom_tasks/test_custom_task_prior.py: 44 warnings
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py:538: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
    tensor_proto.tensor_content = nparray.tostring()

dso/test/test_constant.py: 33 warnings
dso/test/test_core.py: 190 warnings
dso/test/test_multiobject.py: 12302 warnings
dso/test/test_prior.py: 14350 warnings
dso/test/custom_tasks/test_custom_task_prior.py: 300 warnings
  /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/program.py:153: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
    key = tokens.tostring()

dso/test/test_constant.py: 62 warnings
dso/test/test_core.py: 873 warnings
dso/test/test_multiobject.py: 12301 warnings
dso/test/test_prior.py: 20025 warnings
dso/test/custom_tasks/test_custom_task_prior.py: 1506 warnings
  /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/program.py:245: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
    self.str = tokens.tostring()

dso/test/test_constant.py: 59 warnings
dso/test/test_core.py: 1575 warnings
dso/test/test_prior.py: 13816 warnings
dso/test/custom_tasks/test_custom_task_prior.py: 3016 warnings
  /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/gp/base.py:79: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
    p = Program.cache[tokens.tostring()]

dso/test/test_core.py: 2 warnings
dso/test/test_multiobject.py: 11 warnings
dso/test/test_prior.py: 16 warnings
dso/test/custom_tasks/test_custom_task_prior.py: 2 warnings
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/deap/creator.py:141: RuntimeWarning: A class named 'Individual' has already been created and it will be overwritten. Consider deleting previous creation of that class or rename it.
    RuntimeWarning)

dso/test/test_core.py::test_model_parity[config/config_regression.json]
dso/test/test_prior.py::test_length[minmax0]
dso/test/test_prior.py::test_length[minmax2]
dso/test/test_prior.py::test_length[minmax5]
  /home/sam/anaconda3/envs/dso2/lib/python3.7/site-packages/deap/creator.py:141: RuntimeWarning: A class named 'FitnessMin' has already been created and it will be overwritten. Consider deleting previous creation of that class or rename it.
    RuntimeWarning)

dso/test/test_prior.py::test_repeat
  /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py:319: UserWarning: /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py (343) RepeatConstraint : Using a slower version of constraint for Deap. You should write your own.
    warnings.warn("{} ({}) {} : Using a slower version of constraint for Deap. You should write your own.".format(caller.filename, caller.lineno, type(self).__name__))

dso/test/test_prior.py::test_descendant
dso/test/test_prior.py::test_child
dso/test/test_prior.py::test_uchild
dso/test/test_prior.py::test_sibling
  /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py:319: UserWarning: /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py (343) RelationalConstraint : Using a slower version of constraint for Deap. You should write your own.
    warnings.warn("{} ({}) {} : Using a slower version of constraint for Deap. You should write your own.".format(caller.filename, caller.lineno, type(self).__name__))

dso/test/test_prior.py::test_trig
  /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py:319: UserWarning: /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py (343) TrigConstraint : Using a slower version of constraint for Deap. You should write your own.
    warnings.warn("{} ({}) {} : Using a slower version of constraint for Deap. You should write your own.".format(caller.filename, caller.lineno, type(self).__name__))

dso/test/test_prior.py::test_const
  /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py:319: UserWarning: /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py (343) ConstConstraint : Using a slower version of constraint for Deap. You should write your own.
    warnings.warn("{} ({}) {} : Using a slower version of constraint for Deap. You should write your own.".format(caller.filename, caller.lineno, type(self).__name__))

dso/test/test_prior.py::test_inverse
  /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py:319: UserWarning: /home/sam/code/discovery/deep-symbolic-optimization/dso/dso/prior.py (343) InverseUnaryConstraint : Using a slower version of constraint for Deap. You should write your own.
    warnings.warn("{} ({}) {} : Using a slower version of constraint for Deap. You should write your own.".format(caller.filename, caller.lineno, type(self).__name__))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED test/test_core.py::test_model_parity[config/config_regression.json] - ...
FAILED test/test_multiobject.py::test_multiobject_repeat - IndexError: pop fr...
FAILED test/test_multiobject.py::test_multiobject_relational - IndexError: po...
FAILED test/test_multiobject.py::test_multiobject_trig - IndexError: pop from...
FAILED test/test_prior.py::test_length[minmax3] - RecursionError: maximum rec...
FAILED test/test_prior.py::test_state_checker - AssertionError: *** Failed to...
=========== 6 failed, 29 passed, 81492 warnings in 727.94s (0:12:07) ===========

Thank you so much

OS: Ubuntu 20.04 LTS “Focal Fossa,”

Output of pip freeze is:

absl-py @ file:///home/conda/feedstock_root/build_artifacts/absl-py_1637088766493/work
astor @ file:///home/conda/feedstock_root/build_artifacts/astor_1593610464257/work
atari-py==0.2.9
attrs==21.4.0
box2d-py==2.3.8
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
certifi==2021.10.8
click==8.0.4
cloudpickle==1.2.2
commentjson==0.9.0
cycler==0.11.0
Cython==0.29.28
deap==1.3.1
dill==0.3.4
-e git+ssh://[email protected]/samholt/sd2.git@62f845d625e260d03efeefd5f9ddf7c3ec6a1c41#egg=dso&subdirectory=dso
fonttools==4.31.2
future==0.18.2
gast @ file:///home/conda/feedstock_root/build_artifacts/gast_1636964356021/work
google-pasta==0.2.0
grpcio @ file:///home/conda/feedstock_root/build_artifacts/grpcio_1624380491840/work
gym==0.15.4
h5py @ file:///home/conda/feedstock_root/build_artifacts/h5py_1624405626125/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1647210388949/work
iniconfig==1.1.1
joblib==1.1.0
Keras-Applications==1.0.8
Keras-Preprocessing @ file:///home/conda/feedstock_root/build_artifacts/keras-preprocessing_1610713559828/work
kiwisolver==1.4.0
lark-parser==0.7.8
llvmlite==0.36.0
Markdown @ file:///home/conda/feedstock_root/build_artifacts/markdown_1637220118004/work
matplotlib==3.5.1
mpi4py==3.1.3
mpmath==1.2.1
multiprocess==0.70.12.2
numba==0.53.1
numpy==1.19.0
opencv-python==4.5.5.64
packaging==21.3
pandas==1.3.5
pathos==0.2.8
Pillow==9.0.1
pluggy==1.0.0
pox==0.3.0
ppft==1.6.6.4
progress==1.6
protobuf==3.17.2
py==1.11.0
pybullet==3.2.1
pyglet==1.3.2
pyparsing==3.0.7
pytest==7.1.1
python-dateutil==2.8.2
pytz==2022.1
PyYAML==6.0
scikit-learn==1.0.2
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy_1626684342480/work
seaborn==0.11.2
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
stable-baselines==2.10.0
sympy==1.10.1
tensorboard==1.14.0
tensorflow @ file:///home/conda/feedstock_root/build_artifacts/tensorflow_1594833314895/work/tensorflow_pkg/tensorflow-1.14.0-cp37-cp37m-linux_x86_64.whl
tensorflow-estimator==1.14.0
termcolor==1.1.0
threadpoolctl==3.1.0
tomli==2.0.1
tqdm==4.63.0
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1644850595256/work
Werkzeug @ file:///home/conda/feedstock_root/build_artifacts/werkzeug_1644332431572/work
wrapt @ file:///home/conda/feedstock_root/build_artifacts/wrapt_1610094880759/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1643828507773/work

Any help is very much appreciated, thank you,

All the best,
Sam

Interactive Visualization Platform

Hello,
As you developed an interactive visualization platform for deep symbolic regression method, I want to know how I could find an instruction to use this platform (url) after installing the package.
Thanks

Error running PiecewiseFunction-1.json example, of Failed to import malformed source string: state_checker

Hi Brendon and Team,

Love the project, however running the PiecewiseFunction-1.json throws an error of the following:

python -m dso.run ./config/examples/regression/PiecewiseFunction-1.json

== EXPERIMENT SETUP START ===========
Task type            : regression
Dataset              : task/regression/data/PiecewiseFunction-1.csv
Starting seed        : 0
Runs                 : 1
== EXPERIMENT SETUP END =============

== TRAINING SEED 0 START ============
Traceback (most recent call last):
  File "/home/sam/anaconda3/envs/sd2/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/sam/anaconda3/envs/sd2/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/sam/code/discovery/sd2/dso/dso/run.py", line 156, in <module>
    main()
  File "/home/sam/anaconda3/envs/sd2/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/sam/anaconda3/envs/sd2/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/sam/anaconda3/envs/sd2/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sam/anaconda3/envs/sd2/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/sam/code/discovery/sd2/dso/dso/run.py", line 139, in main
    result, summary_path = train_dso(config)
  File "/home/sam/code/discovery/sd2/dso/dso/run.py", line 33, in train_dso
    result = model.train()
  File "/home/sam/code/discovery/sd2/dso/dso/core.py", line 74, in train
    self.setup()
  File "/home/sam/code/discovery/sd2/dso/dso/core.py", line 67, in setup
    self.prior = self.make_prior()
  File "/home/sam/code/discovery/sd2/dso/dso/core.py", line 140, in make_prior
    prior = make_prior(Program.library, self.config_prior)
  File "/home/sam/code/discovery/sd2/dso/dso/prior.py", line 43, in make_prior
    prior_class = import_custom_source(prior_type)
  File "/home/sam/code/discovery/sd2/dso/dso/utils.py", line 214, in import_custom_source
    assert m is not None and m.end() == len(import_source), "*** Failed to import malformed source string: "+import_source
AssertionError: *** Failed to import malformed source string: state_checker

Could you let me know what I can do to fix this, or point me in the right direction, it seems it is trying to find a custom prior called state checker, that cannot be found and error's, I could be incorrect here.

Thank you so much, really excited to use DSO for our current research applied projects,

OS: Ubuntu 20.04 LTS “Focal Fossa,”

Output of pip freeze is:

absl-py @ file:///home/conda/feedstock_root/build_artifacts/absl-py_1637088766493/work
astor @ file:///home/conda/feedstock_root/build_artifacts/astor_1593610464257/work
atari-py==0.2.9
attrs==21.4.0
box2d-py==2.3.8
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
certifi==2021.10.8
click==8.0.4
cloudpickle==1.2.2
commentjson==0.9.0
cycler==0.11.0
Cython==0.29.28
deap==1.3.1
dill==0.3.4
-e git+ssh://[email protected]/samholt/sd2.git@62f845d625e260d03efeefd5f9ddf7c3ec6a1c41#egg=dso&subdirectory=dso
fonttools==4.31.2
future==0.18.2
gast @ file:///home/conda/feedstock_root/build_artifacts/gast_1636964356021/work
google-pasta==0.2.0
grpcio @ file:///home/conda/feedstock_root/build_artifacts/grpcio_1624380491840/work
gym==0.15.4
h5py @ file:///home/conda/feedstock_root/build_artifacts/h5py_1624405626125/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1647210388949/work
iniconfig==1.1.1
joblib==1.1.0
Keras-Applications==1.0.8
Keras-Preprocessing @ file:///home/conda/feedstock_root/build_artifacts/keras-preprocessing_1610713559828/work
kiwisolver==1.4.0
lark-parser==0.7.8
llvmlite==0.36.0
Markdown @ file:///home/conda/feedstock_root/build_artifacts/markdown_1637220118004/work
matplotlib==3.5.1
mpi4py==3.1.3
mpmath==1.2.1
multiprocess==0.70.12.2
numba==0.53.1
numpy==1.19.0
opencv-python==4.5.5.64
packaging==21.3
pandas==1.3.5
pathos==0.2.8
Pillow==9.0.1
pluggy==1.0.0
pox==0.3.0
ppft==1.6.6.4
progress==1.6
protobuf==3.17.2
py==1.11.0
pybullet==3.2.1
pyglet==1.3.2
pyparsing==3.0.7
pytest==7.1.1
python-dateutil==2.8.2
pytz==2022.1
PyYAML==6.0
scikit-learn==1.0.2
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy_1626684342480/work
seaborn==0.11.2
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
stable-baselines==2.10.0
sympy==1.10.1
tensorboard==1.14.0
tensorflow @ file:///home/conda/feedstock_root/build_artifacts/tensorflow_1594833314895/work/tensorflow_pkg/tensorflow-1.14.0-cp37-cp37m-linux_x86_64.whl
tensorflow-estimator==1.14.0
termcolor==1.1.0
threadpoolctl==3.1.0
tomli==2.0.1
tqdm==4.63.0
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1644850595256/work
Werkzeug @ file:///home/conda/feedstock_root/build_artifacts/werkzeug_1644332431572/work
wrapt @ file:///home/conda/feedstock_root/build_artifacts/wrapt_1610094880759/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1643828507773/work

Any help is very much appreciated, thank you,

All the best,
Sam

Got error installing dso

Tried to install dso, but got the following error:
What happened?
I downloaded the code file and in the root folder execute the following

pip install -e ./dso[all]

(I am using python 3.9 on windows)

ERROR: Could not find a version that satisfies the requirement tensorflow==1.14 (from dso[all]) (from versions: 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1, 2.12.0rc0, 2.12.0rc1)
ERROR: No matching distribution found for tensorflow==1.14

It would be appreciated very much for any hints/guidance.
Best,

How to save DSR regression model by pickle?

211103.zip
Hi! I'm Jihyeon Park from South Korea.
I really impressed your concept and idea.
Now I'm adapting your code in my data.

Here's a question.
Like other machine learning models, I tried to save the model that finished learning by pickle, but failed.

I read your documents to find information in terms of 'save', but I could not find it.
So, could you tell me how to save the model?
I attach my code and data file.

Thank you.

Evaluation taking much longer than the running epochs

I've adapted this incredible repo to my custom environment and eventually managed to get it to train. It does take a very long time per epoch even with 10 dedicated cores due to the complexity of the environment.

For the sake of curiosity, I reduced the epochs down to 10 so that I could see what happens once the running phase is over.
The 10 epochs under my environment took approximately 32 minutes.

From train.py I saw that epochs run until nevals is larger than n_samples which is effectively the total epoch time to my understanding.

image
image

Looking into the functions following that they should not have much complexity and therefore I would expect the evaluation time to take about the same if not slightly more than the running epochs time. Unfortunately, it is taking much much longer than that and this is still all that I see:
image

Have I done something wrong or is this a bug?
below I will put my config file:
image

Installation failed

Dear Petersen,

Thank you very much for this great package. I have tried to install it on a Mac with a clean Python 3.6 in a virtual environment following the instructions but it fails. Here is the error:

(DSO_v2) igor@iMac-SB deep-symbolic-optimization-master % pip install -e ./dso
Obtaining file:///Users/igor/Downloads/deep-symbolic-optimization-master/dso
Preparing metadata (setup.py) ... done
Requirement already satisfied: pytest in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (7.0.1)
Requirement already satisfied: cython in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (0.29.32)
Requirement already satisfied: numpy<=1.19 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (1.19.0)
Requirement already satisfied: tensorflow==1.14 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (1.14.0)
Requirement already satisfied: numba==0.53.1 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (0.53.1)
Requirement already satisfied: sympy in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (1.9)
Requirement already satisfied: pandas in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (1.1.5)
Requirement already satisfied: scikit-learn in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (0.24.2)
Requirement already satisfied: click in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (8.0.4)
Requirement already satisfied: deap in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (1.3.3)
Requirement already satisfied: pathos in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (0.2.8)
Requirement already satisfied: seaborn in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (0.11.2)
Requirement already satisfied: progress in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (1.6)
Requirement already satisfied: tqdm in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (4.64.1)
Requirement already satisfied: commentjson in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (0.9.0)
Requirement already satisfied: PyYAML in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from dso==1.0.dev0) (6.0)
Requirement already satisfied: llvmlite<0.37,>=0.36.0rc1 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from numba==0.53.1->dso==1.0.dev0) (0.36.0)
Requirement already satisfied: setuptools in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from numba==0.53.1->dso==1.0.dev0) (59.6.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.1.2)
Requirement already satisfied: six>=1.10.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.16.0)
Requirement already satisfied: wheel>=0.26 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (0.37.1)
Requirement already satisfied: astor>=0.6.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (0.8.1)
Requirement already satisfied: absl-py>=0.7.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.3.0)
Requirement already satisfied: google-pasta>=0.1.6 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (0.2.0)
Requirement already satisfied: wrapt>=1.11.1 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.14.1)
Requirement already satisfied: protobuf>=3.6.1 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (3.19.6)
Requirement already satisfied: keras-applications>=1.0.6 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.0.8)
Requirement already satisfied: termcolor>=1.1.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.1.0)
Requirement already satisfied: grpcio>=1.8.6 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.48.2)
Requirement already satisfied: gast>=0.2.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (0.5.3)
Requirement already satisfied: tensorboard<1.15.0,>=1.14.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.14.0)
Requirement already satisfied: tensorflow-estimator<1.15.0rc0,>=1.14.0rc0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorflow==1.14->dso==1.0.dev0) (1.14.0)
Requirement already satisfied: importlib-metadata in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from click->dso==1.0.dev0) (4.8.3)
Requirement already satisfied: lark-parser<0.8.0,>=0.7.1 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from commentjson->dso==1.0.dev0) (0.7.8)
Requirement already satisfied: python-dateutil>=2.7.3 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pandas->dso==1.0.dev0) (2.8.2)
Requirement already satisfied: pytz>=2017.2 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pandas->dso==1.0.dev0) (2022.7)
Requirement already satisfied: ppft>=1.6.6.4 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pathos->dso==1.0.dev0) (1.6.6.4)
Requirement already satisfied: pox>=0.3.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pathos->dso==1.0.dev0) (0.3.0)
Requirement already satisfied: multiprocess>=0.70.12 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pathos->dso==1.0.dev0) (0.70.12.2)
Requirement already satisfied: dill>=0.3.4 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pathos->dso==1.0.dev0) (0.3.4)
Requirement already satisfied: iniconfig in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pytest->dso==1.0.dev0) (1.1.1)
Requirement already satisfied: pluggy<2.0,>=0.12 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pytest->dso==1.0.dev0) (1.0.0)
Requirement already satisfied: packaging in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pytest->dso==1.0.dev0) (21.3)
Requirement already satisfied: py>=1.8.2 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pytest->dso==1.0.dev0) (1.11.0)
Requirement already satisfied: attrs>=19.2.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pytest->dso==1.0.dev0) (22.2.0)
Requirement already satisfied: tomli>=1.0.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from pytest->dso==1.0.dev0) (1.2.3)
Requirement already satisfied: joblib>=0.11 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from scikit-learn->dso==1.0.dev0) (1.1.1)
Requirement already satisfied: scipy>=0.19.1 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from scikit-learn->dso==1.0.dev0) (1.5.4)
Requirement already satisfied: threadpoolctl>=2.0.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from scikit-learn->dso==1.0.dev0) (3.1.0)
Requirement already satisfied: matplotlib>=2.2 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from seaborn->dso==1.0.dev0) (3.3.4)
Requirement already satisfied: mpmath>=0.19 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from sympy->dso==1.0.dev0) (1.2.1)
Requirement already satisfied: importlib-resources in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tqdm->dso==1.0.dev0) (5.4.0)
Requirement already satisfied: typing-extensions>=3.6.4 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from importlib-metadata->click->dso==1.0.dev0) (4.1.1)
Requirement already satisfied: zipp>=0.5 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from importlib-metadata->click->dso==1.0.dev0) (3.6.0)
Requirement already satisfied: h5py in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from keras-applications>=1.0.6->tensorflow==1.14->dso==1.0.dev0) (3.1.0)
Requirement already satisfied: pillow>=6.2.0 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from matplotlib>=2.2->seaborn->dso==1.0.dev0) (8.4.0)
Requirement already satisfied: cycler>=0.10 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from matplotlib>=2.2->seaborn->dso==1.0.dev0) (0.11.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from matplotlib>=2.2->seaborn->dso==1.0.dev0) (3.0.9)
Requirement already satisfied: kiwisolver>=1.0.1 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from matplotlib>=2.2->seaborn->dso==1.0.dev0) (1.3.1)
Requirement already satisfied: markdown>=2.6.8 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14->dso==1.0.dev0) (3.3.7)
Requirement already satisfied: werkzeug>=0.11.15 in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14->dso==1.0.dev0) (2.0.3)
Requirement already satisfied: dataclasses in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from werkzeug>=0.11.15->tensorboard<1.15.0,>=1.14.0->tensorflow==1.14->dso==1.0.dev0) (0.8)
Requirement already satisfied: cached-property in /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages (from h5py->keras-applications>=1.0.6->tensorflow==1.14->dso==1.0.dev0) (1.5.2)
Installing collected packages: dso
Running setup.py develop for dso
ERROR: Command errored out with exit status 1:
command: /Users/igor/Documents/ProjSymbReg/code/DSO_v2/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/igor/Downloads/deep-symbolic-optimization-master/dso/setup.py'"'"'; file='"'"'/Users/igor/Downloads/deep-symbolic-optimization-master/dso/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps
cwd: /Users/igor/Downloads/deep-symbolic-optimization-master/dso/
Complete output (28 lines):
running develop
running egg_info
writing dso.egg-info/PKG-INFO
writing dependency_links to dso.egg-info/dependency_links.txt
writing requirements to dso.egg-info/requires.txt
writing top-level names to dso.egg-info/top_level.txt
reading manifest file 'dso.egg-info/SOURCES.txt'
writing manifest file 'dso.egg-info/SOURCES.txt'
running build_ext
building 'dso.cyfunc' extension
clang -DNDEBUG -g -fwrapv -O3 -Wall -I -I -I /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include -I /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include -I /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include -I -I/Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include -I/Users/igor/Documents/ProjSymbReg/code/DSO_v2/include -I/Users/igor/.pyenv/versions/3.6.15/include/python3.6m -I/Users/igor/Documents/ProjSymbReg/code/DSO_v2/include -I/Users/igor/.pyenv/versions/3.6.15/include/python3.6m -c dso/cyfunc.c -o build/temp.macosx-12.6-x86_64-3.6/dso/cyfunc.o
In file included from dso/cyfunc.c:759:
In file included from /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822:
/Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with "
^
1 warning generated.
clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/[email protected]/lib -L/Users/igor/.pyenv/versions/3.6.15/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/[email protected]/lib -L/Users/igor/.pyenv/versions/3.6.15/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -I -I -I /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include -I /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include -I /Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/numpy/core/include -I build/temp.macosx-12.6-x86_64-3.6/dso/cyfunc.o -o build/lib.macosx-12.6-x86_64-3.6/dso/cyfunc.cpython-36m-darwin.so
clang: error: no input files
/Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/setuptools/dist.py:493: UserWarning: Normalizing '1.0dev' to '1.0.dev0'
warnings.warn(tmpl.format(**locals()))
/Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
EasyInstallDeprecationWarning,
/Users/igor/Documents/ProjSymbReg/code/DSO_v2/lib/python3.6/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/igor/Documents/ProjSymbReg/code/DSO_v2/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/igor/Downloads/deep-symbolic-optimization-master/dso/setup.py'"'"'; file='"'"'/Users/igor/Downloads/deep-symbolic-optimization-master/dso/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

Any help would be appreciated.

failed on installtion

I try to install it on Ubuntu , but i always meet the following error.
× python setup.py egg_info did not run successfully.
│ exit code: 1

× Building wheel for numpy (pyproject.toml) did not run successfully.

How to calculate recovery rate?

Dear Petersen,

You define the recovery rate as "exact symbolic equivalence" in your paper. I do not understand why some recovery rates are between 0 to 1. For example, in table 1, the rate is 0.35 for Nguyen-7 when using DSR. How do you calculate this value? Intuitively, you will either obtain the exact expression (recovery rate is 1), or fail to obtain the right expression (recovery rate is 0).

An unexpected keyword argument 'optimize'

Thanks for your excellent work, I have a question about the argument:
When I fixed the action of the first dimension as a symbolic policy on the "LunarLanderContinuous-v2" environment, the program reported an error:
TypeError: from_str_tokens() got an unexpected keyword argument 'optimize'
in control.py, line 193.
I ran successfully with "optimize" removed. However, the results of the run cannot reach the results in the paper (I get lower r_avg_test than 238 many times, while the paper is 251.66).
So I'm wondering how to run it successfully without removing "optimize" and get the results in the paper.

Here is my config file:
// This example contains the tuned entropy_weight and entropy_gamma
// hyperparameters used to solve LunarLanderContinuous-v2
{
"task" : {
"task_type" : "control",
"env" : "LunarLanderContinuous-v2",
"action_spec" : [["exp","cos","exp","mul","div","add","sub","add","add","add","exp", "add","add","add","add","x2","x4","x4","5.0","x4","1.0","x5","x4","x4 ","5.0","x4","x4"], null],
},
"training" : {
// Recommended to set this to as many cores as you can use!
"n_cores_batch" : 16
},
"controller" : {
"entropy_weight" : 0.02,
"entropy_gamma" : 0.85
},
}

Feature : Custom cost function

Hello,

Just wondering, how we can use custom cost function ?

def mycost(formuale_str)  : 


   cost = myfun( eval(formulae_str)  ,....)

    return cost

For many problems, cost is very customized.

avoid overtraining

Hello, I have simple 1D function to be fitted, but all the best solution are very overtrained. Example:

Schermata da 2022-04-28 15-36-36

the red one is proposed by deep-symbolic-optimization, the green one is just a polynominal of 9th degree.

{
    "task" : {
        "task_type" : "regression",
        "dataset" : "mydataset.csv",
        "function_set" : ["add", "sub", "mul", "div", "log", "sin", "cos", "exp", "const"]
    },
    "controller": {"max_length": 16},
    "prior": {"length": {"max_": 16}}

}

mydataset.csv:

9.00e+01, 1.22e-03
9.50e+01, 1.39e-03
1.00e+02, 1.58e-03
1.05e+02, 1.77e-03
1.10e+02, 1.95e-03
1.15e+02, 2.11e-03
1.20e+02, 2.23e-03
1.25e+02, 2.28e-03
1.30e+02, 2.24e-03
1.35e+02, 2.12e-03
1.40e+02, 1.93e-03
1.45e+02, 1.67e-03
1.50e+02, 1.36e-03
1.60e+02, 5.32e-04
1.70e+02, 1.58e-04
1.80e+02, 1.05e-04
1.90e+02, 7.05e-05
2.00e+02, 5.51e-05
2.10e+02, 4.54e-05

how to install this library

I use this command "pip install -e ./dso[all]" to install this library to my computer, but an error occured. this is the error:

ERROR: ./dso[all] is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

could you help me?

How to select a specific set of operators for the training

Hi there,

I have recently found this nice library for symbolic regression. Being used to sklearn interface, I was wondering whether it is possible to modify the config file (and how) such that only a few operators are chosen amongst the default set which includes everything. Using the default set gives me decent results for my regression problem, however the best expression contains exp and trig terms which I would like to avoid as much as possible as they make the results a bit harder to interpret.

Best,
Sam

#ValueError: to get argmax of an empty sequence

Hi,

I get an error:
ValueError: attempt to get argmax of an empty sequence
when I include a "const" token to the library.

I would really appreciate your help with this.

Here the full set up for replication (csv test file attached):

config =  { 
...     "task" : {  "task_type" : "regression",
...     "dataset" : "/Project_dir/data/DSR_real_test.csv",
...                         "metric": "inv_nmse", # "r2_shift" "inv_nmse"
...                         "metric_params": (0,),  
...     "function_set" : ["add", "sub", "mul", "div",  "exp", "log", "sqrt","const"],
...     "reward_noise_type" : "y_hat"
...     # "reward_noise": 0.7 # , "const"
... } ,
...     "training" : {     "n_cores_batch" : -1,
...     "save_pareto_front": False
...         },
...         "prior": {
...         "length": {
...         "min_": 3,
...         "max_": 10,
...         "on": True
...     }}}

with open('/Project_dir/config.json', 'w') as f:
...     json.dump(config, f)
...
os.system('python -m dso.run /Project_dir/config.json') 
Traceback (most recent call last):
  File "", line 1, in
NameError: name 'os' is not defined
import time
import json
import copy
import os
import pandas as pd
pd.set_option("display.max_rows", 1000)
import sys
sys.setrecursionlimit(2500)
import numpy as np
import pickle
config =  { 
...     "task" : {  "task_type" : "regression",
...     "dataset" : "/Project_dir/data/DSR_real_test.csv",
...                         "metric": "inv_nmse", # "r2_shift" "inv_nmse"
...                         "metric_params": (0,),  
...     "function_set" : ["add", "sub", "mul", "div",  "exp", "log", "sqrt","const"],
...     "reward_noise_type" : "y_hat"
...     # "reward_noise": 0.7 # , "const"
... } ,
...     "training" : {     "n_cores_batch" : -1,
...     "save_pareto_front": False
...         },
...         "prior": {
...         "length": {
...         "min_": 3,
...         "max_": 10,
...         "on": True
...     }}}

with open('/Project_dir/config.json', 'w') as f:
...     json.dump(config, f)
...
os.system('python -m dso.run /Project_dir/config.json') 
 
== EXPERIMENT SETUP START ===========
Task type            : regression
Dataset              : /Project_dir/data/DSR_real_test.csv
Starting seed        : 0
Runs                 : 1
== EXPERIMENT SETUP END =============
 
== TRAINING SEED 0 START ============
-- BUILDING PRIOR START -------------
WARNING: Skipping invalid 'RelationalConstraint' with arguments {'targets': [], 'effectors': [], 'relationship': None}. Reason: Prior disabled.
WARNING: Skipping invalid 'TrigConstraint' with arguments {}. Reason: There are no target Tokens.
WARNING: Skipping invalid 'UniformArityPrior' with arguments {}. Reason: Prior disabled.
WARNING: Skipping invalid 'LanguageModelPrior' with arguments {'weight': None}. Reason: Prior disabled.
LengthConstraint: Sequences have minimum length 3.
                  Sequences have maximum length 10.
RepeatConstraint: [const] cannot occur more than 10 times.
RelationalConstraint: [exp] cannot be a child of [log].
InverseUnaryConstraint: RelationalConstraint: [log] cannot be a child of [exp].
ConstConstraint: [const] cannot be the only unique child of [exp, log, sqrt, add, sub, mul, div].
NoInputsConstraint: Sequences contain at least one input variable Token.
SoftLengthPrior: No description available.
-- BUILDING PRIOR END ---------------
 
WARNING: max_length (256) will be overridden by value from LengthConstraint (10).
-- RUNNING EPOCHS START -------------
Traceback (most recent call last):
  File "/Users/User/.pyenv/versions/3.6.15/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "main", mod_spec)
  File "/Users/User/.pyenv/versions/3.6.15/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Project_dir/dso/dso/run.py", line 156, in
    main()
  File "/Project_dir/lib/python3.6/site-packages/click/core.py", line 1128, in call
    return self.main(*args, **kwargs)
  File "/Project_dir/lib/python3.6/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Project_dir/lib/python3.6/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Project_dir/lib/python3.6/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Project_dir/dso/dso/run.py", line 139, in main
    result, summary_path = train_dso(config)
  File "/Project_dir/dso/dso/run.py", line 33, in train_dso
    result = model.train()
  File "/Project_dir/dso/dso/core.py", line 83, in train
    **self.config_training))
  File "/Project_dir/dso/dso/train.py", line 446, in learn
    priority_queue.push_best(sampled_batch, programs)
  File "/Project_dir/dso/dso/memory.py", line 314, in push_best
    i = np.argmax(batch.rewards)
  File "<array_function internals>", line 6, in argmax
  File "/Project_dir/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 1188, in argmax
    return _wrapfunc(a, 'argmax', axis=axis, out=out)
  File "/Project_dir/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 58, in _wrapfunc
    return bound(*args, **kwds)
ValueError: attempt to get argmax of an empty sequence

DSR_real_test.csv

Questions and possible errors.

Hello,

I am a student and intend to use DSO in my work as I find the concept interesting. I am studying the code, and today I have some problems understanding some lines of code in program.py:

  1. a tostring method is used twice, and I don't find where it is defined, I also don't think it is a python built-in function.

  2. in from_str_tokens in the part where a list of str|float is converted into a list of tokens we have those lines:

for s in str_tokens:
    if s in Program.library.names:
        t = Program.library.names.index(s.lower())
    elif U.is_float(s):
        assert "const" not in str_tokens, "Currently blablabla..."
        t = Program.library.const_token
        constants.append(float(s))
    else:
        raise ValueError("Did not blablabla...")
    traversal.append(t)
traversal = np.array(traversal, dtype=np.int32)

Say we have no PlaceholderConstant in the library. Then according to library.py, Program.library.const_token should be equal to None. Say we have a float in str_tokens. Then we go to the elif part. There is no assertion error since there is no PlaceholderConstant in the library and thus no "const" in the list attribute Program.library.names. So t is set to None and is added to traversal. This should, as I understand it, raise this error:

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

in the last line of code (the one converting traversal into a numpy array of integers).

  1. in set_constants, it is written assert U.is_float, "Input blablabla...", but I believe it should be: assert U.is_float(const), "Input blablabla...".

Anyway, even if the things I pointed are errors indeed, it should not be a problem for me as I should only use HardcodedConstant. But as I intend to use your work, I better understand the code in depth.

Looking forward to your reply,
Respectfully, TOP1RM

Is it possible to provide a Sklearn wrapper for this code?

This work is unprecedented in the symbolic regression domain, and I think it can work as a good benchmark in machine learning and the symbolic regression domain. Although the code is well written and easy to understand, I feel that providing a Sklearn wrapper will further let other people use this method easier in their own code. Therefore, is it possible to provide a Sklearn wrapper for this code?

Install on MAC OS

To whom it may concern,

I have tried several versions (using venv) of Python on OSX to install DSO and all have failed on pip install -e ./dso

3.11.0 & 3.9.13 result in SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.

Tried several items like no cache; pip install wheel, .. others suggested going to an older version of python as shown below

3.8.10 results in ERROR: Could not find a version that satisfies the requirement tensorflow==1.14

Any help or direction would be appreciated.

Thanks,

Kurt

*** Try following instructions to install dos on Mac using python 3.11.0 ***

Obtaining file:///Users//opt/venv6/dso
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [872 lines of output]
/Users/kpflugho/opt/venv6/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
WARNING: The wheel package is not available.
error: subprocess-exited-with-error

    × Building wheel for numpy (pyproject.toml) did not run successfully.

*** Try following instructions to install dos on Mac using older python 3.9.13 same error ***

(venv5) (base) KPFLUGHO-ML:venv5 kpflugho$ pip install -e ./dso
Obtaining file:///Users/kpflugho/opt/venv5/dso
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [659 lines of output]
/Users/kpflugho/opt/venv5/venv5/lib/python3.9/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
WARNING: The wheel package is not available.
error: subprocess-exited-with-error

    × Building wheel for numpy (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [619 lines of output]
        Running from numpy source directory.
        /private/var/folders/f0/xv023w992bjc9yl2ddz_hfr409kf8g/T/pip-wheel-kdbctj66/numpy_724f3c3b1f85491b9f623ec3c6cb0fb0/tools/cythonize.py:73: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

*** try an older version of python 3.8.10 different error ***

ERROR: Could not find a version that satisfies the requirement tensorflow==1.14 (from dso) (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2)
ERROR: No matching distribution found for tensorflow==1.14

Questions on installation

I am trying to install this great package on my Linux through Docker but keep running into the error below, which obviously is not an issue of the provided install tutorial but might be resulted from surfing on Docker. After running pip install -e ./dso,

/root/anaconda3/compiler_compat/ld: error: /root/anaconda3/lib/python3.7/site-packages/numpy/core/include: read: Is a directory
   collect2: error: ld returned 1 exit status
   /root/anaconda3/lib/python3.7/site-packages/setuptools/dist.py:516: UserWarning: Normalizing '1.0dev' to '1.0.dev0'
     warnings.warn(tmpl.format(**locals()))
   /root/anaconda3/lib/python3.7/site-packages/setuptools/command/easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
     EasyInstallDeprecationWarning,
   /root/anaconda3/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
     setuptools.SetuptoolsDeprecationWarning,
   error: command '/usr/bin/gcc' failed with exit code 1

I post this error here wondering if anyone has the experience to fix the 'read' issue when installing this package in a Docker container

Failed to install

Dear Brenden Petersen,

Thanks for sharing your work.

I am trying to use conda to install the core packages. However, an error always happens, and I cannot figure out how to solve it. Could you help me, please?

The steps I did:

  1. Create a virtual environment: conda create -n dsr python=3.8
  2. Install core packages in the virtual environment: conda activate dsr, and pip install -e ./dso[all]

The error is
Screenshot from 2021-12-08 09-34-10

Could you give some suggestions, please?

Best,
Hongwei Tang

CPU low load

Hi,

I am not sure whether it is a bug or a feature of this package.

I've noticed that CPU cores are loaded for no more than 6% at most. I provide all the cores available on the system and it uses all the cores but the load is very low. It happens both on my local Intel Mac and on GCC (see a screenshot below).

Here is the config.json file (everything else if default). Data is random with 10000 obs and 2 predictors.

{ "experiment": {
"logdir": None
},
"task" : {
"task_type" : "regression",
"metric": "inv_nmse",
"metric_params": (0,),
"function_set" : ["add", "sub", "mul", "div", "exp", "log", "sqrt" ,"const"] #
} ,
"training" : { #"epsilon" : 0.05,
"n_cores_batch" : -1 # "epsilon" : 1,
},
"prior": {
"length": {
"min_": 3,
"max_": 15,
"on": True
}}}

image

Install it on Windows

I am really exicted to find such a wonderful tool,but,the only problem is that how can i use it on Windows or just install it with pip other than downloading it.

Support for RTX 3090 by targeting Cuda 11 or newer.

In my previous ticket #17 I just realized that I can't run this project. I've ran other Cuda 11 projects and just assumed I could downgrade and run old projects, but that doesn't appear to be the case. Seems like all Tensorflow 1.14 projects don't run. This might be asking a lot (not sure the number of changes) but could this project be updated to work with the newest Tensorflow and Cuda or at least Cuda 11 compatible versions.

multiprocessing error for:“LunarLander_multiobject.json”

This codebase is really cool.
However, I got a multithreading error when using the LunarLander_multiobject.json configuration file:

Traceback (most recent call last):
File "/home/l/miniconda3/envs/dso/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/l/miniconda3/envs/dso/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/l/deep-symbolic-optimization/dso/dso/run.py", line 156, in
main()
File "/home/l/miniconda3/envs/dso/lib/python3.7/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/home/l/miniconda3/envs/dso/lib/python3.7/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/l/miniconda3/envs/dso/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/l/miniconda3/envs/dso/lib/python3.7/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/l/deep-symbolic-optimization/dso/dso/run.py", line 139, in main
result, summary_path = train_dso(config)
File "/home/l/deep-symbolic-optimization/dso/dso/run.py", line 33, in train_dso
result = model.train()
File "/home/l/deep-symbolic-optimization/dso/dso/core.py", line 83, in train
**self.config_training))
File "/home/l/deep-symbolic-optimization/dso/dso/train.py", line 276, in learn
pool_p_dict = { p.str : p for p in pool.map(work, programs_to_optimize) }
File "/home/l/miniconda3/envs/dso/lib/python3.7/multiprocessing/pool.py", line 268, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/home/l/miniconda3/envs/dso/lib/python3.7/multiprocessing/pool.py", line 657, in get
raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: '[div,log,add,exp,sub,cos,div,log,div,add,x1,x3,x2,x4,x5,sin,x4,x5,add,cos,log,mul,mul,add,sub,log,mul,exp,1.0,exp,mul,div,x1,add,x7,x1,x6,x6,x8,5.0,1.0,5.0, exp,add,add,mul,sub,sub,x6,div,x2,cos,sub,5.0,x7,0.1,x1,0.1,5.0,exp,sub,sub,add,div,x6,cos,log,x5,exp,5.0,5.0,mul,mul,mul,mul,x6,1.0,x4,x1,x2, cos,exp,exp,mul,x3,div,exp,sub,div,mul,sub,sub,sub,sub,log,x8,exp,x3,x5,0.1,1.0,0.1,x5,1.0,x2,sub,div,div,exp,mul,mul,sub,log,add,cos,x8,exp,add,exp,x8,0.1,x1,5.0,x8,5.0,1.0,1.0, div,x1,mul,mul,cos,log,x8,x5,sub,x5,sin,exp,div,log,log,x7,x7,sub,sub,x3,log,1.0,exp,exp,div,add,div,cos,add,add,x6,1.0,x3,1.0,5.0,1.0, mul,sin,x6,cos,exp,sub,0.1,sub,add,sub,x5,x6,mul,x5,x6,0.1,cos,log,sub,log,1.0,sub,add,log,x1,div,x6,x2,mul,1.0,add,x2,x7, log,mul,mul,mul,log,div,mul,exp,sub,5.0,cos,log,x7,5.0,cos,x8,x6,x7,x4,mul,add,5.0,mul,x3,sub,log,mul,5.0,x2,exp,exp,x8,mul,0.1,x5, sub,x5,cos,log,log,1.0,cos,mul,x5,log,log,mul,exp,exp,0.1,add,exp,exp,1.0,sub,x7,0.1, sub,x1,cos,div,x4,log,div,5.0,add,1.0,mul,x2,exp,div,0.1,0.1,cos,sub,mul,mul,sub,sub,mul,x4,div,1.0,x7,div,5.0,add,x1,mul,add,x4,x3,x1,x2,x4,x5,x4, add,x5,cos,div,mul,log,mul,div,mul,x1,exp,div,x8,exp,sub,mul,1.0,x7,x5,x8,0.1,x8,x5,mul,cos,log,log,div,log,add,exp,sub,1.0,sub,div,sub,1.0,0.1,x1,x1,x6,0.1,x7, add,1.0,sin,sub,x4,log,sub,exp,add,exp,div,log,log,x1,sub,x8,5.0,x3,x6,sub,mul,5.0,x5,div,mul,cos,x8,log,0.1,x8, div,mul,x8,x2,mul,div,log,add,add,div,log,div,cos,x8,add,mul,x8,x6,x2,x8,x3,x1,x6,1.0,sin,mul,1.0,exp,div,1.0,add,div,div,mul,sub,log,log,add,x6,mul,x4,x4,x5,1.0,x5,5.0,x1, add,x6,add,exp,1.0,sin,log,log,x3,cos,sub,add,x6,log,x6,sub,log,sub,add,x7,0.1,sub,exp,x1,x7,5.0, mul,add,sub,mul,x1,cos,log,x2,exp,exp,add,5.0,sub,sin,x8,x5,x8,0.1,log,log,cos,div,mul,log,sub,5.0,sub,exp,x2,add,exp,x3,sub,add,x1,5.0,1.0,0.1,0.1, add,exp,0.1,mul,log,div,x5,x6,div,0.1,x5,exp,add,cos,x4,log,log,add,sin,div,add,sub,x4,sub,add,x1,x6,0.1,x2,x1,x8, sub,add,cos,x2,cos,div,sub,x4,0.1,add,log,mul,exp,div,5.0,1.0,x4,x3,x2,div,x8,sub,x1,mul,x2,exp,1.0, log,sin,exp,add,x4,add,exp,mul,sub,x1,sub,exp,div,x6,x8,exp,x8,1.0,x6,add,mul,x2,cos,div,exp,x7,exp,x2,sin,x4, mul,div,add,div,cos,x2,sin,exp,x4,mul,add,div,5.0,exp,div,x7,x5,x6,x7,x4,x8,div,cos,x4,div,exp,sin,x3,mul,sub,1.0,log,add,log,cos,exp,x7,x8,x8, mul,cos,x6,add,add,div,sub,mul,sub,sin,x3,exp,cos,div,mul,x8,x6,1.0,x6,x7,0.1,x6,x3,log,log,mul,div,x4,cos,x6,x3, add,x1,sub,sub,1.0,sin,add,log,sub,div,exp,1.0,x5,x1,x5,x4,log,add,sub,0.1,div,mul,x1,x3,5.0,cos,sub,mul,x7,div,x7,exp,x8,x7, div,x1,div,x3,exp,sub,log,add,log,x8,exp,add,5.0,x6,exp,x7,exp,cos,sub,exp,sub,x7,x1,log,div,sub,div,add,mul,5.0,x1,0.1,x5,x5,0.1, log,mul,sin,5.0,exp,sub,sin,mul,x5,exp,x4,div,cos,x6,x1,log,div,cos,sub,sub,sub,x5,mul,div,5.0,exp,div,mul,exp,x6,0.1,x3,x5,x4,x8,x5, log,cos,sub,sub,sub,sub,add,x7,x7,add,div,log,div,5.0,1.0,x7,5.0,x7,x6,x1,div,div,x4,mul,div,cos,0.1,x7,x7,div,0.1,mul,mul,x3,cos,x4,x7, mul,1.0,log,log,log,sin,mul,x5,exp,div,0.1,x4,div,sub,add,exp,div,x4,log,x3,div,log,1.0,x6,log,cos,x8,exp,1.0, exp,sin,exp,add,mul,x3,0.1,div,mul,x6,exp,x3,1.0,exp,sub,x5,exp,sub,div,x2,div,x5,x1,cos,x6, sub,log,x2,sin,mul,sub,x1,add,div,div,sub,1.0,5.0,div,log,5.0,x4,x5,1.0,x5,exp,cos,log,sub,x6,add,add,x7,sub,x7,div,x1,x3,add,x2,0.1]'. Reason: 'TypeError("'NoneType' object is not iterable")'

I changed the pool.map to a for loop and it worked successfully, however it was very slow.
How to configure the environment to run the configuration file LunarLander_multiobject.json that optimizes all dimensions at the same time?

Creating a Custom Function that only accepts Input Variables

Hello again,

I've been attempting for the past month or so to create a custom function to use in function_set to help DSO find the expression we're looking to regress into. This custom function is a simple binomial (1-x1), and our goal is to make it so that it only places an open input variable into the custom function and uses the binomial as a building block for the expression. Right now I've tried using the priors currently in place to do so, such as the relational prior and const prior, but nothing has made it so that x1 is the only thing it attempts to put in that slot. Do you have any suggestions on how to get this to work?

If you need any clarification, let me know

  • Sean

Error if both n_objects and n_cores_batch are greater than 1

Dear Brenden K. Petersen,

How to understand n_objects? I did some tests to set it n_objects=3 and it seemed that dso would produce three expressions at the same time. But how to decide which one is better?
https://github.com/brendenpetersen/deep-symbolic-optimization/blob/8724839dab910022e24d03debdf564236683474b/dso/dso/program.py#L219

In addition, when n_objects is greater than 1, I found n_cores_batch must be 1. Otherwise, it can cause an error (please see the attached log file as well as the configurations).
error_log_config.zip

Could you give me some suggestions, please?

Save the model after each epoch

Hi, love this amazing repository.
I tried to use this code on my custom data with "const" added in the function_set. However, as you know, adding "const" bring more complexity and it really took a long time. So what can I do to save the model after running every epoch?
And I also found that when using the sklearn wrapper, warning occured saysing that logdir not provided, but shouldn't it be saved in the default path "./log"?

Is it possible to provide a Tensorflow 2 compatible version of this code?

This code is a very good example of using the deep learning technique on the symbolic regression problem. However, up to now, the most up to date deep learning algorithms are implemented in Pytorch and Tensorflow 2. So, is it possible to provide a Tensorflow 2 compatible version of this code? By the way, I know that I can directly enable TensorFlow 2 to run TensorFlow 1 code by disabling all TensorFlow 2 features. Nonetheless, this function does not support the "contrib" package of Tensorflow 1, which is widely used in this project.

Custom operation not recognized

Hi, really love this repository.
When I tried to add a sign operation in the function set. ValueError occured: Operation sign not recognized.
截屏2022-06-07 10 40 09
What I did is create a new line in unprotected_ops, and then added "sign" to the function set in config_regression.json.
截屏2022-06-07 10 38 59
截屏2022-06-07 10 43 54
Is there any further step need to be done in order to successfully add sign operation?

How to check the searched formula?

Thanks for your contribution to symbolic regression! I am very interested in your work. I ran the code and found that there are only various indicators in the .csv log file, not the formulas searched during the training process. Is there an easier way to view it?

How to access the hall of fame?

Hi,

Thanks a lot for this great package and its documentation. I have a question regarding the hall of fame: I am using the DeepSymbolicRegressor and after fitting, I am accessing the best program with model.program_. This works well!
Now I am wondering: In config_common.json I found the hall of fame parameter hof, which (if I understand correctly) defines the number of "best programs" to keep. Is it possible to access these programs after fitting (instead of getting just the single best one as I am doing currently), and if so how would I do this?

Thanks a lot!

Installation issues

Hi Brenden,

Thanks for your great work! When I was trying to install the package, I always encountered the error message shown in the Figure. Could you provide some suggestions on how to solve it?
Screen Shot 2021-12-09 at 2 27 18 PM

Thanks,
Jiayi

Terminal is not defined

when I run run_Constant_gp.sh as instructed, I got the following error

(dsr) ➜ paper git:(master) ./run_Constant_gp.sh
Setting 'num_cores' to 30 for batch because there are only 30 expressions.
Running gp for n=10 on benchmarks ['Constant-1', 'Constant-2', 'Constant-3']
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(args, **kwds))
File "/Users/wangtao/MY_FILES/deep-symbolic-regression/dsr/dsr/run.py", line 89, in train_gp
p, logbook = gp.train()
File "/Users/wangtao/MY_FILES/deep-symbolic-regression/dsr/dsr/baselines/gpsr.py", line 176, in train
verbose=self.verbose)
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/site-packages/deap/algorithms.py", line 151, in eaSimple
for ind, fit in zip(invalid_ind, fitnesses):
File "/Users/wangtao/MY_FILES/deep-symbolic-regression/dsr/dsr/baselines/gpsr.py", line 141, in evaluate
optimized_consts = self.const_opt(obj, x0)
File "/Users/wangtao/MY_FILES/deep-symbolic-regression/dsr/dsr/const.py", line 72, in call
opt_result = partial(minimize, **self.kwargs)(f, x0)
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/site-packages/scipy/optimize/_minimize.py", line 604, in minimize
return _minimize_bfgs(fun, x0, args, jac, callback, **options)
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 1003, in _minimize_bfgs
old_fval = f(x0)
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 327, in function_wrapper
return function(
(wrapper_args + args))
File "/Users/wangtao/MY_FILES/deep-symbolic-regression/dsr/dsr/baselines/gpsr.py", line 132, in obj
individual[i] = Terminal(const, False, object)
NameError: name 'Terminal' is not defined
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/wangtao/MY_FILES/deep-symbolic-regression/dsr/dsr/run.py", line 252, in
main()
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/wangtao/MY_FILES/deep-symbolic-regression/dsr/dsr/run.py", line 242, in main
for result in pool.imap_unordered(work, names_and_seeds):
File "/Users/wangtao/opt/anaconda3/envs/dsr/lib/python3.6/multiprocessing/pool.py", line 735, in next
raise value
NameError: name 'Terminal' is not defined

real 0m2.246s
user 0m2.755s
sys 0m1.022s

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.