Name | pysips JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | A python package for symbolic inference via posterior sampling. |
upload_time | 2025-07-30 14:43:51 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
symbolic
regression
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PySIPS: Python package for Symbolic Inference via Posterior Sampling
PySIPS is an open-source implementation of Bayesian symbolic regression via posterior sampling as described in the paper "Bayesian Symbolic Regression via Posterior Sampling" by G. F. Bomarito and P. E. Leser from NASA Langley Research Center.
## Purpose
PySIPS provides a robust framework for discovering interpretable symbolic expressions from data, with a particular focus on handling noisy datasets. Unlike traditional symbolic regression approaches, PySIPS uses a Bayesian framework with Sequential Monte Carlo (SMC) sampling to:
1. Enhance robustness to noise
2. Provide built-in uncertainty quantification
3. Discover parsimonious expressions with improved generalization
4. Reduce overfitting in symbolic regression tasks
## Algorithm Overview
PySIPS implements a Sequential Monte Carlo (SMC) framework for Bayesian symbolic regression that:
- Approximates the posterior distribution over symbolic expressions
- Uses probabilistic selection and adaptive annealing to explore the search space efficiently
- Employs normalized marginal likelihood for model evaluation
- Combines mutation and crossover operations as proposal mechanisms
- Provides model selection criteria based on maximum normalized marginal likelihood or posterior mode
## Installation
```bash
pip install pysips
```
## Example Usage
```python
import numpy as np
from pysips import PysipsRegressor
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score
# Generate synthetic data (y = x^2 + noise)
np.random.seed(42)
X = np.linspace(-3, 3, 100).reshape(-1, 1)
y = X[:, 0]**2 + np.random.normal(0, 0.1, size=X.shape[0])
# Split data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# Initialize and fit the regressor
regressor = PysipsRegressor(
operators=['+', '-', '*'],
max_complexity=12,
num_particles=100,
num_mcmc_samples=10,
random_state=42
)
regressor.fit(X_train, y_train)
# Make predictions
y_pred = regressor.predict(X_test)
# Get the discovered expression
expression = regressor.get_expression()
print(f"Discovered expression: {expression}")
print(f"R² score: {r2_score(y_test, y_pred):.4f}")
# Get model posterior and their likelihoods
models, likelihoods = regressor.get_models()
```
### Example Output
```
Discovered expression: x_0^2
R² score: 0.9987
Number of unique models sampled: 32
```
## Advanced Features
- Control over operators and expression complexity
- Multiple model selection strategies
- Access to the full posterior distribution over expressions
- Compatible with scikit-learn's API for easy integration into ML pipelines
- Uncertainty quantification for symbolic regression results
## Citation
If you use PySIPS, please cite the following paper:
```bibtex
@article{bomarito2024bayesian,
title={Bayesian Symbolic Regression via Posterior Sampling},
author={Bomarito, Geoffrey F. and Leser, Patrick E.},
journal={Philosophical Transactions of the Royal Society A},
year={2025},
publisher={Royal Society}
}
```
## License
Notices:
Copyright 2025 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. No copyright is claimed in the United States under Title 17, U.S. Code. All Other Rights Reserved.
The NASA Software “PySIPS” (LAR-20644-1) calls the following third-party software, which is subject to the terms and conditions of its licensor, as applicable at the time of licensing. The third-party software is not bundled or included with this software but may be available from the licensor. License hyperlinks are provided here for information purposes only.
NumPy
https://numpy.org/devdocs/license.html
Copyright (c) 2005-2025, NumPy Developers.
All rights reserved.
h5py
https://github.com/h5py/h5py/blob/master/LICENSE
Copyright (c) 2008 Andrew Collette and contributors
All rights reserved.
tqdm
https://github.com/tqdm/tqdm/blob/master/LICENCE
Copyright (c) 2013 noamraph
SciPy
https://github.com/scipy/scipy/blob/main/LICENSE.txt
Copyright (c) 2001-2002 Enthought, Inc. 2003, SciPy Developers.
All rights reserved.
Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS."
Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS, AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
## Acknowledgements
This work was developed at NASA Langley Research Center.
Raw data
{
"_id": null,
"home_page": null,
"name": "pysips",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "symbolic regression",
"author": null,
"author_email": "Geoffrey Bomarito <geoffrey.f.bomarito@nasa.gov>, Patrick Leser <patrick.e.leser@nasa.gov>",
"download_url": "https://files.pythonhosted.org/packages/f6/84/58987ad084751966d998fb1a20e9edc0c4f3e14e9825655bffc43a52313f/pysips-0.1.1.tar.gz",
"platform": null,
"description": "# PySIPS: Python package for Symbolic Inference via Posterior Sampling\n\nPySIPS is an open-source implementation of Bayesian symbolic regression via posterior sampling as described in the paper \"Bayesian Symbolic Regression via Posterior Sampling\" by G. F. Bomarito and P. E. Leser from NASA Langley Research Center.\n\n## Purpose\n\nPySIPS provides a robust framework for discovering interpretable symbolic expressions from data, with a particular focus on handling noisy datasets. Unlike traditional symbolic regression approaches, PySIPS uses a Bayesian framework with Sequential Monte Carlo (SMC) sampling to:\n\n1. Enhance robustness to noise\n2. Provide built-in uncertainty quantification\n3. Discover parsimonious expressions with improved generalization\n4. Reduce overfitting in symbolic regression tasks\n\n## Algorithm Overview\n\nPySIPS implements a Sequential Monte Carlo (SMC) framework for Bayesian symbolic regression that:\n\n- Approximates the posterior distribution over symbolic expressions\n- Uses probabilistic selection and adaptive annealing to explore the search space efficiently\n- Employs normalized marginal likelihood for model evaluation\n- Combines mutation and crossover operations as proposal mechanisms\n- Provides model selection criteria based on maximum normalized marginal likelihood or posterior mode\n\n## Installation\n\n```bash\npip install pysips\n```\n\n## Example Usage\n\n```python\nimport numpy as np\nfrom pysips import PysipsRegressor\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import r2_score\n\n# Generate synthetic data (y = x^2 + noise)\nnp.random.seed(42)\nX = np.linspace(-3, 3, 100).reshape(-1, 1)\ny = X[:, 0]**2 + np.random.normal(0, 0.1, size=X.shape[0])\n\n# Split data\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# Initialize and fit the regressor\nregressor = PysipsRegressor(\n operators=['+', '-', '*'],\n max_complexity=12,\n num_particles=100,\n num_mcmc_samples=10,\n random_state=42\n)\n\nregressor.fit(X_train, y_train)\n\n# Make predictions\ny_pred = regressor.predict(X_test)\n\n# Get the discovered expression\nexpression = regressor.get_expression()\nprint(f\"Discovered expression: {expression}\")\nprint(f\"R\u00b2 score: {r2_score(y_test, y_pred):.4f}\")\n\n# Get model posterior and their likelihoods\nmodels, likelihoods = regressor.get_models()\n```\n\n### Example Output\n\n```\nDiscovered expression: x_0^2\nR\u00b2 score: 0.9987\nNumber of unique models sampled: 32\n```\n\n## Advanced Features\n\n- Control over operators and expression complexity\n- Multiple model selection strategies\n- Access to the full posterior distribution over expressions\n- Compatible with scikit-learn's API for easy integration into ML pipelines\n- Uncertainty quantification for symbolic regression results\n\n## Citation\n\nIf you use PySIPS, please cite the following paper:\n\n```bibtex\n@article{bomarito2024bayesian,\n title={Bayesian Symbolic Regression via Posterior Sampling},\n author={Bomarito, Geoffrey F. and Leser, Patrick E.},\n journal={Philosophical Transactions of the Royal Society A},\n year={2025},\n publisher={Royal Society}\n}\n```\n\n## License\n\nNotices:\nCopyright 2025 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. No copyright is claimed in the United States under Title 17, U.S. Code. All Other Rights Reserved.\n \nThe NASA Software \u201cPySIPS\u201d (LAR-20644-1) calls the following third-party software, which is subject to the terms and conditions of its licensor, as applicable at the time of licensing. The third-party software is not bundled or included with this software but may be available from the licensor. License hyperlinks are provided here for information purposes only.\n \nNumPy \nhttps://numpy.org/devdocs/license.html \nCopyright (c) 2005-2025, NumPy Developers. \nAll rights reserved.\n \nh5py \nhttps://github.com/h5py/h5py/blob/master/LICENSE \nCopyright (c) 2008 Andrew Collette and contributors \nAll rights reserved.\n \ntqdm \nhttps://github.com/tqdm/tqdm/blob/master/LICENCE \nCopyright (c) 2013 noamraph\n \nSciPy \nhttps://github.com/scipy/scipy/blob/main/LICENSE.txt \nCopyright (c) 2001-2002 Enthought, Inc. 2003, SciPy Developers. \nAll rights reserved.\n \nDisclaimers\nNo Warranty: THE SUBJECT SOFTWARE IS PROVIDED \"AS IS\" WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT \"AS IS.\"\n \nWaiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS, AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.\n\n\n## Acknowledgements\n\nThis work was developed at NASA Langley Research Center.\n",
"bugtrack_url": null,
"license": null,
"summary": "A python package for symbolic inference via posterior sampling.",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://nasa.github.io/pysips/",
"Repository": "https://github.com/nasa/pysips"
},
"split_keywords": [
"symbolic",
"regression"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3d0095e1e68946e43aadc4729d7998d99d90cf3a18ade3629caded1d34570b42",
"md5": "f8a462a9d422c5fdb069a710d5f45f34",
"sha256": "00692492f47698b9f32e5ba43bcb223d47bff18e972036fd8490293d9733f70c"
},
"downloads": -1,
"filename": "pysips-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f8a462a9d422c5fdb069a710d5f45f34",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 45080,
"upload_time": "2025-07-30T14:43:50",
"upload_time_iso_8601": "2025-07-30T14:43:50.044231Z",
"url": "https://files.pythonhosted.org/packages/3d/00/95e1e68946e43aadc4729d7998d99d90cf3a18ade3629caded1d34570b42/pysips-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f68458987ad084751966d998fb1a20e9edc0c4f3e14e9825655bffc43a52313f",
"md5": "d509c7ea3d9709ead18f32659a9c61b2",
"sha256": "de30311eec8fb3b313a8f5e473dbab09767476d6b02115fb25919f6a2ad6ecfc"
},
"downloads": -1,
"filename": "pysips-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "d509c7ea3d9709ead18f32659a9c61b2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 45725,
"upload_time": "2025-07-30T14:43:51",
"upload_time_iso_8601": "2025-07-30T14:43:51.175325Z",
"url": "https://files.pythonhosted.org/packages/f6/84/58987ad084751966d998fb1a20e9edc0c4f3e14e9825655bffc43a52313f/pysips-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-30 14:43:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nasa",
"github_project": "pysips",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pysips"
}