unifiedbooster 0.2.2__py3-none-any.whl → 0.3.0__py3-none-any.whl
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.
- unifiedbooster/gbdt.py +20 -0
- unifiedbooster/gbdt_classification.py +10 -0
- unifiedbooster/gbdt_regression.py +10 -0
- {unifiedbooster-0.2.2.dist-info → unifiedbooster-0.3.0.dist-info}/METADATA +1 -1
- unifiedbooster-0.3.0.dist-info/RECORD +10 -0
- unifiedbooster-0.2.2.dist-info/RECORD +0 -10
- {unifiedbooster-0.2.2.dist-info → unifiedbooster-0.3.0.dist-info}/LICENSE +0 -0
- {unifiedbooster-0.2.2.dist-info → unifiedbooster-0.3.0.dist-info}/WHEEL +0 -0
- {unifiedbooster-0.2.2.dist-info → unifiedbooster-0.3.0.dist-info}/entry_points.txt +0 -0
- {unifiedbooster-0.2.2.dist-info → unifiedbooster-0.3.0.dist-info}/top_level.txt +0 -0
unifiedbooster/gbdt.py
CHANGED
|
@@ -7,6 +7,10 @@ class GBDT(BaseEstimator):
|
|
|
7
7
|
|
|
8
8
|
Attributes:
|
|
9
9
|
|
|
10
|
+
model_type: str
|
|
11
|
+
type of gradient boosting algorithm: 'xgboost', 'lightgbm',
|
|
12
|
+
'catboost', 'gradientboosting'
|
|
13
|
+
|
|
10
14
|
n_estimators: int
|
|
11
15
|
maximum number of trees that can be built
|
|
12
16
|
|
|
@@ -24,6 +28,9 @@ class GBDT(BaseEstimator):
|
|
|
24
28
|
|
|
25
29
|
seed: int
|
|
26
30
|
reproducibility seed
|
|
31
|
+
|
|
32
|
+
**kwargs: dict
|
|
33
|
+
additional parameters to be passed to the class
|
|
27
34
|
"""
|
|
28
35
|
|
|
29
36
|
def __init__(
|
|
@@ -83,6 +90,17 @@ class GBDT(BaseEstimator):
|
|
|
83
90
|
"bootstrap_type": "Bernoulli",
|
|
84
91
|
**kwargs,
|
|
85
92
|
}
|
|
93
|
+
elif self.model_type == "gradientboosting":
|
|
94
|
+
self.params = {
|
|
95
|
+
"n_estimators": self.n_estimators,
|
|
96
|
+
"learning_rate": self.learning_rate,
|
|
97
|
+
"subsample": self.rowsample,
|
|
98
|
+
"max_features": self.colsample,
|
|
99
|
+
"max_depth": self.max_depth,
|
|
100
|
+
"verbose": self.verbose,
|
|
101
|
+
"random_state": self.seed,
|
|
102
|
+
**kwargs,
|
|
103
|
+
}
|
|
86
104
|
|
|
87
105
|
def fit(self, X, y, **kwargs):
|
|
88
106
|
"""Fit custom model to training data (X, y).
|
|
@@ -109,6 +127,8 @@ class GBDT(BaseEstimator):
|
|
|
109
127
|
self.n_classes_ = len(
|
|
110
128
|
self.classes_
|
|
111
129
|
) # for compatibility with sklearn
|
|
130
|
+
if getattr(self, "model_type") == "gradientboosting":
|
|
131
|
+
self.model.max_features = int(self.model.max_features * X.shape[1])
|
|
112
132
|
return getattr(self, "model").fit(X, y, **kwargs)
|
|
113
133
|
|
|
114
134
|
def predict(self, X):
|
|
@@ -7,6 +7,7 @@ try:
|
|
|
7
7
|
except:
|
|
8
8
|
print("catboost package can't be built")
|
|
9
9
|
from lightgbm import LGBMClassifier
|
|
10
|
+
from sklearn.ensemble import GradientBoostingClassifier
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class GBDTClassifier(GBDT, ClassifierMixin):
|
|
@@ -14,6 +15,10 @@ class GBDTClassifier(GBDT, ClassifierMixin):
|
|
|
14
15
|
|
|
15
16
|
Attributes:
|
|
16
17
|
|
|
18
|
+
model_type: str
|
|
19
|
+
type of gradient boosting algorithm: 'xgboost', 'lightgbm',
|
|
20
|
+
'catboost', 'gradientboosting'
|
|
21
|
+
|
|
17
22
|
n_estimators: int
|
|
18
23
|
maximum number of trees that can be built
|
|
19
24
|
|
|
@@ -32,6 +37,9 @@ class GBDTClassifier(GBDT, ClassifierMixin):
|
|
|
32
37
|
seed: int
|
|
33
38
|
reproducibility seed
|
|
34
39
|
|
|
40
|
+
**kwargs: dict
|
|
41
|
+
additional parameters to be passed to the class
|
|
42
|
+
|
|
35
43
|
Examples:
|
|
36
44
|
|
|
37
45
|
```python
|
|
@@ -105,6 +113,8 @@ class GBDTClassifier(GBDT, ClassifierMixin):
|
|
|
105
113
|
self.model = CatBoostClassifier(**self.params)
|
|
106
114
|
elif model_type == "lightgbm":
|
|
107
115
|
self.model = LGBMClassifier(**self.params)
|
|
116
|
+
elif model_type == "gradientboosting":
|
|
117
|
+
self.model = GradientBoostingClassifier(**self.params)
|
|
108
118
|
else:
|
|
109
119
|
raise ValueError(f"Unknown model_type: {model_type}")
|
|
110
120
|
|
|
@@ -7,6 +7,7 @@ try:
|
|
|
7
7
|
except:
|
|
8
8
|
print("catboost package can't be built")
|
|
9
9
|
from lightgbm import LGBMRegressor
|
|
10
|
+
from sklearn.ensemble import GradientBoostingRegressor
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class GBDTRegressor(GBDT, RegressorMixin):
|
|
@@ -14,6 +15,10 @@ class GBDTRegressor(GBDT, RegressorMixin):
|
|
|
14
15
|
|
|
15
16
|
Attributes:
|
|
16
17
|
|
|
18
|
+
model_type: str
|
|
19
|
+
type of gradient boosting algorithm: 'xgboost', 'lightgbm',
|
|
20
|
+
'catboost', 'gradientboosting'
|
|
21
|
+
|
|
17
22
|
n_estimators: int
|
|
18
23
|
maximum number of trees that can be built
|
|
19
24
|
|
|
@@ -32,6 +37,9 @@ class GBDTRegressor(GBDT, RegressorMixin):
|
|
|
32
37
|
seed: int
|
|
33
38
|
reproducibility seed
|
|
34
39
|
|
|
40
|
+
**kwargs: dict
|
|
41
|
+
additional parameters to be passed to the class
|
|
42
|
+
|
|
35
43
|
Examples:
|
|
36
44
|
|
|
37
45
|
```python
|
|
@@ -105,5 +113,7 @@ class GBDTRegressor(GBDT, RegressorMixin):
|
|
|
105
113
|
self.model = CatBoostRegressor(**self.params)
|
|
106
114
|
elif model_type == "lightgbm":
|
|
107
115
|
self.model = LGBMRegressor(**self.params)
|
|
116
|
+
elif model_type == "gradientboosting":
|
|
117
|
+
self.model = GradientBoostingRegressor(**self.params)
|
|
108
118
|
else:
|
|
109
119
|
raise ValueError(f"Unknown model_type: {model_type}")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
unifiedbooster/__init__.py,sha256=3d8wQVXaeVIxqtk_STM6nvIGZiGTxKn9aAWjuwiDYuo,169
|
|
2
|
+
unifiedbooster/gbdt.py,sha256=QCcWfXYfrOXdiSeygPEvVMjg9fVNjRaOnW9KsHK6bvo,4770
|
|
3
|
+
unifiedbooster/gbdt_classification.py,sha256=UqZEOjDp_2hSm4jCxVoqz8vNQ-8JRW4Xn5CjFqPqRF4,4028
|
|
4
|
+
unifiedbooster/gbdt_regression.py,sha256=ZNX5RJF-Wk2KJpOUD-lgNnqruDHZpzSTxdKeayv6iw0,3519
|
|
5
|
+
unifiedbooster-0.3.0.dist-info/LICENSE,sha256=3rWw63btcdqbC0XMnpzCQhxDP8Vx7yKkKS7EDgJiY_4,1061
|
|
6
|
+
unifiedbooster-0.3.0.dist-info/METADATA,sha256=E0drgIWtoGZNF1lkxrj_zlbMxq8QmOPIW4iDY_GPKm0,930
|
|
7
|
+
unifiedbooster-0.3.0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
8
|
+
unifiedbooster-0.3.0.dist-info/entry_points.txt,sha256=OVNTsCzMYnaJ11WIByB7G8Lym_dj-ERKZyQxWFUcW30,59
|
|
9
|
+
unifiedbooster-0.3.0.dist-info/top_level.txt,sha256=gOMxxpRtx8_nJXTWsXJDFkNeCsjSJQPs6aUXKK5_nI4,15
|
|
10
|
+
unifiedbooster-0.3.0.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
unifiedbooster/__init__.py,sha256=3d8wQVXaeVIxqtk_STM6nvIGZiGTxKn9aAWjuwiDYuo,169
|
|
2
|
-
unifiedbooster/gbdt.py,sha256=Y5gweEEfI5DGMsuE_Z-gJlbteawolzk2uFyoGXGwgKA,3958
|
|
3
|
-
unifiedbooster/gbdt_classification.py,sha256=sIdoeqOBYGmzeHV3Rk3DrBav-ebG2v-o9cv0X0LREXg,3634
|
|
4
|
-
unifiedbooster/gbdt_regression.py,sha256=VE129JJ_DNoi3knLI5I_5QNRkW0M3KAKRmE-sfXrCLk,3127
|
|
5
|
-
unifiedbooster-0.2.2.dist-info/LICENSE,sha256=3rWw63btcdqbC0XMnpzCQhxDP8Vx7yKkKS7EDgJiY_4,1061
|
|
6
|
-
unifiedbooster-0.2.2.dist-info/METADATA,sha256=Y-BX935CwMCs4uD-mNoniEeU0F0yuySg97dhZF5NSEQ,930
|
|
7
|
-
unifiedbooster-0.2.2.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
8
|
-
unifiedbooster-0.2.2.dist-info/entry_points.txt,sha256=OVNTsCzMYnaJ11WIByB7G8Lym_dj-ERKZyQxWFUcW30,59
|
|
9
|
-
unifiedbooster-0.2.2.dist-info/top_level.txt,sha256=gOMxxpRtx8_nJXTWsXJDFkNeCsjSJQPs6aUXKK5_nI4,15
|
|
10
|
-
unifiedbooster-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|