scikit-reducedmodel


Namescikit-reducedmodel JSON
Version 1.1 PyPI version JSON
download
home_pageNone
SummaryConstruction of Reduced Models in Python
upload_time2024-07-02 14:52:15
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseThe MIT License
keywords reduced order model machine learning gravitational waves reduced basis surrogate model
VCS
bugtrack_url
requirements anytree attr attrs numpy pytest scipy gwtools scikit-learn
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Scikit-ReducedModel

<img src="logo.png" alt="logo" width="60%">

[![PyPI version](https://badge.fury.io/py/Scikit-ReducedModel.svg)](https://badge.fury.io/py/Scikit-ReducedModel)
[![Python version](https://img.shields.io/badge/python-3.10%20-blue)](https://img.shields.io/badge/python-3.10%20-blue)
[![Documentation Status](https://readthedocs.org/projects/scikit-reducedmodel/badge/?version=latest)](https://scikit-reducedmodel.readthedocs.io/en/latest/?badge=latest)
[![https://github.com/leliel12/diseno_sci_sfw](https://img.shields.io/badge/DiSoftCompCi-FAMAF-ffda00)](https://github.com/leliel12/diseno_sci_sfw)
[![Scikit-ReducedModel CI](https://github.com/francocerino/scikit-reducedmodel/actions/workflows/ci.yml/badge.svg)](https://github.com/francocerino/francocerino/actions/workflows/ci.yml)

[![Code Coverage](https://img.shields.io/codecov/c/github/francocerino/scikit-reducedmodel)](https://codecov.io/github/francocerino/scikit-reducedmodel)
![GitHub](https://img.shields.io/github/license/francocerino/scikit-reducedmodel)
[![Black Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Scikit-ReduceModel is a Python package to build [reduced order models](https://en.wikipedia.org/wiki/Model_order_reduction). This code gives the
standard reduced-basis framework and provides an efficient and accurate solution for model building. Also, an gives an extension of it, implementing the hp-greedy refinement strategy, an enhancement approach for reduced-basis model building. This approach uses an automatic parameter space partitioning, where there is a local reduced basis on each partition. The procedure splits spaces in two, in a recursive way.

Surrogate models can be built, which are comprised of three sequential steps of data processing that extract the most relevant information and use it to learn the patterns of the solutions and build easy to evaluate expressions: building a reduced basis, applying the empirical interpolation method and using a machine learning algorithm to learn the behavior of the solutions to obtain the surrogate model.

This package is built with the philosophy and idea of usability of scikit-learn modules. For usage examples, see the [documentation](https://scikit-reducedmodel.readthedocs.io/en/latest/).

# Motivation

In science and engineering is known that obtaining numerical simulations by solving differential equations can be more computational demanding than desired. For example, in the field of general relativity, to obtain expressions of gravitational waves could cost months using supercomputers. Furthermore, there are studies as parameter estimation that can require up to millions of sequential estimations, dominating the computational expense of the problem. In the last years, these problems were addresed building surrogate models from high cost simulations, taking advantage of the redundancy of the solutions with respect to the parameter space, which can build solutions in real time with no loss of accuracy.

# Installation

To install the latest stable version of ScikitReducedModel from PyPI:

```bash
pip install scikit-reducedmodel
```

To install the developer version (may be unstable):

```bash
git clone https://github.com/francocerino/scikit-reducedmodel
cd scikit-reducedmodel
pip install .
```

# Quick Usage

In order to build a surrogate model, we need to be familiar with a set of functions parameterized by $λ$, denoted as $f_λ(x)$.

The known functions at given parameters are named as the training set (`training_set`).

The associated parameters to `training_set` are given by `parameters`.

We need also a distretization of $x$ , given by `x_set`.

Then, we can first build the reduced basis, in this case, we use the default parameters.

```python

from skreducedmodel.reducedbasis import ReducedBasis

rb = ReducedBasis()
rb.fit(training_set = training_set,
       parameters = parameters
       physical_points = x_set)
```

In the second step, with the reduced basis built, the empirical interpolation method is applied.

```python

from skreducedmodel.empiricalinterpolation import EmpiricalInterpolation

eim = EmpiricalInterpolation(rb)
eim.fit()
```

Finally, we build the reduced model from our eim object

```python

from skreducedmodel.surrogate import Surrogate

surrogate = Surrogate(eim)
surrogate.fit()
```

In case we are interested in studying only `Surrogate` objects, the package has a function that automates the whole process.

```python

from skreducedmodel.mksurrogate import mksurrogate

surrogate = mksurrogate(parameters = param,
                        training_set = training_set,
                        physical_points = x_set,
                        )

```

To obtain an expression of a function $f´_{λ´}$ with any of the three methods, we must use:

```python
rb.transform(f_test,parameter_test)
```

```python
eim.transform(f_test,parameter_test)
```

```python
surrogate.predict(parameter_test)
```

## Contributions

We encourage users to contribute with ideas, code, or by reporting bugs. To report bugs or issues, users should create an issue in the project repository. To contribute with code, please submit a pull request. We suggest that you contact us at francocerino@gmail.com prior to undertaking any significant improvement that requires substantial effort to address technical and design aspects before beginning development.

## Authors

- Franco Cerino <[francocerino@gmail.com](francocerino@gmail.com)> ([FaMAF-UNC][]).

- Agustín Rodríguez-Medrano ([IATE-OAC-CONICET][], [FaMAF-UNC][]).

[FaMAF-UNC]: https://www.famaf.unc.edu.ar/
[IATE-OAC-CONICET]: http://iate.oac.uncor.edu/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "scikit-reducedmodel",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "reduced order model, machine learning, gravitational waves, reduced basis, surrogate model",
    "author": null,
    "author_email": "Franco Cerino <francocerino@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/65/12/f0ff2cd4d700914aa5c89277959d7f0615c452a358bc385e18cd1d5da0ad/scikit_reducedmodel-1.1.tar.gz",
    "platform": null,
    "description": "# Scikit-ReducedModel\n\n<img src=\"logo.png\" alt=\"logo\" width=\"60%\">\n\n[![PyPI version](https://badge.fury.io/py/Scikit-ReducedModel.svg)](https://badge.fury.io/py/Scikit-ReducedModel)\n[![Python version](https://img.shields.io/badge/python-3.10%20-blue)](https://img.shields.io/badge/python-3.10%20-blue)\n[![Documentation Status](https://readthedocs.org/projects/scikit-reducedmodel/badge/?version=latest)](https://scikit-reducedmodel.readthedocs.io/en/latest/?badge=latest)\n[![https://github.com/leliel12/diseno_sci_sfw](https://img.shields.io/badge/DiSoftCompCi-FAMAF-ffda00)](https://github.com/leliel12/diseno_sci_sfw)\n[![Scikit-ReducedModel CI](https://github.com/francocerino/scikit-reducedmodel/actions/workflows/ci.yml/badge.svg)](https://github.com/francocerino/francocerino/actions/workflows/ci.yml)\n\n[![Code Coverage](https://img.shields.io/codecov/c/github/francocerino/scikit-reducedmodel)](https://codecov.io/github/francocerino/scikit-reducedmodel)\n![GitHub](https://img.shields.io/github/license/francocerino/scikit-reducedmodel)\n[![Black Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nScikit-ReduceModel is a Python package to build [reduced order models](https://en.wikipedia.org/wiki/Model_order_reduction). This code gives the\nstandard reduced-basis framework and provides an efficient and accurate solution for model building. Also, an gives an extension of it, implementing the hp-greedy refinement strategy, an enhancement approach for reduced-basis model building. This approach uses an automatic parameter space partitioning, where there is a local reduced basis on each partition. The procedure splits spaces in two, in a recursive way.\n\nSurrogate models can be built, which are comprised of three sequential steps of data processing that extract the most relevant information and use it to learn the patterns of the solutions and build easy to evaluate expressions: building a reduced basis, applying the empirical interpolation method and using a machine learning algorithm to learn the behavior of the solutions to obtain the surrogate model.\n\nThis package is built with the philosophy and idea of usability of scikit-learn modules. For usage examples, see the [documentation](https://scikit-reducedmodel.readthedocs.io/en/latest/).\n\n# Motivation\n\nIn science and engineering is known that obtaining numerical simulations by solving differential equations can be more computational demanding than desired. For example, in the field of general relativity, to obtain expressions of gravitational waves could cost months using supercomputers. Furthermore, there are studies as parameter estimation that can require up to millions of sequential estimations, dominating the computational expense of the problem. In the last years, these problems were addresed building surrogate models from high cost simulations, taking advantage of the redundancy of the solutions with respect to the parameter space, which can build solutions in real time with no loss of accuracy.\n\n# Installation\n\nTo install the latest stable version of ScikitReducedModel from PyPI:\n\n```bash\npip install scikit-reducedmodel\n```\n\nTo install the developer version (may be unstable):\n\n```bash\ngit clone https://github.com/francocerino/scikit-reducedmodel\ncd scikit-reducedmodel\npip install .\n```\n\n# Quick Usage\n\nIn order to build a surrogate model, we need to be familiar with a set of functions parameterized by $\u03bb$, denoted as $f_\u03bb(x)$.\n\nThe known functions at given parameters are named as the training set (`training_set`).\n\nThe associated parameters to `training_set` are given by `parameters`.\n\nWe need also a distretization of $x$ , given by `x_set`.\n\nThen, we can first build the reduced basis, in this case, we use the default parameters.\n\n```python\n\nfrom skreducedmodel.reducedbasis import ReducedBasis\n\nrb = ReducedBasis()\nrb.fit(training_set = training_set,\n       parameters = parameters\n       physical_points = x_set)\n```\n\nIn the second step, with the reduced basis built, the empirical interpolation method is applied.\n\n```python\n\nfrom skreducedmodel.empiricalinterpolation import EmpiricalInterpolation\n\neim = EmpiricalInterpolation(rb)\neim.fit()\n```\n\nFinally, we build the reduced model from our eim object\n\n```python\n\nfrom skreducedmodel.surrogate import Surrogate\n\nsurrogate = Surrogate(eim)\nsurrogate.fit()\n```\n\nIn case we are interested in studying only `Surrogate` objects, the package has a function that automates the whole process.\n\n```python\n\nfrom skreducedmodel.mksurrogate import mksurrogate\n\nsurrogate = mksurrogate(parameters = param,\n                        training_set = training_set,\n                        physical_points = x_set,\n                        )\n\n```\n\nTo obtain an expression of a function $f\u00b4_{\u03bb\u00b4}$ with any of the three methods, we must use:\n\n```python\nrb.transform(f_test,parameter_test)\n```\n\n```python\neim.transform(f_test,parameter_test)\n```\n\n```python\nsurrogate.predict(parameter_test)\n```\n\n## Contributions\n\nWe encourage users to contribute with ideas, code, or by reporting bugs. To report bugs or issues, users should create an issue in the project repository. To contribute with code, please submit a pull request. We suggest that you contact us at francocerino@gmail.com prior to undertaking any significant improvement that requires substantial effort to address technical and design aspects before beginning development.\n\n## Authors\n\n- Franco Cerino <[francocerino@gmail.com](francocerino@gmail.com)> ([FaMAF-UNC][]).\n\n- Agust\u00edn Rodr\u00edguez-Medrano ([IATE-OAC-CONICET][], [FaMAF-UNC][]).\n\n[FaMAF-UNC]: https://www.famaf.unc.edu.ar/\n[IATE-OAC-CONICET]: http://iate.oac.uncor.edu/\n",
    "bugtrack_url": null,
    "license": "The MIT License",
    "summary": "Construction of Reduced Models in Python",
    "version": "1.1",
    "project_urls": {
        "Homepage": "https://github.com/francocerino/scikit-reducedmodel"
    },
    "split_keywords": [
        "reduced order model",
        " machine learning",
        " gravitational waves",
        " reduced basis",
        " surrogate model"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6512f0ff2cd4d700914aa5c89277959d7f0615c452a358bc385e18cd1d5da0ad",
                "md5": "080cfc4f6cf43d380e2e3bc5159eb70a",
                "sha256": "ff7330865d36a842deda165d2214e43ab03432acf7ce8b1528c735fbf5b7eb46"
            },
            "downloads": -1,
            "filename": "scikit_reducedmodel-1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "080cfc4f6cf43d380e2e3bc5159eb70a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 227157,
            "upload_time": "2024-07-02T14:52:15",
            "upload_time_iso_8601": "2024-07-02T14:52:15.647010Z",
            "url": "https://files.pythonhosted.org/packages/65/12/f0ff2cd4d700914aa5c89277959d7f0615c452a358bc385e18cd1d5da0ad/scikit_reducedmodel-1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-02 14:52:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "francocerino",
    "github_project": "scikit-reducedmodel",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "anytree",
            "specs": [
                [
                    ">=",
                    "2.8.0"
                ]
            ]
        },
        {
            "name": "attr",
            "specs": [
                [
                    ">=",
                    "0.3.2"
                ]
            ]
        },
        {
            "name": "attrs",
            "specs": [
                [
                    ">=",
                    "22.1.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.23.4"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "7.1.3"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.10.0"
                ]
            ]
        },
        {
            "name": "gwtools",
            "specs": [
                [
                    ">=",
                    "1.1.5"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    ">=",
                    "0.18"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "scikit-reducedmodel"
}
        
Elapsed time: 6.30494s