physbo 2.2.0__tar.gz → 3.1.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.
Files changed (95) hide show
  1. {physbo-2.2.0 → physbo-3.1.0}/PKG-INFO +22 -26
  2. {physbo-2.2.0 → physbo-3.1.0}/README.md +11 -19
  3. physbo-3.1.0/pyproject.toml +35 -0
  4. physbo-3.1.0/setup.cfg +4 -0
  5. physbo-3.1.0/src/physbo/__init__.py +33 -0
  6. physbo-2.2.0/physbo/variable.py → physbo-3.1.0/src/physbo/_variable.py +14 -3
  7. physbo-3.1.0/src/physbo/blm/__init__.py +34 -0
  8. physbo-2.2.0/physbo/blm/predictor.py → physbo-3.1.0/src/physbo/blm/_predictor.py +12 -10
  9. physbo-3.1.0/src/physbo/blm/basis/__init__.py +18 -0
  10. physbo-2.2.0/physbo/blm/basis/fourier.py → physbo-3.1.0/src/physbo/blm/basis/_fourier.py +1 -1
  11. {physbo-2.2.0/physbo/blm/lik/_src → physbo-3.1.0/src/physbo/blm/core}/__init__.py +3 -1
  12. physbo-2.2.0/physbo/blm/core/model.py → physbo-3.1.0/src/physbo/blm/core/_model.py +42 -7
  13. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/blm/inf/__init__.py +2 -0
  14. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/blm/inf/exact.py +6 -6
  15. physbo-3.1.0/src/physbo/blm/lik/__init__.py +33 -0
  16. physbo-2.2.0/physbo/blm/lik/_src/cov.py → physbo-3.1.0/src/physbo/blm/lik/_cov.py +1 -1
  17. physbo-2.2.0/physbo/blm/lik/gauss.py → physbo-3.1.0/src/physbo/blm/lik/_gauss.py +6 -5
  18. physbo-2.2.0/physbo/blm/lik/linear.py → physbo-3.1.0/src/physbo/blm/lik/_linear.py +1 -1
  19. {physbo-2.2.0/physbo/blm → physbo-3.1.0/src/physbo/blm/prior}/__init__.py +6 -8
  20. physbo-2.2.0/physbo/blm/prior/gauss.py → physbo-3.1.0/src/physbo/blm/prior/_gauss.py +8 -8
  21. physbo-3.1.0/src/physbo/gp/__init__.py +46 -0
  22. physbo-2.2.0/physbo/gp/predictor.py → physbo-3.1.0/src/physbo/gp/_predictor.py +15 -8
  23. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/gp/core/__init__.py +4 -4
  24. physbo-2.2.0/physbo/gp/core/model.py → physbo-3.1.0/src/physbo/gp/core/_model.py +77 -32
  25. physbo-2.2.0/physbo/gp/core/prior.py → physbo-3.1.0/src/physbo/gp/core/_prior.py +5 -5
  26. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/gp/core/learning.py +38 -15
  27. {physbo-2.2.0/physbo/gp → physbo-3.1.0/src/physbo/gp/cov}/__init__.py +10 -8
  28. physbo-2.2.0/physbo/gp/cov/gauss.py → physbo-3.1.0/src/physbo/gp/cov/_gauss.py +34 -5
  29. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/gp/inf/__init__.py +2 -0
  30. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/gp/inf/exact.py +7 -10
  31. physbo-3.1.0/src/physbo/gp/lik/__init__.py +18 -0
  32. physbo-2.2.0/physbo/gp/lik/gauss.py → physbo-3.1.0/src/physbo/gp/lik/_gauss.py +6 -6
  33. physbo-3.1.0/src/physbo/gp/mean/__init__.py +26 -0
  34. physbo-2.2.0/physbo/gp/mean/const.py → physbo-3.1.0/src/physbo/gp/mean/_const.py +1 -1
  35. physbo-2.2.0/physbo/gp/mean/zero.py → physbo-3.1.0/src/physbo/gp/mean/_zero.py +1 -1
  36. physbo-3.1.0/src/physbo/misc/__init__.py +42 -0
  37. physbo-3.1.0/src/physbo/misc/_cholesky.py +59 -0
  38. physbo-2.2.0/physbo/misc/gauss_elim.py → physbo-3.1.0/src/physbo/misc/_gauss_elim.py +0 -1
  39. physbo-3.1.0/src/physbo/misc/_matrix.py +74 -0
  40. physbo-2.2.0/physbo/misc/set_config.py → physbo-3.1.0/src/physbo/misc/_set_config.py +27 -27
  41. physbo-3.1.0/src/physbo/misc/permutation_importance.py +85 -0
  42. {physbo-2.2.0/physbo → physbo-3.1.0/src/physbo/opt}/__init__.py +10 -9
  43. physbo-2.2.0/physbo/opt/adam.py → physbo-3.1.0/src/physbo/opt/_adam.py +1 -1
  44. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/predictor.py +41 -8
  45. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/search/__init__.py +4 -0
  46. physbo-3.1.0/src/physbo/search/discrete/__init__.py +29 -0
  47. physbo-2.2.0/physbo/search/discrete/results.py → physbo-3.1.0/src/physbo/search/discrete/_history.py +27 -2
  48. physbo-2.2.0/physbo/search/discrete/policy.py → physbo-3.1.0/src/physbo/search/discrete/_policy.py +84 -34
  49. physbo-3.1.0/src/physbo/search/discrete_multi/__init__.py +31 -0
  50. physbo-2.2.0/physbo/search/discrete_multi/results.py → physbo-3.1.0/src/physbo/search/discrete_multi/_history.py +42 -1
  51. physbo-2.2.0/physbo/search/discrete_multi/policy.py → physbo-3.1.0/src/physbo/search/discrete_multi/_policy.py +70 -23
  52. physbo-3.1.0/src/physbo/search/optimize/__init__.py +0 -0
  53. physbo-3.1.0/src/physbo/search/optimize/odatse.py +192 -0
  54. physbo-3.1.0/src/physbo/search/optimize/random.py +57 -0
  55. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/search/pareto.py +4 -1
  56. physbo-3.1.0/src/physbo/search/range/__init__.py +29 -0
  57. physbo-3.1.0/src/physbo/search/range/_history.py +234 -0
  58. physbo-3.1.0/src/physbo/search/range/_policy.py +735 -0
  59. physbo-3.1.0/src/physbo/search/range_multi/__init__.py +29 -0
  60. physbo-3.1.0/src/physbo/search/range_multi/_history.py +190 -0
  61. physbo-3.1.0/src/physbo/search/range_multi/_policy.py +633 -0
  62. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/search/score_multi.py +52 -0
  63. physbo-3.1.0/src/physbo/search/utility.py +41 -0
  64. {physbo-2.2.0 → physbo-3.1.0/src}/physbo.egg-info/PKG-INFO +22 -26
  65. physbo-3.1.0/src/physbo.egg-info/SOURCES.txt +68 -0
  66. physbo-3.1.0/src/physbo.egg-info/requires.txt +5 -0
  67. physbo-2.2.0/physbo/blm/basis/__init__.py +0 -8
  68. physbo-2.2.0/physbo/blm/core/__init__.py +0 -8
  69. physbo-2.2.0/physbo/blm/lik/__init__.py +0 -10
  70. physbo-2.2.0/physbo/blm/prior/__init__.py +0 -8
  71. physbo-2.2.0/physbo/gp/cov/__init__.py +0 -8
  72. physbo-2.2.0/physbo/gp/cov/_src/__init__.py +0 -1
  73. physbo-2.2.0/physbo/gp/cov/_src/enhance_gauss.pyx +0 -86
  74. physbo-2.2.0/physbo/gp/lik/__init__.py +0 -8
  75. physbo-2.2.0/physbo/gp/mean/__init__.py +0 -9
  76. physbo-2.2.0/physbo/misc/__init__.py +0 -15
  77. physbo-2.2.0/physbo/misc/_src/__init__.py +0 -1
  78. physbo-2.2.0/physbo/misc/_src/cholupdate.pyx +0 -47
  79. physbo-2.2.0/physbo/misc/_src/diagAB.pyx +0 -44
  80. physbo-2.2.0/physbo/misc/_src/logsumexp.pyx +0 -39
  81. physbo-2.2.0/physbo/misc/_src/traceAB.pyx +0 -75
  82. physbo-2.2.0/physbo/opt/__init__.py +0 -8
  83. physbo-2.2.0/physbo/search/discrete/__init__.py +0 -11
  84. physbo-2.2.0/physbo/search/discrete_multi/__init__.py +0 -11
  85. physbo-2.2.0/physbo/search/utility.py +0 -101
  86. physbo-2.2.0/physbo.egg-info/SOURCES.txt +0 -67
  87. physbo-2.2.0/physbo.egg-info/not-zip-safe +0 -1
  88. physbo-2.2.0/physbo.egg-info/requires.txt +0 -2
  89. physbo-2.2.0/pyproject.toml +0 -3
  90. physbo-2.2.0/setup.cfg +0 -23
  91. physbo-2.2.0/setup.py +0 -53
  92. /physbo-2.2.0/physbo/misc/centering.py → /physbo-3.1.0/src/physbo/misc/_centering.py +0 -0
  93. {physbo-2.2.0 → physbo-3.1.0/src}/physbo/search/score.py +0 -0
  94. {physbo-2.2.0 → physbo-3.1.0/src}/physbo.egg-info/dependency_links.txt +0 -0
  95. {physbo-2.2.0 → physbo-3.1.0/src}/physbo.egg-info/top_level.txt +0 -0
@@ -1,15 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: physbo
3
- Version: 2.2.0
3
+ Version: 3.1.0
4
4
  Summary: optimization tool for PHYSics based on Bayesian Optimization
5
- Home-page: https://github.com/issp-center-dev/PHYSBO
6
- Author: PHYSBO developers
7
- Author-email: physbo-dev@issp.u-tokyo.ac.jp
8
- License: MPLv2
9
- Requires-Python: >=3.6
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<2.0
13
+ Requires-Dist: numpy
12
14
  Requires-Dist: scipy
15
+ Provides-Extra: odat-se
16
+ Requires-Dist: odat-se; extra == "odat-se"
13
17
 
14
18
  # optimization tools for PHYsics based on Bayesian Optimization ( PHYSBO )
15
19
 
@@ -21,17 +25,16 @@ PHYSBO was developed based on [COMBO](https://github.com/tsudalab/combo) for aca
21
25
  ## Documentation
22
26
 
23
27
  - Stable (master branch)
24
- - [English](https://issp-center-dev.github.io/PHYSBO/manual/master/en/index.html)
25
- - [日本語](https://issp-center-dev.github.io/PHYSBO/manual/master/ja/index.html)
28
+ - [English](https://issp-center-dev.github.io/PHYSBO/manual/master/en/index.html)
29
+ - [日本語](https://issp-center-dev.github.io/PHYSBO/manual/master/ja/index.html)
26
30
  - Latest (develop branch)
27
- - [English](https://issp-center-dev.github.io/PHYSBO/manual/develop/en/index.html)
28
- - [日本語](https://issp-center-dev.github.io/PHYSBO/manual/develop/ja/index.html)
31
+ - [English](https://issp-center-dev.github.io/PHYSBO/manual/develop/en/index.html)
32
+ - [日本語](https://issp-center-dev.github.io/PHYSBO/manual/develop/ja/index.html)
29
33
 
30
34
  ## Dependencies
31
35
 
32
- - Python >= 3.6
33
- - No longer tested with Python 3.6
34
- - NumPy < 2.0.0
36
+ - Python >= 3.9
37
+ - NumPy
35
38
  - SciPy
36
39
 
37
40
  ## Install
@@ -43,15 +46,10 @@ python3 -m pip install physbo
43
46
  ```
44
47
 
45
48
  - From source (for developers)
46
- 1. Update pip (>= 19.0)
47
-
48
- ```bash
49
- python3 -m pip install -U pip
50
- ```
51
49
 
52
50
  1. Download or clone the github repository
53
51
 
54
- ```
52
+ ```bash
55
53
  git clone https://github.com/issp-center-dev/PHYSBO
56
54
  ```
57
55
 
@@ -64,8 +62,6 @@ python3 -m pip install physbo
64
62
  python3 -m pip install ./PHYSBO
65
63
  ```
66
64
 
67
- 1. Note: Do not `import physbo` at the root directory of the repository because `import physbo` does not try to import the installed PHYSBO but one in the repository, which includes Cython codes not compiled.
68
-
69
65
  ## Uninstall
70
66
 
71
67
  ```bash
@@ -74,25 +70,25 @@ python3 -m pip uninstall physbo
74
70
 
75
71
  ## Usage
76
72
 
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))
73
+ 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
74
 
79
75
  ['examples/simple.py'](./examples/simple.py) is a simple example.
80
76
 
81
77
  ## Data repository
82
78
 
83
- A tutorial and a dataset of a paper about PHYSBO can be found in [PHYSBO Gallery](http://isspns-container.issp.u-tokyo.ac.jp/repo/12).
79
+ 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
80
 
85
81
  ## License
86
82
 
87
83
  PHYSBO was developed based on [COMBO](https://github.com/tsudalab/COMBO) for academic use.
88
- PHYSBO v2 is distributed under Mozilla Public License version 2.0 (MPL v2).
84
+ PHYSBO is distributed under Mozilla Public License version 2.0 (MPL v2).
89
85
  We hope that you cite the following reference when you publish the results using PHYSBO:
90
86
 
91
87
  [“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
88
 
93
89
  Bibtex
94
90
 
95
- ```
91
+ ```bibtex
96
92
  @misc{@article{MOTOYAMA2022108405,
97
93
  title = {Bayesian optimization package: PHYSBO},
98
94
  journal = {Computer Physics Communications},
@@ -8,17 +8,16 @@ PHYSBO was developed based on [COMBO](https://github.com/tsudalab/combo) for aca
8
8
  ## Documentation
9
9
 
10
10
  - Stable (master branch)
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)
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
- - [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)
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.6
20
- - No longer tested with Python 3.6
21
- - NumPy < 2.0.0
19
+ - Python >= 3.9
20
+ - NumPy
22
21
  - SciPy
23
22
 
24
23
  ## Install
@@ -30,15 +29,10 @@ python3 -m pip install physbo
30
29
  ```
31
30
 
32
31
  - From source (for developers)
33
- 1. Update pip (>= 19.0)
34
-
35
- ```bash
36
- python3 -m pip install -U pip
37
- ```
38
32
 
39
33
  1. Download or clone the github repository
40
34
 
41
- ```
35
+ ```bash
42
36
  git clone https://github.com/issp-center-dev/PHYSBO
43
37
  ```
44
38
 
@@ -51,8 +45,6 @@ python3 -m pip install physbo
51
45
  python3 -m pip install ./PHYSBO
52
46
  ```
53
47
 
54
- 1. Note: Do not `import physbo` at the root directory of the repository because `import physbo` does not try to import the installed PHYSBO but one in the repository, which includes Cython codes not compiled.
55
-
56
48
  ## Uninstall
57
49
 
58
50
  ```bash
@@ -61,25 +53,25 @@ python3 -m pip uninstall physbo
61
53
 
62
54
  ## Usage
63
55
 
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))
56
+ 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
57
 
66
58
  ['examples/simple.py'](./examples/simple.py) is a simple example.
67
59
 
68
60
  ## Data repository
69
61
 
70
- A tutorial and a dataset of a paper about PHYSBO can be found in [PHYSBO Gallery](http://isspns-container.issp.u-tokyo.ac.jp/repo/12).
62
+ 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
63
 
72
64
  ## License
73
65
 
74
66
  PHYSBO was developed based on [COMBO](https://github.com/tsudalab/COMBO) for academic use.
75
- PHYSBO v2 is distributed under Mozilla Public License version 2.0 (MPL v2).
67
+ PHYSBO is distributed under Mozilla Public License version 2.0 (MPL v2).
76
68
  We hope that you cite the following reference when you publish the results using PHYSBO:
77
69
 
78
70
  [“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
71
 
80
72
  Bibtex
81
73
 
82
- ```
74
+ ```bibtex
83
75
  @misc{@article{MOTOYAMA2022108405,
84
76
  title = {Bayesian optimization package: PHYSBO},
85
77
  journal = {Computer Physics Communications},
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "physbo"
7
+ version = "3.1.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.optional-dependencies]
20
+ odat-se = [ "odat-se" ]
21
+
22
+ [project.urls]
23
+ homepage = "https://www.pasums.issp.u-tokyo.ac.jp/physbo/en"
24
+ source = "https://github.com/issp-center-dev/PHYSBO"
25
+ documentation = "https://issp-center-dev.github.io/PHYSBO/"
26
+ releasenotes = "https://github.com/issp-center-dev/PHYSBO/releases"
27
+
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+
32
+ [tool.ruff]
33
+
34
+ [tool.ruff.lint]
35
+ ignore = ["E741"]
physbo-3.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -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.1.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 variable(object):
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 variable(X=temp_X, t=temp_t, Z=temp_Z)
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 predictor(physbo.predictor.base_predictor):
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.model
17
- config: physbo.misc.set_config
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.set_config
26
+ config: physbo.misc.SetConfig
27
27
  configuration
28
- model: physbo.gp.core.model
28
+ model: physbo.gp.core.Model
29
29
 
30
30
  See also
31
31
  ========
32
- physbo.base_predictor
32
+ physbo.predictor.BasePredictor
33
33
  """
34
- super(predictor, self).__init__(config, model)
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"]
@@ -9,7 +9,7 @@
9
9
  import numpy as np
10
10
 
11
11
 
12
- class fourier:
12
+ class Fourier:
13
13
  """
14
14
  random feature maps
15
15
  ``Psi(X; W,b) = cos[X * Wt + b] * alpha``
@@ -5,4 +5,6 @@
5
5
  # License, v. 2.0. If a copy of the MPL was not distributed with this
6
6
  # file, You can obtain one at https://mozilla.org/MPL/2.0/.
7
7
 
8
- from .cov import cov
8
+ from ._model import Model
9
+
10
+ __all__ = ["Model"]
@@ -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 model:
13
+ class Model:
13
14
  """
14
15
  Baysean Linear Model
15
16
 
16
17
  Attributes
17
18
  ==========
18
- prior: physbo.blm.prior.gauss
19
+ prior: physbo.blm.prior.Gauss
19
20
  prior distribution of weights
20
- lik: physbo.blm.lik.gauss
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.model
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.gauss
255
- if None, prior.gauss(self.nbasis)
289
+ prior: physbo.blm.prior.Gauss
290
+ if None, prior.Gauss(self.nbasis)
256
291
  """
257
292
  if prior is None:
258
- prior = prior.gauss(self.nbasis)
293
+ prior = prior.Gauss(self.nbasis)
259
294
  self.prior = prior
@@ -6,3 +6,5 @@
6
6
  # file, You can obtain one at https://mozilla.org/MPL/2.0/.
7
7
 
8
8
  from . import exact
9
+
10
+ __all__ = ["exact"]
@@ -19,7 +19,7 @@ def prepare(blm, X, t, Psi=None):
19
19
 
20
20
  Parameters
21
21
  ==========
22
- blm: physbo.blm.core.model
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.model
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.model
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.model
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.model
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.model
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"]
@@ -8,7 +8,7 @@
8
8
  import numpy as np
9
9
 
10
10
 
11
- class cov:
11
+ class Cov:
12
12
  """
13
13
  Covariance
14
14
 
@@ -8,14 +8,15 @@
8
8
  import numpy as np
9
9
 
10
10
 
11
- class gauss:
11
+ class Gauss:
12
12
  """
13
13
  Gaussian
14
14
 
15
15
  Attributes
16
16
  ==========
17
- linear
18
- cov: blm.lik.cov
17
+ linear: physbo.blm.lik.Linear
18
+ linear kernel
19
+ cov: physbo.blm.lik.Cov
19
20
  covariance
20
21
  stats
21
22
  """
@@ -81,7 +82,7 @@ class gauss:
81
82
 
82
83
  See also
83
84
  ========
84
- blm.basis.fourier.get_basis
85
+ physbo.blm.basis.fourier.get_basis
85
86
  """
86
87
  return self.linear.basis.get_basis(X)
87
88
 
@@ -102,7 +103,7 @@ class gauss:
102
103
 
103
104
  See also
104
105
  ========
105
- blm.basis.fourier.get_mean
106
+ physbo.blm.basis.fourier.get_mean
106
107
  """
107
108
  return self.linear.get_mean(X, Psi, params, bias)
108
109
 
@@ -8,7 +8,7 @@
8
8
  import numpy as np
9
9
 
10
10
 
11
- class linear:
11
+ class Linear:
12
12
  """
13
13
 
14
14
  Attributes