Skip to main content

Quick Start

The 'aifeynman' package is available on PyPI pip install aifeynman. Move into a clean directory and run the following Python commands:

import aifeynman

aifeynman.get_demos("example_data") # Download examples from server
aifeynman.run_aifeynman("./example_data/", "example1.txt", 60, "14ops.txt", polyfit_deg=3, NN_epochs=500)

AI-Feynman

This code is an improved implementation of AI Feynman: a Physics-Inspired Method for Symbolic Regression, Silviu-Marian Udrescu and Max Tegmark (2019) [Science Advances] and AI Feynman 2.0: Pareto-optimal symbolic regression exploiting graph modularity, Udrescu S.M. et al. (2020) [arXiv].

Please check this Medium article for a more detailed eplanation of how to get the code running.

In order to get started, run compile.sh to compile the fortran files used for the brute force code.

ai_feynman_example.py contains an example of running the code on some examples (found in the example_data directory). The examples correspond to the equations I.8.14, I.10.7 and I.50.26 in Table 4 in the paper. More data files on which the code can be tested on can be found in the Feynman Symbolic Regression Database.

The main function of the code, called by the user, has the following parameters:

  • pathdir - path to the directory containing the data file
  • filename - the name of the file containing the data
  • BF_try_time - time limit for each brute force call (set by default to 60 seconds)
  • BF_ops_file_type - file containing the symbols to be used in the brute force code (set by default to "14ops.txt")
  • polyfit_deg - maximum degree of the polynomial tried by the polynomial fit routine (set be default to 4)
  • NN_epochs - number of epochs for the training (set by default to 4000)
  • vars_name - name of the variables appearing in the equation (inluding the name ofthe output variable). This should be passed as a list of strings, with the name of the variables appearing in the same order as they are in the file containing the data
  • test_percentage - percentage of the input data to be kept aside and used as the test set

The data file to be analyzed should be a text file with each column containing the numerical values of each (dependent and independent) variable. The solution file will be saved in the directory called "results" under the name solution_{filename}. The solution file will contain several rows (corresponding to each point on the Pareto frontier), each row showing:

  • the mean logarithm in based 2 of the error of the discovered equation applied to the input data (this can be though of as the average error in bits)
  • the cummulative logarithm in based 2 of the error of the discovered equation applied to the input data (this can be though of as the cummulative error in bits)
  • the complexity of the discovered equation (in bits)
  • the error of the discovered equation applied to the input data
  • the symbolic expression of the discovered equation

If test_percentage is different than zero, one more number is added in the beginning of each row, showing the error of the discovered equation on the test set.

Citation

If you compare with, build on, or use aspects of the AI Feynman work, please cite the following:

@article{udrescu2020ai,
  title={AI Feynman: A physics-inspired method for symbolic regression},
  author={Udrescu, Silviu-Marian and Tegmark, Max},
  journal={Science Advances},
  volume={6},
  number={16},
  pages={eaay2631},
  year={2020},
  publisher={American Association for the Advancement of Science}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aifeynman-2.0.2.tar.gz (225.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aifeynman-2.0.2-cp37-cp37m-macosx_10_15_x86_64.whl (650.6 kB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

File details

Details for the file aifeynman-2.0.2.tar.gz.

File metadata

  • Download URL: aifeynman-2.0.2.tar.gz
  • Upload date:
  • Size: 225.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.5

File hashes

Hashes for aifeynman-2.0.2.tar.gz
Algorithm Hash digest
SHA256 6b339e00242760c3c3c771ab7be586bf1be581b7bc15c0f8e896d252126f175d
MD5 dce95468a33c28c4891e97f405d34163
BLAKE2b-256 8866032b2689dce99618b7d3d931ae18cbc38407024d254abcc200b9aa861d93

See more details on using hashes here.

File details

Details for the file aifeynman-2.0.2-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: aifeynman-2.0.2-cp37-cp37m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 650.6 kB
  • Tags: CPython 3.7m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.5

File hashes

Hashes for aifeynman-2.0.2-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5261f5aea0668b69cf4e41f0cca203b8ba2ee629f2c2755343d94f66a366b914
MD5 4c0adce2184b39e1bbe1626a171a6529
BLAKE2b-256 a79203ad894a5c41fe179b66871fc82f4e55814ea20418b6e2e7528206829b41

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.7

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

This release

2.0.2 This release

2 files

2.0.1

2 files

2.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page