shimaenagaboost 0.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.
- shimaenagaboost-0.1.0/LICENSE +21 -0
- shimaenagaboost-0.1.0/MANIFEST.in +3 -0
- shimaenagaboost-0.1.0/PKG-INFO +165 -0
- shimaenagaboost-0.1.0/README.md +138 -0
- shimaenagaboost-0.1.0/THIRD_PARTY_NOTICES.md +123 -0
- shimaenagaboost-0.1.0/pyproject.toml +3 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost/__init__.py +35 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost/_ctypes_backend.py +292 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost/sklearn_api.py +385 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost.egg-info/PKG-INFO +165 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost.egg-info/SOURCES.txt +15 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost.egg-info/dependency_links.txt +1 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost.egg-info/not-zip-safe +1 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost.egg-info/requires.txt +9 -0
- shimaenagaboost-0.1.0/python/shimaenagaboost.egg-info/top_level.txt +2 -0
- shimaenagaboost-0.1.0/setup.cfg +4 -0
- shimaenagaboost-0.1.0/setup.py +158 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 S.I
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: shimaenagaboost
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ShimaenagaBoost: Attentive Histogram GBDT with sample-level token attention
|
|
5
|
+
Author: ShimaenagaBoost Authors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
11
|
+
Requires-Dist: numpy>=1.20
|
|
12
|
+
Provides-Extra: sklearn
|
|
13
|
+
Requires-Dist: scikit-learn>=1.0; extra == "sklearn"
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest; extra == "dev"
|
|
16
|
+
Requires-Dist: scikit-learn; extra == "dev"
|
|
17
|
+
Requires-Dist: pandas; extra == "dev"
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: provides-extra
|
|
24
|
+
Dynamic: requires-dist
|
|
25
|
+
Dynamic: requires-python
|
|
26
|
+
Dynamic: summary
|
|
27
|
+
|
|
28
|
+
# ShimaenagaBoost
|
|
29
|
+
|
|
30
|
+
**Attentive Histogram GBDT — サンプル単位のトークン注意機構を備えた勾配ブースティング**
|
|
31
|
+
|
|
32
|
+
ShimaenagaBoost は、LightGBM スタイルのヒストグラムベース GBDT に、サンプルごとの
|
|
33
|
+
トークン注意機構(attention)を組み込んだ機械学習ライブラリです。特徴量を
|
|
34
|
+
「トークン」と呼ぶサブセットに分割して各トークンごとに木を成長させ、
|
|
35
|
+
サンプルごとに学習された注意重みでそれらを混合します。これにより、
|
|
36
|
+
純粋な GBDT では捉えにくい特徴グループ間の相互作用を表現できます。
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## インストール
|
|
41
|
+
|
|
42
|
+
### 必要環境
|
|
43
|
+
|
|
44
|
+
- C++17 コンパイラ(GCC ≥ 9, Clang ≥ 11, MSVC 2019 以降)
|
|
45
|
+
- CMake ≥ 3.20
|
|
46
|
+
- Python ≥ 3.8 + NumPy
|
|
47
|
+
- scikit-learn(sklearn 互換 API と examples の実行に使用)
|
|
48
|
+
- (オプション)pybind11 — ネイティブ拡張としてビルドする場合のみ
|
|
49
|
+
|
|
50
|
+
### Python パッケージの利用
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install shimaenagaboost
|
|
54
|
+
```
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## クイックスタート
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from shimaenagaboost import ShimaenagaBoostRegressor, ShimaenagaBoostClassifier, ShimaenagaBoostRanker
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 回帰
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from sklearn.datasets import fetch_california_housing
|
|
67
|
+
from sklearn.model_selection import train_test_split
|
|
68
|
+
from shimaenagaboost import ShimaenagaBoostRegressor
|
|
69
|
+
|
|
70
|
+
data = fetch_california_housing()
|
|
71
|
+
X_train, X_test, y_train, y_test = train_test_split(
|
|
72
|
+
data.data, data.target, test_size=0.2, random_state=42
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
model = ShimaenagaBoostRegressor(
|
|
76
|
+
tier=1, # Tier-1: Attentive Readout
|
|
77
|
+
num_tokens=4, # 特徴を 4 グループに分割
|
|
78
|
+
num_heads=2, # 注意ヘッド数
|
|
79
|
+
d_attn=4, # 注意埋め込み次元
|
|
80
|
+
num_iterations=300,
|
|
81
|
+
learning_rate=0.05,
|
|
82
|
+
)
|
|
83
|
+
model.fit(X_train, y_train)
|
|
84
|
+
y_pred = model.predict(X_test)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 二値分類
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from sklearn.datasets import load_breast_cancer
|
|
91
|
+
from sklearn.model_selection import train_test_split
|
|
92
|
+
from shimaenagaboost import ShimaenagaBoostClassifier
|
|
93
|
+
|
|
94
|
+
data = load_breast_cancer()
|
|
95
|
+
X_train, X_test, y_train, y_test = train_test_split(
|
|
96
|
+
data.data, data.target, test_size=0.2, random_state=42
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
clf = ShimaenagaBoostClassifier(
|
|
100
|
+
num_class=1, # 1 = 二値(既定)
|
|
101
|
+
tier=1,
|
|
102
|
+
num_tokens=4,
|
|
103
|
+
num_iterations=200,
|
|
104
|
+
)
|
|
105
|
+
clf.fit(X_train, y_train)
|
|
106
|
+
proba = clf.predict_proba(X_test) # shape (n, 2)
|
|
107
|
+
labels = clf.predict(X_test)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 多クラス分類
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from sklearn.datasets import load_iris
|
|
114
|
+
from sklearn.model_selection import train_test_split
|
|
115
|
+
from shimaenagaboost import ShimaenagaBoostClassifier
|
|
116
|
+
|
|
117
|
+
data = load_iris()
|
|
118
|
+
X_train, X_test, y_train, y_test = train_test_split(
|
|
119
|
+
data.data, data.target, test_size=0.2, random_state=42
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
clf = ShimaenagaBoostClassifier(
|
|
123
|
+
num_class=3, # K クラス softmax
|
|
124
|
+
tier=1,
|
|
125
|
+
num_tokens=2,
|
|
126
|
+
num_iterations=100,
|
|
127
|
+
)
|
|
128
|
+
clf.fit(X_train, y_train)
|
|
129
|
+
proba = clf.predict_proba(X_test) # shape (n, 3)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### ランキング(LambdaMART)
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from shimaenagaboost import ShimaenagaBoostRanker
|
|
136
|
+
|
|
137
|
+
# group: クエリごとのサンプル数(合計 = len(X_train))
|
|
138
|
+
model = ShimaenagaBoostRanker(tier=1, num_iterations=200)
|
|
139
|
+
model.fit(X_train, y_train, group=group_train)
|
|
140
|
+
scores = model.predict(X_test)
|
|
141
|
+
|
|
142
|
+
# 検証セット付き(eval_group 必須 — valid の NDCG をクエリ単位で計算するため)
|
|
143
|
+
model.fit(X_train, y_train, group=group_train,
|
|
144
|
+
eval_set=[(X_valid, y_valid)], eval_group=[group_valid],
|
|
145
|
+
early_stopping_rounds=50)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### モデルの保存・ロード
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
model.save_model("model.sbb") # バイナリ形式 (.sbb, 形式 v3)
|
|
152
|
+
|
|
153
|
+
# ロード: 同じ設定でインスタンスを作り、一度 fit で booster を初期化してから load
|
|
154
|
+
loaded = ShimaenagaBoostRegressor(tier=1, num_tokens=4)
|
|
155
|
+
loaded.fit(X_tiny, y_tiny) # booster の初期化(小さなデータで可)
|
|
156
|
+
loaded.load_model("model.sbb")
|
|
157
|
+
pred = loaded.predict(X_test)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## ライセンス
|
|
162
|
+
|
|
163
|
+
MIT License. <br/>
|
|
164
|
+
詳細は [LICENSE](LICENSE) を参照してください。<br/>
|
|
165
|
+
サードパーティの著作権表示は [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) を参照してください。
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# ShimaenagaBoost
|
|
2
|
+
|
|
3
|
+
**Attentive Histogram GBDT — サンプル単位のトークン注意機構を備えた勾配ブースティング**
|
|
4
|
+
|
|
5
|
+
ShimaenagaBoost は、LightGBM スタイルのヒストグラムベース GBDT に、サンプルごとの
|
|
6
|
+
トークン注意機構(attention)を組み込んだ機械学習ライブラリです。特徴量を
|
|
7
|
+
「トークン」と呼ぶサブセットに分割して各トークンごとに木を成長させ、
|
|
8
|
+
サンプルごとに学習された注意重みでそれらを混合します。これにより、
|
|
9
|
+
純粋な GBDT では捉えにくい特徴グループ間の相互作用を表現できます。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## インストール
|
|
14
|
+
|
|
15
|
+
### 必要環境
|
|
16
|
+
|
|
17
|
+
- C++17 コンパイラ(GCC ≥ 9, Clang ≥ 11, MSVC 2019 以降)
|
|
18
|
+
- CMake ≥ 3.20
|
|
19
|
+
- Python ≥ 3.8 + NumPy
|
|
20
|
+
- scikit-learn(sklearn 互換 API と examples の実行に使用)
|
|
21
|
+
- (オプション)pybind11 — ネイティブ拡張としてビルドする場合のみ
|
|
22
|
+
|
|
23
|
+
### Python パッケージの利用
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install shimaenagaboost
|
|
27
|
+
```
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## クイックスタート
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from shimaenagaboost import ShimaenagaBoostRegressor, ShimaenagaBoostClassifier, ShimaenagaBoostRanker
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 回帰
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from sklearn.datasets import fetch_california_housing
|
|
40
|
+
from sklearn.model_selection import train_test_split
|
|
41
|
+
from shimaenagaboost import ShimaenagaBoostRegressor
|
|
42
|
+
|
|
43
|
+
data = fetch_california_housing()
|
|
44
|
+
X_train, X_test, y_train, y_test = train_test_split(
|
|
45
|
+
data.data, data.target, test_size=0.2, random_state=42
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
model = ShimaenagaBoostRegressor(
|
|
49
|
+
tier=1, # Tier-1: Attentive Readout
|
|
50
|
+
num_tokens=4, # 特徴を 4 グループに分割
|
|
51
|
+
num_heads=2, # 注意ヘッド数
|
|
52
|
+
d_attn=4, # 注意埋め込み次元
|
|
53
|
+
num_iterations=300,
|
|
54
|
+
learning_rate=0.05,
|
|
55
|
+
)
|
|
56
|
+
model.fit(X_train, y_train)
|
|
57
|
+
y_pred = model.predict(X_test)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 二値分類
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from sklearn.datasets import load_breast_cancer
|
|
64
|
+
from sklearn.model_selection import train_test_split
|
|
65
|
+
from shimaenagaboost import ShimaenagaBoostClassifier
|
|
66
|
+
|
|
67
|
+
data = load_breast_cancer()
|
|
68
|
+
X_train, X_test, y_train, y_test = train_test_split(
|
|
69
|
+
data.data, data.target, test_size=0.2, random_state=42
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
clf = ShimaenagaBoostClassifier(
|
|
73
|
+
num_class=1, # 1 = 二値(既定)
|
|
74
|
+
tier=1,
|
|
75
|
+
num_tokens=4,
|
|
76
|
+
num_iterations=200,
|
|
77
|
+
)
|
|
78
|
+
clf.fit(X_train, y_train)
|
|
79
|
+
proba = clf.predict_proba(X_test) # shape (n, 2)
|
|
80
|
+
labels = clf.predict(X_test)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 多クラス分類
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from sklearn.datasets import load_iris
|
|
87
|
+
from sklearn.model_selection import train_test_split
|
|
88
|
+
from shimaenagaboost import ShimaenagaBoostClassifier
|
|
89
|
+
|
|
90
|
+
data = load_iris()
|
|
91
|
+
X_train, X_test, y_train, y_test = train_test_split(
|
|
92
|
+
data.data, data.target, test_size=0.2, random_state=42
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
clf = ShimaenagaBoostClassifier(
|
|
96
|
+
num_class=3, # K クラス softmax
|
|
97
|
+
tier=1,
|
|
98
|
+
num_tokens=2,
|
|
99
|
+
num_iterations=100,
|
|
100
|
+
)
|
|
101
|
+
clf.fit(X_train, y_train)
|
|
102
|
+
proba = clf.predict_proba(X_test) # shape (n, 3)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### ランキング(LambdaMART)
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from shimaenagaboost import ShimaenagaBoostRanker
|
|
109
|
+
|
|
110
|
+
# group: クエリごとのサンプル数(合計 = len(X_train))
|
|
111
|
+
model = ShimaenagaBoostRanker(tier=1, num_iterations=200)
|
|
112
|
+
model.fit(X_train, y_train, group=group_train)
|
|
113
|
+
scores = model.predict(X_test)
|
|
114
|
+
|
|
115
|
+
# 検証セット付き(eval_group 必須 — valid の NDCG をクエリ単位で計算するため)
|
|
116
|
+
model.fit(X_train, y_train, group=group_train,
|
|
117
|
+
eval_set=[(X_valid, y_valid)], eval_group=[group_valid],
|
|
118
|
+
early_stopping_rounds=50)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### モデルの保存・ロード
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
model.save_model("model.sbb") # バイナリ形式 (.sbb, 形式 v3)
|
|
125
|
+
|
|
126
|
+
# ロード: 同じ設定でインスタンスを作り、一度 fit で booster を初期化してから load
|
|
127
|
+
loaded = ShimaenagaBoostRegressor(tier=1, num_tokens=4)
|
|
128
|
+
loaded.fit(X_tiny, y_tiny) # booster の初期化(小さなデータで可)
|
|
129
|
+
loaded.load_model("model.sbb")
|
|
130
|
+
pred = loaded.predict(X_test)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## ライセンス
|
|
135
|
+
|
|
136
|
+
MIT License. <br/>
|
|
137
|
+
詳細は [LICENSE](LICENSE) を参照してください。<br/>
|
|
138
|
+
サードパーティの著作権表示は [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) を参照してください。
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# サードパーティ著作権表示 (Third-Party Notices)
|
|
2
|
+
|
|
3
|
+
ShimaenagaBoost のビルド・配布物には、以下のサードパーティソフトウェアの一部が
|
|
4
|
+
含まれます。
|
|
5
|
+
|
|
6
|
+
## pybind11
|
|
7
|
+
|
|
8
|
+
pybind11 はヘッダオンリーライブラリであり、`_shimaenagaboost` ネイティブ拡張の
|
|
9
|
+
ビルド時にヘッダがコンパイル済みバイナリへ組み込まれます。
|
|
10
|
+
|
|
11
|
+
- **Project**: https://github.com/pybind/pybind11
|
|
12
|
+
- **License**: BSD 3-Clause
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.
|
|
16
|
+
|
|
17
|
+
Redistribution and use in source and binary forms, with or without
|
|
18
|
+
modification, are permitted provided that the following conditions are met:
|
|
19
|
+
|
|
20
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
21
|
+
this list of conditions and the following disclaimer.
|
|
22
|
+
|
|
23
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
24
|
+
this list of conditions and the following disclaimer in the documentation
|
|
25
|
+
and/or other materials provided with the distribution.
|
|
26
|
+
|
|
27
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
28
|
+
contributors may be used to endorse or promote products derived from
|
|
29
|
+
this software without specific prior written permission.
|
|
30
|
+
|
|
31
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
32
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
33
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
34
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
35
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
36
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
37
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
38
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
39
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
40
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
41
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## NumPy
|
|
45
|
+
|
|
46
|
+
NumPy は ShimaenagaBoost の実行時依存であり、配列データの受け渡しに使用されます。
|
|
47
|
+
|
|
48
|
+
- **Project**: https://github.com/numpy/numpy
|
|
49
|
+
- **License**: BSD 3-Clause
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Copyright (c) 2005-2024, NumPy Developers.
|
|
53
|
+
All rights reserved.
|
|
54
|
+
|
|
55
|
+
Redistribution and use in source and binary forms, with or without
|
|
56
|
+
modification, are permitted provided that the following conditions are
|
|
57
|
+
met:
|
|
58
|
+
|
|
59
|
+
* Redistributions of source code must retain the above copyright
|
|
60
|
+
notice, this list of conditions and the following disclaimer.
|
|
61
|
+
|
|
62
|
+
* Redistributions in binary form must reproduce the above
|
|
63
|
+
copyright notice, this list of conditions and the following
|
|
64
|
+
disclaimer in the documentation and/or other materials provided
|
|
65
|
+
with the distribution.
|
|
66
|
+
|
|
67
|
+
* Neither the name of the NumPy Developers nor the names of any
|
|
68
|
+
contributors may be used to endorse or promote products derived
|
|
69
|
+
from this software without specific prior written permission.
|
|
70
|
+
|
|
71
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
72
|
+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
73
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
74
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
75
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
76
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
77
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
78
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
79
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
80
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
81
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## scikit-learn
|
|
85
|
+
|
|
86
|
+
scikit-learn は ShimaenagaBoost の sklearn 互換 API (`sklearn_api.py`) の実行時
|
|
87
|
+
依存です。
|
|
88
|
+
|
|
89
|
+
- **Project**: https://github.com/scikit-learn/scikit-learn
|
|
90
|
+
- **License**: BSD 3-Clause
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
BSD 3-Clause License
|
|
94
|
+
|
|
95
|
+
Copyright (c) 2007-2024 The scikit-learn developers.
|
|
96
|
+
All rights reserved.
|
|
97
|
+
|
|
98
|
+
Redistribution and use in source and binary forms, with or without
|
|
99
|
+
modification, are permitted provided that the following conditions are met:
|
|
100
|
+
|
|
101
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
102
|
+
this list of conditions and the following disclaimer.
|
|
103
|
+
|
|
104
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
105
|
+
notice, this list of conditions and the following disclaimer in the
|
|
106
|
+
documentation and/or other materials provided with the distribution.
|
|
107
|
+
|
|
108
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
109
|
+
contributors may be used to endorse or promote products derived from
|
|
110
|
+
this software without specific prior written permission.
|
|
111
|
+
|
|
112
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
113
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
114
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
115
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
116
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
117
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
118
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
119
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
120
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
121
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
122
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
123
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ShimaenagaBoost: Attentive Histogram GBDT with sample-level token attention.
|
|
3
|
+
sklearn-compatible API.
|
|
4
|
+
"""
|
|
5
|
+
from .sklearn_api import (
|
|
6
|
+
ShimaenagaBoostRegressor,
|
|
7
|
+
ShimaenagaBoostClassifier,
|
|
8
|
+
ShimaenagaBoostRanker,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
# Try pybind11 extension first, fall back to ctypes backend.
|
|
12
|
+
# _shimaenagaboost is a top-level sibling module (built by CMake into python/,
|
|
13
|
+
# alongside this package), not a submodule of shimaenagaboost -- so it must be
|
|
14
|
+
# imported absolutely, not via a relative "..".
|
|
15
|
+
try:
|
|
16
|
+
from _shimaenagaboost import Dataset, Booster, Config
|
|
17
|
+
_backend = "pybind11"
|
|
18
|
+
except ImportError:
|
|
19
|
+
try:
|
|
20
|
+
from ._ctypes_backend import Dataset, Booster
|
|
21
|
+
Config = None
|
|
22
|
+
_backend = "ctypes"
|
|
23
|
+
except Exception:
|
|
24
|
+
Dataset = Booster = Config = None
|
|
25
|
+
_backend = "none"
|
|
26
|
+
|
|
27
|
+
__version__ = "0.1.0"
|
|
28
|
+
__all__ = [
|
|
29
|
+
"ShimaenagaBoostRegressor",
|
|
30
|
+
"ShimaenagaBoostClassifier",
|
|
31
|
+
"ShimaenagaBoostRanker",
|
|
32
|
+
"Dataset",
|
|
33
|
+
"Booster",
|
|
34
|
+
"Config",
|
|
35
|
+
]
|