MRBS
Model-based Response surface optimization with Bootstrap Sampling
部分的なデータをXGBoostで補完し、勾配上昇法とクラスタリングで最適点を探索するPythonライブラリです。
特徴
- XGBoost補完: 部分的なサンプリングデータから曲面を補完
- 勾配上昇法: 近傍線形回帰による局所勾配推定で最適点を探索
- クラスタリング: 複数の探索パスの終点をK-Meansでクラスタリングし、最適点候補を算出
インストール
pip install mrbs
開発版のインストール:
git clone https://github.com/yutotakagi/MRBS.git
cd MRBS
pip install -e ".[dev]"
クイックスタート
import numpy as np
import pandas as pd
from mrbs import SurfaceInterpolator, GradientAscentOptimizer, OptimalPointFinder
from mrbs.visualization import plot_optimization_result
# 1. データ読み込み・補完
df = pd.read_csv("data/sphere_sampled_benchmark_xy_F.csv")
X = df[["x", "y"]].values
y = df["F"].values
interpolator = SurfaceInterpolator(n_estimators=300)
interpolator.fit(X, y)
xx, yy, F_grid = interpolator.generate_grid(n_grid=100)
# 2. 勾配上昇パス計算
optimizer = GradientAscentOptimizer(interpolator, n_steps=10, radius=10)
start_points = np.random.uniform(-100, 100, size=(20, 2))
paths = optimizer.compute_paths(start_points)
# 3. クラスタリング・最適点算出
finder = OptimalPointFinder(k_min=1, k_max=5)
result = finder.find_optimal_points(paths)
# 4. 結果表示
print("最適点候補:")
for i, centroid in enumerate(result.centroids):
print(f" Point {i+1}: x={centroid[0]:.4f}, y={centroid[1]:.4f}")
# 5. 可視化
plot_optimization_result(xx, yy, F_grid, result)
モジュール構成
| モジュール | 説明 |
|---|---|
mrbs.interpolator |
SurfaceInterpolator - XGBoostによる曲面補完 |
mrbs.gradient_ascent |
GradientAscentOptimizer - 勾配上昇法による最適点探索 |
mrbs.clustering |
OptimalPointFinder - クラスタリングによる最適点算出 |
mrbs.visualization |
可視化関数 |
依存パッケージ
- Python >= 3.9
- numpy >= 1.20
- pandas >= 1.3
- xgboost >= 1.5
- scikit-learn >= 1.0
- matplotlib >= 3.4
コントリビューション
コントリビューションを歓迎します!詳細は CONTRIBUTING.md をご覧ください。
このプロジェクトは Contributor Covenant に基づく行動規範を採用しています。
ライセンス
関連リンク
Release files for mrbs 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mrbs-0.1.0.tar.gz | 3.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mrbs-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.1 MB
Release files / mrbs-0.1.0.tar.gz
| Download URL | mrbs-0.1.0.tar.gz |
|---|---|
| Size | 3.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf94b69024bee065e86da916d1d809fe8727a1040891c537ff28a352a1a0056c
|
|
BLAKE2b-256 checksum How to use checksums |
331025b2804eb3fc307073bf530578785e2f7f1b594ee7f163d6318f96348a75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2025.
Transparency logRelease files / mrbs-0.1.0-py3-none-any.whl
| Download URL | mrbs-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3f0b8a317995c22fc2668b4fef6a28eb7c6dea27f94bb8eee5106b6f0eff9a3
|
|
BLAKE2b-256 checksum How to use checksums |
86e7dffbbe56a5432ea4819266217c89194c5297f034d565b153632a2e9cd65b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2025.
Transparency log