physbo 2.1.0__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {physbo-2.1.0 → physbo-3.0.0}/PKG-INFO +33 -26
- {physbo-2.1.0 → physbo-3.0.0}/README.md +23 -18
- physbo-3.0.0/pyproject.toml +32 -0
- physbo-3.0.0/setup.cfg +4 -0
- physbo-3.0.0/src/physbo/__init__.py +33 -0
- physbo-2.1.0/physbo/variable.py → physbo-3.0.0/src/physbo/_variable.py +14 -3
- physbo-3.0.0/src/physbo/blm/__init__.py +34 -0
- physbo-2.1.0/physbo/blm/predictor.py → physbo-3.0.0/src/physbo/blm/_predictor.py +12 -10
- physbo-3.0.0/src/physbo/blm/basis/__init__.py +18 -0
- physbo-2.1.0/physbo/blm/basis/fourier.py → physbo-3.0.0/src/physbo/blm/basis/_fourier.py +1 -1
- {physbo-2.1.0/physbo/blm/lik/_src → physbo-3.0.0/src/physbo/blm/core}/__init__.py +3 -1
- physbo-2.1.0/physbo/blm/core/model.py → physbo-3.0.0/src/physbo/blm/core/_model.py +42 -7
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/blm/inf/__init__.py +2 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/blm/inf/exact.py +6 -6
- physbo-3.0.0/src/physbo/blm/lik/__init__.py +33 -0
- physbo-2.1.0/physbo/blm/lik/_src/cov.py → physbo-3.0.0/src/physbo/blm/lik/_cov.py +1 -1
- physbo-2.1.0/physbo/blm/lik/gauss.py → physbo-3.0.0/src/physbo/blm/lik/_gauss.py +6 -5
- physbo-2.1.0/physbo/blm/lik/linear.py → physbo-3.0.0/src/physbo/blm/lik/_linear.py +1 -1
- {physbo-2.1.0/physbo/blm → physbo-3.0.0/src/physbo/blm/prior}/__init__.py +6 -8
- physbo-2.1.0/physbo/blm/prior/gauss.py → physbo-3.0.0/src/physbo/blm/prior/_gauss.py +8 -8
- physbo-3.0.0/src/physbo/gp/__init__.py +46 -0
- physbo-2.1.0/physbo/gp/predictor.py → physbo-3.0.0/src/physbo/gp/_predictor.py +15 -8
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/gp/core/__init__.py +4 -3
- physbo-2.1.0/physbo/gp/core/model.py → physbo-3.0.0/src/physbo/gp/core/_model.py +143 -20
- physbo-2.1.0/physbo/gp/core/prior.py → physbo-3.0.0/src/physbo/gp/core/_prior.py +5 -5
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/gp/core/learning.py +38 -15
- physbo-3.0.0/src/physbo/gp/cov/__init__.py +18 -0
- physbo-2.1.0/physbo/gp/cov/gauss.py → physbo-3.0.0/src/physbo/gp/cov/_gauss.py +4 -4
- {physbo-2.1.0/physbo/gp → physbo-3.0.0/src/physbo/gp/cov/_src}/__init__.py +7 -7
- physbo-3.0.0/src/physbo/gp/cov/_src/pure.py +72 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/gp/inf/__init__.py +2 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/gp/inf/exact.py +7 -10
- physbo-3.0.0/src/physbo/gp/lik/__init__.py +18 -0
- physbo-2.1.0/physbo/gp/lik/gauss.py → physbo-3.0.0/src/physbo/gp/lik/_gauss.py +6 -6
- physbo-3.0.0/src/physbo/gp/mean/__init__.py +26 -0
- physbo-2.1.0/physbo/gp/mean/const.py → physbo-3.0.0/src/physbo/gp/mean/_const.py +1 -1
- physbo-2.1.0/physbo/gp/mean/zero.py → physbo-3.0.0/src/physbo/gp/mean/_zero.py +1 -1
- physbo-3.0.0/src/physbo/misc/__init__.py +45 -0
- physbo-2.1.0/physbo/misc/gauss_elim.py → physbo-3.0.0/src/physbo/misc/_gauss_elim.py +0 -1
- physbo-2.1.0/physbo/misc/set_config.py → physbo-3.0.0/src/physbo/misc/_set_config.py +27 -27
- physbo-3.0.0/src/physbo/misc/_src/__init__.py +27 -0
- physbo-3.0.0/src/physbo/misc/_src/pure.py +159 -0
- physbo-3.0.0/src/physbo/misc/_use_cython.py +33 -0
- physbo-3.0.0/src/physbo/misc/permutation_importance.py +85 -0
- {physbo-2.1.0/physbo → physbo-3.0.0/src/physbo/opt}/__init__.py +10 -9
- physbo-2.1.0/physbo/opt/adam.py → physbo-3.0.0/src/physbo/opt/_adam.py +1 -1
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/predictor.py +41 -8
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/search/__init__.py +4 -0
- physbo-3.0.0/src/physbo/search/discrete/__init__.py +29 -0
- physbo-2.1.0/physbo/search/discrete/results.py → physbo-3.0.0/src/physbo/search/discrete/_history.py +27 -2
- physbo-2.1.0/physbo/search/discrete/policy.py → physbo-3.0.0/src/physbo/search/discrete/_policy.py +84 -34
- physbo-3.0.0/src/physbo/search/discrete_multi/__init__.py +31 -0
- physbo-2.1.0/physbo/search/discrete_multi/results.py → physbo-3.0.0/src/physbo/search/discrete_multi/_history.py +42 -1
- physbo-2.1.0/physbo/search/discrete_multi/policy.py → physbo-3.0.0/src/physbo/search/discrete_multi/_policy.py +70 -23
- physbo-3.0.0/src/physbo/search/optimize/__init__.py +0 -0
- physbo-3.0.0/src/physbo/search/optimize/odatse.py +192 -0
- physbo-3.0.0/src/physbo/search/optimize/random.py +57 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/search/pareto.py +42 -18
- physbo-3.0.0/src/physbo/search/range/__init__.py +29 -0
- physbo-3.0.0/src/physbo/search/range/_history.py +234 -0
- physbo-3.0.0/src/physbo/search/range/_policy.py +735 -0
- physbo-3.0.0/src/physbo/search/range_multi/__init__.py +29 -0
- physbo-3.0.0/src/physbo/search/range_multi/_history.py +190 -0
- physbo-3.0.0/src/physbo/search/range_multi/_policy.py +633 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/search/score_multi.py +52 -0
- physbo-3.0.0/src/physbo/search/utility.py +41 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo.egg-info/PKG-INFO +33 -26
- physbo-3.0.0/src/physbo.egg-info/SOURCES.txt +71 -0
- physbo-3.0.0/src/physbo.egg-info/requires.txt +2 -0
- physbo-2.1.0/physbo/blm/basis/__init__.py +0 -8
- physbo-2.1.0/physbo/blm/core/__init__.py +0 -8
- physbo-2.1.0/physbo/blm/lik/__init__.py +0 -10
- physbo-2.1.0/physbo/blm/prior/__init__.py +0 -8
- physbo-2.1.0/physbo/gp/cov/__init__.py +0 -8
- physbo-2.1.0/physbo/gp/cov/_src/__init__.py +0 -1
- physbo-2.1.0/physbo/gp/cov/_src/enhance_gauss.pyx +0 -86
- physbo-2.1.0/physbo/gp/lik/__init__.py +0 -8
- physbo-2.1.0/physbo/gp/mean/__init__.py +0 -9
- physbo-2.1.0/physbo/misc/__init__.py +0 -15
- physbo-2.1.0/physbo/misc/_src/__init__.py +0 -1
- physbo-2.1.0/physbo/misc/_src/cholupdate.pyx +0 -47
- physbo-2.1.0/physbo/misc/_src/diagAB.pyx +0 -44
- physbo-2.1.0/physbo/misc/_src/logsumexp.pyx +0 -39
- physbo-2.1.0/physbo/misc/_src/traceAB.pyx +0 -75
- physbo-2.1.0/physbo/opt/__init__.py +0 -8
- physbo-2.1.0/physbo/search/discrete/__init__.py +0 -11
- physbo-2.1.0/physbo/search/discrete_multi/__init__.py +0 -11
- physbo-2.1.0/physbo/search/utility.py +0 -101
- physbo-2.1.0/physbo.egg-info/SOURCES.txt +0 -67
- physbo-2.1.0/physbo.egg-info/not-zip-safe +0 -1
- physbo-2.1.0/physbo.egg-info/requires.txt +0 -2
- physbo-2.1.0/pyproject.toml +0 -3
- physbo-2.1.0/setup.cfg +0 -23
- physbo-2.1.0/setup.py +0 -53
- /physbo-2.1.0/physbo/misc/centering.py → /physbo-3.0.0/src/physbo/misc/_centering.py +0 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo/search/score.py +0 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo.egg-info/dependency_links.txt +0 -0
- {physbo-2.1.0 → physbo-3.0.0/src}/physbo.egg-info/top_level.txt +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: physbo
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: optimization tool for PHYSics based on Bayesian Optimization
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
Author-email: PHYSBO developers <physbo-dev@issp.u-tokyo.ac.jp>
|
|
6
|
+
License-Expression: MPL-2.0
|
|
7
|
+
Project-URL: homepage, https://www.pasums.issp.u-tokyo.ac.jp/physbo/en
|
|
8
|
+
Project-URL: source, https://github.com/issp-center-dev/PHYSBO
|
|
9
|
+
Project-URL: documentation, https://issp-center-dev.github.io/PHYSBO/
|
|
10
|
+
Project-URL: releasenotes, https://github.com/issp-center-dev/PHYSBO/releases
|
|
11
|
+
Requires-Python: >=3.9
|
|
10
12
|
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: numpy
|
|
13
|
+
Requires-Dist: numpy
|
|
12
14
|
Requires-Dist: scipy
|
|
13
15
|
|
|
14
16
|
# optimization tools for PHYsics based on Bayesian Optimization ( PHYSBO )
|
|
@@ -21,19 +23,25 @@ PHYSBO was developed based on [COMBO](https://github.com/tsudalab/combo) for aca
|
|
|
21
23
|
## Documentation
|
|
22
24
|
|
|
23
25
|
- Stable (master branch)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
- [English](https://issp-center-dev.github.io/PHYSBO/manual/master/en/index.html)
|
|
27
|
+
- [日本語](https://issp-center-dev.github.io/PHYSBO/manual/master/ja/index.html)
|
|
26
28
|
- Latest (develop branch)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
- [English](https://issp-center-dev.github.io/PHYSBO/manual/develop/en/index.html)
|
|
30
|
+
- [日本語](https://issp-center-dev.github.io/PHYSBO/manual/develop/ja/index.html)
|
|
29
31
|
|
|
30
32
|
## Dependencies
|
|
31
33
|
|
|
32
|
-
- Python >= 3.
|
|
33
|
-
|
|
34
|
-
- NumPy < 2.0.0
|
|
34
|
+
- Python >= 3.9
|
|
35
|
+
- NumPy
|
|
35
36
|
- SciPy
|
|
36
37
|
|
|
38
|
+
### About Cython
|
|
39
|
+
|
|
40
|
+
From v3.0.0, PHYSBO no longer uses Cython in order to simplify installation process particularly on Windows.
|
|
41
|
+
This means that the performance of PHYSBO is slightly degraded from older versions.
|
|
42
|
+
If you need more performance, you can install ``physbo-core-cython`` additionally.
|
|
43
|
+
This package offers Cythonized version of some functions of PHYSBO.
|
|
44
|
+
|
|
37
45
|
## Install
|
|
38
46
|
|
|
39
47
|
- From PyPI (recommended)
|
|
@@ -43,15 +51,10 @@ python3 -m pip install physbo
|
|
|
43
51
|
```
|
|
44
52
|
|
|
45
53
|
- From source (for developers)
|
|
46
|
-
1. Update pip (>= 19.0)
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
python3 -m pip install -U pip
|
|
50
|
-
```
|
|
51
54
|
|
|
52
55
|
1. Download or clone the github repository
|
|
53
56
|
|
|
54
|
-
```
|
|
57
|
+
```bash
|
|
55
58
|
git clone https://github.com/issp-center-dev/PHYSBO
|
|
56
59
|
```
|
|
57
60
|
|
|
@@ -64,7 +67,11 @@ python3 -m pip install physbo
|
|
|
64
67
|
python3 -m pip install ./PHYSBO
|
|
65
68
|
```
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
- To install ``physbo-core-cython`` ::
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python3 -m pip install physbo-core-cython
|
|
74
|
+
```
|
|
68
75
|
|
|
69
76
|
## Uninstall
|
|
70
77
|
|
|
@@ -74,25 +81,25 @@ python3 -m pip uninstall physbo
|
|
|
74
81
|
|
|
75
82
|
## Usage
|
|
76
83
|
|
|
77
|
-
For an introductory tutorial please consult the documentation. ([English](https://issp-center-dev.github.io/PHYSBO/manual/master/en/notebook/tutorial_basic.html) / [日本語](https://issp-center-dev.github.io/PHYSBO/manual/develop/ja/install.html#id2))
|
|
84
|
+
For an introductory tutorial please consult the documentation. ([English](https://issp-center-dev.github.io/PHYSBO/manual/master/en/notebook/tutorial_basic.html) / [日本語](https://issp-center-dev.github.io/PHYSBO/manual/develop/ja/install.html#id2))
|
|
78
85
|
|
|
79
86
|
['examples/simple.py'](./examples/simple.py) is a simple example.
|
|
80
87
|
|
|
81
88
|
## Data repository
|
|
82
89
|
|
|
83
|
-
A tutorial and a dataset of a paper about PHYSBO can be found in [PHYSBO Gallery](
|
|
90
|
+
A tutorial and a dataset of a paper about PHYSBO can be found in [PHYSBO Gallery](https://isspns-gitlab.issp.u-tokyo.ac.jp/physbo-dev/physbo-gallery).
|
|
84
91
|
|
|
85
92
|
## License
|
|
86
93
|
|
|
87
94
|
PHYSBO was developed based on [COMBO](https://github.com/tsudalab/COMBO) for academic use.
|
|
88
|
-
PHYSBO
|
|
95
|
+
PHYSBO is distributed under Mozilla Public License version 2.0 (MPL v2).
|
|
89
96
|
We hope that you cite the following reference when you publish the results using PHYSBO:
|
|
90
97
|
|
|
91
98
|
[“Bayesian optimization package: PHYSBO”, Yuichi Motoyama, Ryo Tamura, Kazuyoshi Yoshimi, Kei Terayama, Tsuyoshi Ueno, Koji Tsuda, Computer Physics Communications Volume 278, September 2022, 108405.](https://doi.org/10.1016/j.cpc.2022.108405)
|
|
92
99
|
|
|
93
100
|
Bibtex
|
|
94
101
|
|
|
95
|
-
```
|
|
102
|
+
```bibtex
|
|
96
103
|
@misc{@article{MOTOYAMA2022108405,
|
|
97
104
|
title = {Bayesian optimization package: PHYSBO},
|
|
98
105
|
journal = {Computer Physics Communications},
|
|
@@ -8,19 +8,25 @@ PHYSBO was developed based on [COMBO](https://github.com/tsudalab/combo) for aca
|
|
|
8
8
|
## Documentation
|
|
9
9
|
|
|
10
10
|
- Stable (master branch)
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
- [English](https://issp-center-dev.github.io/PHYSBO/manual/master/en/index.html)
|
|
12
|
+
- [日本語](https://issp-center-dev.github.io/PHYSBO/manual/master/ja/index.html)
|
|
13
13
|
- Latest (develop branch)
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
- [English](https://issp-center-dev.github.io/PHYSBO/manual/develop/en/index.html)
|
|
15
|
+
- [日本語](https://issp-center-dev.github.io/PHYSBO/manual/develop/ja/index.html)
|
|
16
16
|
|
|
17
17
|
## Dependencies
|
|
18
18
|
|
|
19
|
-
- Python >= 3.
|
|
20
|
-
|
|
21
|
-
- NumPy < 2.0.0
|
|
19
|
+
- Python >= 3.9
|
|
20
|
+
- NumPy
|
|
22
21
|
- SciPy
|
|
23
22
|
|
|
23
|
+
### About Cython
|
|
24
|
+
|
|
25
|
+
From v3.0.0, PHYSBO no longer uses Cython in order to simplify installation process particularly on Windows.
|
|
26
|
+
This means that the performance of PHYSBO is slightly degraded from older versions.
|
|
27
|
+
If you need more performance, you can install ``physbo-core-cython`` additionally.
|
|
28
|
+
This package offers Cythonized version of some functions of PHYSBO.
|
|
29
|
+
|
|
24
30
|
## Install
|
|
25
31
|
|
|
26
32
|
- From PyPI (recommended)
|
|
@@ -30,15 +36,10 @@ python3 -m pip install physbo
|
|
|
30
36
|
```
|
|
31
37
|
|
|
32
38
|
- From source (for developers)
|
|
33
|
-
1. Update pip (>= 19.0)
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
python3 -m pip install -U pip
|
|
37
|
-
```
|
|
38
39
|
|
|
39
40
|
1. Download or clone the github repository
|
|
40
41
|
|
|
41
|
-
```
|
|
42
|
+
```bash
|
|
42
43
|
git clone https://github.com/issp-center-dev/PHYSBO
|
|
43
44
|
```
|
|
44
45
|
|
|
@@ -51,7 +52,11 @@ python3 -m pip install physbo
|
|
|
51
52
|
python3 -m pip install ./PHYSBO
|
|
52
53
|
```
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
- To install ``physbo-core-cython`` ::
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python3 -m pip install physbo-core-cython
|
|
59
|
+
```
|
|
55
60
|
|
|
56
61
|
## Uninstall
|
|
57
62
|
|
|
@@ -61,25 +66,25 @@ python3 -m pip uninstall physbo
|
|
|
61
66
|
|
|
62
67
|
## Usage
|
|
63
68
|
|
|
64
|
-
For an introductory tutorial please consult the documentation. ([English](https://issp-center-dev.github.io/PHYSBO/manual/master/en/notebook/tutorial_basic.html) / [日本語](https://issp-center-dev.github.io/PHYSBO/manual/develop/ja/install.html#id2))
|
|
69
|
+
For an introductory tutorial please consult the documentation. ([English](https://issp-center-dev.github.io/PHYSBO/manual/master/en/notebook/tutorial_basic.html) / [日本語](https://issp-center-dev.github.io/PHYSBO/manual/develop/ja/install.html#id2))
|
|
65
70
|
|
|
66
71
|
['examples/simple.py'](./examples/simple.py) is a simple example.
|
|
67
72
|
|
|
68
73
|
## Data repository
|
|
69
74
|
|
|
70
|
-
A tutorial and a dataset of a paper about PHYSBO can be found in [PHYSBO Gallery](
|
|
75
|
+
A tutorial and a dataset of a paper about PHYSBO can be found in [PHYSBO Gallery](https://isspns-gitlab.issp.u-tokyo.ac.jp/physbo-dev/physbo-gallery).
|
|
71
76
|
|
|
72
77
|
## License
|
|
73
78
|
|
|
74
79
|
PHYSBO was developed based on [COMBO](https://github.com/tsudalab/COMBO) for academic use.
|
|
75
|
-
PHYSBO
|
|
80
|
+
PHYSBO is distributed under Mozilla Public License version 2.0 (MPL v2).
|
|
76
81
|
We hope that you cite the following reference when you publish the results using PHYSBO:
|
|
77
82
|
|
|
78
83
|
[“Bayesian optimization package: PHYSBO”, Yuichi Motoyama, Ryo Tamura, Kazuyoshi Yoshimi, Kei Terayama, Tsuyoshi Ueno, Koji Tsuda, Computer Physics Communications Volume 278, September 2022, 108405.](https://doi.org/10.1016/j.cpc.2022.108405)
|
|
79
84
|
|
|
80
85
|
Bibtex
|
|
81
86
|
|
|
82
|
-
```
|
|
87
|
+
```bibtex
|
|
83
88
|
@misc{@article{MOTOYAMA2022108405,
|
|
84
89
|
title = {Bayesian optimization package: PHYSBO},
|
|
85
90
|
journal = {Computer Physics Communications},
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "physbo"
|
|
7
|
+
version = "3.0.0"
|
|
8
|
+
description = "optimization tool for PHYSics based on Bayesian Optimization"
|
|
9
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
|
+
license = "MPL-2.0"
|
|
11
|
+
authors = [ { name = "PHYSBO developers", email = "physbo-dev@issp.u-tokyo.ac.jp" } ]
|
|
12
|
+
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"numpy",
|
|
16
|
+
"scipy",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
homepage = "https://www.pasums.issp.u-tokyo.ac.jp/physbo/en"
|
|
21
|
+
source = "https://github.com/issp-center-dev/PHYSBO"
|
|
22
|
+
documentation = "https://issp-center-dev.github.io/PHYSBO/"
|
|
23
|
+
releasenotes = "https://github.com/issp-center-dev/PHYSBO/releases"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
[tool.setuptools.packages.find]
|
|
27
|
+
where = ["src"]
|
|
28
|
+
|
|
29
|
+
[tool.ruff]
|
|
30
|
+
|
|
31
|
+
[tool.ruff.lint]
|
|
32
|
+
ignore = ["E741"]
|
physbo-3.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
# Copyright (C) 2020- The University of Tokyo
|
|
3
|
+
#
|
|
4
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
7
|
+
|
|
8
|
+
from . import gp
|
|
9
|
+
from . import opt
|
|
10
|
+
from . import blm
|
|
11
|
+
from . import misc
|
|
12
|
+
from . import search
|
|
13
|
+
from . import predictor
|
|
14
|
+
from ._variable import Variable
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def base_predictor(*args, **kwargs):
|
|
18
|
+
":meta private:"
|
|
19
|
+
misc.deprecated_warning(old="physbo.base_predictor", new="physbo.predictor.BasePredictor")
|
|
20
|
+
return predictor.BasePredictor(*args, **kwargs)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def variable(*args, **kwargs):
|
|
24
|
+
":meta private:"
|
|
25
|
+
misc.deprecated_warning(old="physbo.variable", new="physbo.Variable")
|
|
26
|
+
return Variable(*args, **kwargs)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__version__ = "3.0.0"
|
|
30
|
+
|
|
31
|
+
# __all__ is used to specify the public API of the package
|
|
32
|
+
# and is used by sphinx to generate the API documentation
|
|
33
|
+
__all__ = ["gp", "opt", "blm", "misc", "search", "predictor", "Variable"]
|
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class Variable(object):
|
|
12
|
+
""" Variable class
|
|
13
|
+
|
|
14
|
+
Variable class represents a set of pairs of input (X) and output (t).
|
|
15
|
+
|
|
16
|
+
"""
|
|
12
17
|
def __init__(self, X=None, t=None, Z=None):
|
|
13
18
|
"""
|
|
14
19
|
|
|
@@ -18,13 +23,19 @@ class variable(object):
|
|
|
18
23
|
N x d dimensional matrix. Each row of X denotes the d-dimensional feature vector of each search candidate.
|
|
19
24
|
t: numpy array
|
|
20
25
|
N dimensional array. The negative energy of each search candidate (value of the objective function to be optimized).
|
|
21
|
-
Z:
|
|
26
|
+
Z: numpy array
|
|
22
27
|
|
|
23
28
|
"""
|
|
24
29
|
self.X = X
|
|
25
30
|
self.Z = Z
|
|
26
31
|
self.t = t
|
|
27
32
|
|
|
33
|
+
def __len__(self):
|
|
34
|
+
if self.X is not None:
|
|
35
|
+
return self.X.shape[0]
|
|
36
|
+
else:
|
|
37
|
+
return 0
|
|
38
|
+
|
|
28
39
|
def get_subset(self, index):
|
|
29
40
|
"""
|
|
30
41
|
Getting subset of variables.
|
|
@@ -41,7 +52,7 @@ class variable(object):
|
|
|
41
52
|
temp_t = self.t[index] if self.t is not None else None
|
|
42
53
|
temp_Z = self.Z[index, :] if self.Z is not None else None
|
|
43
54
|
|
|
44
|
-
return
|
|
55
|
+
return Variable(X=temp_X, t=temp_t, Z=temp_Z)
|
|
45
56
|
|
|
46
57
|
def delete(self, num_row):
|
|
47
58
|
"""
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
# Copyright (C) 2020- The University of Tokyo
|
|
3
|
+
#
|
|
4
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
7
|
+
|
|
8
|
+
"""Bayesian Linear Model"""
|
|
9
|
+
|
|
10
|
+
from . import basis
|
|
11
|
+
from . import prior
|
|
12
|
+
from . import lik
|
|
13
|
+
from . import inf
|
|
14
|
+
from . import core
|
|
15
|
+
|
|
16
|
+
from .core import Model
|
|
17
|
+
from ._predictor import Predictor
|
|
18
|
+
|
|
19
|
+
from ..misc import deprecated_warning
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def model(*args, **kwargs):
|
|
23
|
+
":meta private:"
|
|
24
|
+
deprecated_warning(old="physbo.blm.model", new="physbo.blm.Model")
|
|
25
|
+
return Model(*args, **kwargs)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def predictor(*args, **kwargs):
|
|
29
|
+
":meta private:"
|
|
30
|
+
deprecated_warning(old="physbo.blm.predictor", new="physbo.blm.Predictor")
|
|
31
|
+
return Predictor(*args, **kwargs)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
__all__ = ["basis", "prior", "lik", "inf", "core", "Model", "Predictor"]
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
import physbo.predictor
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class Predictor(physbo.predictor.BasePredictor):
|
|
12
12
|
"""Predictor using Baysean linear model
|
|
13
13
|
|
|
14
14
|
Attributes
|
|
15
15
|
==========
|
|
16
|
-
blm: physbo.blm.core.
|
|
17
|
-
config: physbo.misc.
|
|
16
|
+
blm: physbo.blm.core.Model
|
|
17
|
+
config: physbo.misc.SetConfig
|
|
18
18
|
configuration
|
|
19
19
|
"""
|
|
20
20
|
|
|
@@ -23,18 +23,18 @@ class predictor(physbo.predictor.base_predictor):
|
|
|
23
23
|
|
|
24
24
|
Parameters
|
|
25
25
|
==========
|
|
26
|
-
config: physbo.misc.
|
|
26
|
+
config: physbo.misc.SetConfig
|
|
27
27
|
configuration
|
|
28
|
-
model: physbo.gp.core.
|
|
28
|
+
model: physbo.gp.core.Model
|
|
29
29
|
|
|
30
30
|
See also
|
|
31
31
|
========
|
|
32
|
-
physbo.
|
|
32
|
+
physbo.predictor.BasePredictor
|
|
33
33
|
"""
|
|
34
|
-
super(
|
|
34
|
+
super(Predictor, self).__init__(config, model)
|
|
35
35
|
self.blm = None
|
|
36
36
|
|
|
37
|
-
def fit(self, training, num_basis=None):
|
|
37
|
+
def fit(self, training, num_basis=None, comm=None):
|
|
38
38
|
"""
|
|
39
39
|
fit model to training dataset
|
|
40
40
|
|
|
@@ -44,14 +44,16 @@ class predictor(physbo.predictor.base_predictor):
|
|
|
44
44
|
dataset for training
|
|
45
45
|
num_basis: int
|
|
46
46
|
the number of basis (default: self.config.predict.num_basis)
|
|
47
|
+
comm: MPI.Comm
|
|
48
|
+
MPI communicator
|
|
47
49
|
"""
|
|
48
50
|
if num_basis is None:
|
|
49
51
|
num_basis = self.config.predict.num_basis
|
|
50
52
|
|
|
51
53
|
if self.model.prior.cov.num_dim is None:
|
|
52
54
|
self.model.prior.cov.num_dim = training.X.shape[1]
|
|
53
|
-
self.model.fit(training.X, training.t, self.config)
|
|
54
|
-
self.blm = self.model.export_blm(num_basis)
|
|
55
|
+
self.model.fit(training.X, training.t, self.config, comm=comm)
|
|
56
|
+
self.blm = self.model.export_blm(num_basis, comm=comm)
|
|
55
57
|
self.delete_stats()
|
|
56
58
|
|
|
57
59
|
def prepare(self, training):
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
# Copyright (C) 2020- The University of Tokyo
|
|
3
|
+
#
|
|
4
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
7
|
+
|
|
8
|
+
from ._fourier import Fourier
|
|
9
|
+
|
|
10
|
+
from ...misc import deprecated_warning
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def fourier(*args, **kwargs):
|
|
14
|
+
":meta private:"
|
|
15
|
+
deprecated_warning(old="physbo.blm.basis.fourier", new="physbo.blm.basis.Fourier")
|
|
16
|
+
return Fourier(*args, **kwargs)
|
|
17
|
+
|
|
18
|
+
__all__ = ["Fourier"]
|
|
@@ -7,17 +7,18 @@
|
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
from .. import inf
|
|
10
|
+
from ...misc.permutation_importance import get_permutation_importance
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
class
|
|
13
|
+
class Model:
|
|
13
14
|
"""
|
|
14
15
|
Baysean Linear Model
|
|
15
16
|
|
|
16
17
|
Attributes
|
|
17
18
|
==========
|
|
18
|
-
prior: physbo.blm.prior.
|
|
19
|
+
prior: physbo.blm.prior.Gauss
|
|
19
20
|
prior distribution of weights
|
|
20
|
-
lik: physbo.blm.lik.
|
|
21
|
+
lik: physbo.blm.lik.Gauss
|
|
21
22
|
kernel
|
|
22
23
|
nbasis: int
|
|
23
24
|
number of features in random feature map
|
|
@@ -123,7 +124,7 @@ class model:
|
|
|
123
124
|
|
|
124
125
|
Parameters
|
|
125
126
|
==========
|
|
126
|
-
blm: physbo.blm.core.
|
|
127
|
+
blm: physbo.blm.core.Model
|
|
127
128
|
model
|
|
128
129
|
w_mu: numpy.ndarray
|
|
129
130
|
mean of weight
|
|
@@ -231,6 +232,40 @@ class model:
|
|
|
231
232
|
pass
|
|
232
233
|
return fcov
|
|
233
234
|
|
|
235
|
+
def get_permutation_importance(
|
|
236
|
+
self, X, t, n_perm: int, comm=None, split_features_parallel=False
|
|
237
|
+
):
|
|
238
|
+
"""
|
|
239
|
+
Calculating permutation importance of model
|
|
240
|
+
|
|
241
|
+
Parameters
|
|
242
|
+
==========
|
|
243
|
+
X: numpy.ndarray
|
|
244
|
+
inputs
|
|
245
|
+
t: numpy.ndarray
|
|
246
|
+
target (label)
|
|
247
|
+
n_perm: int
|
|
248
|
+
number of permutations
|
|
249
|
+
comm: MPI.Comm
|
|
250
|
+
MPI communicator
|
|
251
|
+
|
|
252
|
+
Returns
|
|
253
|
+
=======
|
|
254
|
+
numpy.ndarray
|
|
255
|
+
importance_mean
|
|
256
|
+
numpy.ndarray
|
|
257
|
+
importance_std
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
return get_permutation_importance(
|
|
261
|
+
self,
|
|
262
|
+
X,
|
|
263
|
+
t,
|
|
264
|
+
n_perm,
|
|
265
|
+
comm=comm,
|
|
266
|
+
split_features_parallel=split_features_parallel,
|
|
267
|
+
)
|
|
268
|
+
|
|
234
269
|
def _set_options(self, options):
|
|
235
270
|
"""
|
|
236
271
|
read options
|
|
@@ -251,9 +286,9 @@ class model:
|
|
|
251
286
|
|
|
252
287
|
Parameters
|
|
253
288
|
==========
|
|
254
|
-
prior: physbo.blm.prior.
|
|
255
|
-
if None, prior.
|
|
289
|
+
prior: physbo.blm.prior.Gauss
|
|
290
|
+
if None, prior.Gauss(self.nbasis)
|
|
256
291
|
"""
|
|
257
292
|
if prior is None:
|
|
258
|
-
prior = prior.
|
|
293
|
+
prior = prior.Gauss(self.nbasis)
|
|
259
294
|
self.prior = prior
|
|
@@ -19,7 +19,7 @@ def prepare(blm, X, t, Psi=None):
|
|
|
19
19
|
|
|
20
20
|
Parameters
|
|
21
21
|
==========
|
|
22
|
-
blm: physbo.blm.core.
|
|
22
|
+
blm: physbo.blm.core.Model
|
|
23
23
|
model
|
|
24
24
|
X: numpy.ndarray
|
|
25
25
|
inputs
|
|
@@ -45,7 +45,7 @@ def update_stats(blm, x, t, psi=None):
|
|
|
45
45
|
|
|
46
46
|
Parameters
|
|
47
47
|
==========
|
|
48
|
-
blm: physbo.blm.core.
|
|
48
|
+
blm: physbo.blm.core.Model
|
|
49
49
|
model
|
|
50
50
|
x: numpy.ndarray
|
|
51
51
|
input
|
|
@@ -78,7 +78,7 @@ def sampling(blm, w_mu=None, N=1, alpha=1.0):
|
|
|
78
78
|
|
|
79
79
|
Parameters
|
|
80
80
|
==========
|
|
81
|
-
blm: physbo.blm.core.
|
|
81
|
+
blm: physbo.blm.core.Model
|
|
82
82
|
model
|
|
83
83
|
w_mu: numpy.ndarray
|
|
84
84
|
mean of weight
|
|
@@ -114,7 +114,7 @@ def get_post_params_mean(blm):
|
|
|
114
114
|
|
|
115
115
|
Parameters
|
|
116
116
|
==========
|
|
117
|
-
blm: physbo.blm.core.
|
|
117
|
+
blm: physbo.blm.core.Model
|
|
118
118
|
|
|
119
119
|
Returns
|
|
120
120
|
=======
|
|
@@ -129,7 +129,7 @@ def get_post_fmean(blm, X, Psi=None, w=None):
|
|
|
129
129
|
|
|
130
130
|
Parameters
|
|
131
131
|
==========
|
|
132
|
-
blm: physbo.blm.core.
|
|
132
|
+
blm: physbo.blm.core.Model
|
|
133
133
|
X: numpy.ndarray
|
|
134
134
|
inputs
|
|
135
135
|
Psi: numpy.ndarray
|
|
@@ -157,7 +157,7 @@ def get_post_fcov(blm, X, Psi=None, diag=True):
|
|
|
157
157
|
|
|
158
158
|
Parameters
|
|
159
159
|
==========
|
|
160
|
-
blm: physbo.blm.core.
|
|
160
|
+
blm: physbo.blm.core.Model
|
|
161
161
|
X: numpy.ndarray
|
|
162
162
|
inputs
|
|
163
163
|
Psi: numpy.ndarray
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
# Copyright (C) 2020- The University of Tokyo
|
|
3
|
+
#
|
|
4
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
7
|
+
|
|
8
|
+
from ._cov import Cov
|
|
9
|
+
from ._gauss import Gauss
|
|
10
|
+
from ._linear import Linear
|
|
11
|
+
|
|
12
|
+
from ...misc import deprecated_warning
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def cov(*args, **kwargs):
|
|
16
|
+
":meta private:"
|
|
17
|
+
deprecated_warning(old="physbo.blm.lik.cov", new="physbo.blm.lik.Cov")
|
|
18
|
+
return Cov(*args, **kwargs)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def gauss(*args, **kwargs):
|
|
22
|
+
":meta private:"
|
|
23
|
+
deprecated_warning(old="physbo.blm.lik.gauss", new="physbo.blm.lik.Gauss")
|
|
24
|
+
return Gauss(*args, **kwargs)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def linear(*args, **kwargs):
|
|
28
|
+
":meta private:"
|
|
29
|
+
deprecated_warning(old="physbo.blm.lik.linear", new="physbo.blm.lik.Linear")
|
|
30
|
+
return Linear(*args, **kwargs)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__all__ = ["Cov", "Gauss", "Linear"]
|