linearboost 0.1.6__tar.gz → 0.1.9__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.
@@ -1,18 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: linearboost
3
- Version: 0.1.6
3
+ Version: 0.1.9
4
4
  Summary: LinearBoost Classifier is a rapid and accurate classification algorithm that builds upon a very fast, linear classifier.
5
5
  Project-URL: Homepage, https://github.com/LinearBoost/linearboost-classifier
6
6
  Project-URL: Documentation, https://linearboost.readthedocs.io
7
7
  Project-URL: Repository, https://github.com/LinearBoost/linearboost-classifier
8
8
  Project-URL: Issues, https://github.com/LinearBoost/linearboost-classifier/issues
9
9
  Author-email: Hamidreza Keshavarz <hamid9@outlook.com>, Reza Rawassizadeh <rezar@bu.edu>
10
- License-File: LICENSE
10
+ License-File: LICENSE.txt
11
11
  Keywords: adaboost,boost,boosting,classification,classifier,linear
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Intended Audience :: Science/Research
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
@@ -21,14 +19,14 @@ Classifier: Topic :: Scientific/Engineering
21
19
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
20
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
23
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
- Requires-Python: <3.14,>=3.8
22
+ Requires-Python: <3.14,>=3.10
25
23
  Requires-Dist: scikit-learn>=1.2.2
26
24
  Requires-Dist: typing-extensions>=4.1.0; python_full_version < '3.11'
27
25
  Description-Content-Type: text/markdown
28
26
 
29
27
  # LinearBoost Classifier
30
28
 
31
- ![Lastest Release](https://img.shields.io/badge/release-v0.1.5-green)
29
+ ![Latest Release](https://img.shields.io/badge/release-v0.1.7-green)
32
30
  [![PyPI Version](https://img.shields.io/pypi/v/linearboost)](https://pypi.org/project/linearboost/)
33
31
  ![Python Versions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)
34
32
  [![PyPI Downloads](https://static.pepy.tech/badge/linearboost)](https://pepy.tech/projects/linearboost)
@@ -60,9 +58,45 @@ Key Features:
60
58
 
61
59
  ---
62
60
 
61
+ ## 🚀 New in Version 0.1.7
62
+
63
+ ### Gradient Boosting Mode
64
+
65
+ LinearBoost now supports **gradient boosting** in addition to AdaBoost via the `boosting_type` parameter:
66
+
67
+ - **`boosting_type='adaboost'`** (default): Classic AdaBoost (SAMME or SAMME.R) that reweights samples by classification error.
68
+ - **`boosting_type='gradient'`**: Fits each base estimator to pseudo-residuals (negative gradient of log-loss). Often better for highly non-linear or XOR-like patterns and smoother decision boundaries.
69
+
70
+ ```python
71
+ # Gradient boosting for complex non-linear patterns
72
+ clf = LinearBoostClassifier(
73
+ boosting_type='gradient',
74
+ n_estimators=200,
75
+ kernel='rbf'
76
+ )
77
+ ```
78
+
79
+ ### Class Weighting & Custom Loss
80
+
81
+ - **`class_weight`**: Use `'balanced'` or a dict of class weights for imbalanced data. Weights are applied in the boosting loop.
82
+ - **`loss_function`**: Optional callable `(y_true, y_pred, sample_weight) -> float` for custom optimization objectives.
83
+
84
+ ```python
85
+ clf = LinearBoostClassifier(
86
+ class_weight='balanced', # Adjust for imbalanced classes
87
+ n_estimators=200
88
+ )
89
+ ```
90
+
91
+ ### Default Algorithm
92
+
93
+ The default **`algorithm`** is now **`'SAMME.R'`** for faster convergence and typically lower test error with fewer iterations (when using `boosting_type='adaboost'`).
94
+
95
+ ---
96
+
63
97
  ## 🚀 New in Version 0.1.5
64
98
 
65
- The latest release introduces major architectural improvements designed for **scalability**, **robustness on imbalanced data**, and **training speed**.
99
+ Version 0.1.5 introduced major architectural improvements designed for **scalability**, **robustness on imbalanced data**, and **training speed**.
66
100
 
67
101
  ### ⚡ Scalable Kernel Approximation
68
102
 
@@ -185,8 +219,7 @@ Version 0.1.2 of **LinearBoost Classifier** is released. Here are the changes:
185
219
  - Improved Scikit-learn compatibility.
186
220
 
187
221
 
188
- Get Started and Documentation
189
- -----------------------------
222
+ ## Get Started and Documentation
190
223
 
191
224
  The documentation is available at https://linearboost.readthedocs.io/.
192
225
 
@@ -200,13 +233,20 @@ The following parameters yielded optimal results during testing. All results are
200
233
  - **`learning_rate`**:
201
234
  Values between 0.01 and 1 typically perform well. Adjust based on the dataset's complexity and noise.
202
235
 
203
- - **`algorithm`**:
204
- Use either `SAMME` or `SAMME.R`. The choice depends on the specific problem:
236
+ - **`algorithm`** (when `boosting_type='adaboost'`):
237
+ Use either `SAMME` or `SAMME.R` (default). SAMME.R typically converges faster with lower test error.
205
238
  - `SAMME`: May be better for datasets with clearer separations between classes.
206
- - `SAMME.R`: Can handle more nuanced class probabilities.
239
+ - `SAMME.R`: Uses class probabilities; often better for nuanced boundaries.
207
240
 
208
241
  **Note:** As of scikit-learn v1.6, the `algorithm` parameter is deprecated and will be removed in v1.8. LinearBoostClassifier will only implement the 'SAMME' algorithm in newer versions.
209
242
 
243
+ - **`boosting_type`** *(new in v0.1.7)*:
244
+ - `'adaboost'`: Classic AdaBoost (default).
245
+ - `'gradient'`: Gradient boosting on pseudo-residuals; try for highly non-linear or XOR-like data.
246
+
247
+ - **`class_weight`** *(new in v0.1.7)*:
248
+ Use `'balanced'` for imbalanced datasets so class weights are adjusted automatically.
249
+
210
250
  - **`scaler`**:
211
251
  The following scaling methods are recommended based on dataset characteristics:
212
252
  - `minmax`: Best for datasets where features are on different scales but bounded.
@@ -238,8 +278,7 @@ The following parameters yielded optimal results during testing. All results are
238
278
 
239
279
  These parameters should serve as a solid starting point for most datasets. For fine-tuning, consider using hyperparameter optimization tools like [Optuna](https://optuna.org/).
240
280
 
241
- Results
242
- -------
281
+ ## Results
243
282
 
244
283
  All of the results are reported based on 10-fold Cross-Validation. The weighted F1 score is reported, i.e. f1_score(y_valid, y_pred, average = 'weighted').
245
284
 
@@ -365,6 +404,8 @@ params = {
365
404
  'algorithm': trial.suggest_categorical('algorithm', ['SAMME', 'SAMME.R']),
366
405
  'scaler': trial.suggest_categorical('scaler', ['minmax', 'robust', 'quantile-uniform', 'quantile-normal']),
367
406
  'kernel': trial.suggest_categorical('kernel', ['linear', 'rbf', 'poly']),
407
+ 'boosting_type': trial.suggest_categorical('boosting_type', ['adaboost', 'gradient']),
408
+ 'class_weight': trial.suggest_categorical('class_weight', [None, 'balanced']),
368
409
  'subsample': trial.suggest_float('subsample', 0.6, 1.0),
369
410
  'shrinkage': trial.suggest_float('shrinkage', 0.7, 1.0),
370
411
  'early_stopping': True,
@@ -381,19 +422,18 @@ LinearBoost's combination of **runtime efficiency** and **high accuracy** makes
381
422
  *Discusses how LinearBoost outperforms traditional boosting frameworks in terms of speed while maintaining accuracy.*
382
423
 
383
424
 
384
- Future Developments
385
- -----------------------------
425
+ ## Future Developments
426
+
386
427
  These are not yet supported in this current version, but are in the future plans:
387
428
  - Supporting categorical variables natively
388
429
  - Adding regression support (`LinearBoostRegressor`)
389
430
  - Multi-output classification
390
431
 
391
- Reference Paper
392
- -----------------------------
432
+ ## Reference Paper
433
+
393
434
  The paper is written by Hamidreza Keshavarz (Independent Researcher based in Berlin, Germany) and Reza Rawassizadeh (Department of Computer Science, Metropolitan college, Boston University, United States). It will be available soon.
394
435
 
395
- License
396
- -------
436
+ ## License
397
437
 
398
438
  This project is licensed under the terms of the MIT license. See [LICENSE](https://github.com/LinearBoost/linearboost-classifier/blob/main/LICENSE) for additional details.
399
439
 
@@ -1,6 +1,6 @@
1
1
  # LinearBoost Classifier
2
2
 
3
- ![Lastest Release](https://img.shields.io/badge/release-v0.1.5-green)
3
+ ![Latest Release](https://img.shields.io/badge/release-v0.1.7-green)
4
4
  [![PyPI Version](https://img.shields.io/pypi/v/linearboost)](https://pypi.org/project/linearboost/)
5
5
  ![Python Versions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)
6
6
  [![PyPI Downloads](https://static.pepy.tech/badge/linearboost)](https://pepy.tech/projects/linearboost)
@@ -32,9 +32,45 @@ Key Features:
32
32
 
33
33
  ---
34
34
 
35
+ ## 🚀 New in Version 0.1.7
36
+
37
+ ### Gradient Boosting Mode
38
+
39
+ LinearBoost now supports **gradient boosting** in addition to AdaBoost via the `boosting_type` parameter:
40
+
41
+ - **`boosting_type='adaboost'`** (default): Classic AdaBoost (SAMME or SAMME.R) that reweights samples by classification error.
42
+ - **`boosting_type='gradient'`**: Fits each base estimator to pseudo-residuals (negative gradient of log-loss). Often better for highly non-linear or XOR-like patterns and smoother decision boundaries.
43
+
44
+ ```python
45
+ # Gradient boosting for complex non-linear patterns
46
+ clf = LinearBoostClassifier(
47
+ boosting_type='gradient',
48
+ n_estimators=200,
49
+ kernel='rbf'
50
+ )
51
+ ```
52
+
53
+ ### Class Weighting & Custom Loss
54
+
55
+ - **`class_weight`**: Use `'balanced'` or a dict of class weights for imbalanced data. Weights are applied in the boosting loop.
56
+ - **`loss_function`**: Optional callable `(y_true, y_pred, sample_weight) -> float` for custom optimization objectives.
57
+
58
+ ```python
59
+ clf = LinearBoostClassifier(
60
+ class_weight='balanced', # Adjust for imbalanced classes
61
+ n_estimators=200
62
+ )
63
+ ```
64
+
65
+ ### Default Algorithm
66
+
67
+ The default **`algorithm`** is now **`'SAMME.R'`** for faster convergence and typically lower test error with fewer iterations (when using `boosting_type='adaboost'`).
68
+
69
+ ---
70
+
35
71
  ## 🚀 New in Version 0.1.5
36
72
 
37
- The latest release introduces major architectural improvements designed for **scalability**, **robustness on imbalanced data**, and **training speed**.
73
+ Version 0.1.5 introduced major architectural improvements designed for **scalability**, **robustness on imbalanced data**, and **training speed**.
38
74
 
39
75
  ### ⚡ Scalable Kernel Approximation
40
76
 
@@ -157,8 +193,7 @@ Version 0.1.2 of **LinearBoost Classifier** is released. Here are the changes:
157
193
  - Improved Scikit-learn compatibility.
158
194
 
159
195
 
160
- Get Started and Documentation
161
- -----------------------------
196
+ ## Get Started and Documentation
162
197
 
163
198
  The documentation is available at https://linearboost.readthedocs.io/.
164
199
 
@@ -172,13 +207,20 @@ The following parameters yielded optimal results during testing. All results are
172
207
  - **`learning_rate`**:
173
208
  Values between 0.01 and 1 typically perform well. Adjust based on the dataset's complexity and noise.
174
209
 
175
- - **`algorithm`**:
176
- Use either `SAMME` or `SAMME.R`. The choice depends on the specific problem:
210
+ - **`algorithm`** (when `boosting_type='adaboost'`):
211
+ Use either `SAMME` or `SAMME.R` (default). SAMME.R typically converges faster with lower test error.
177
212
  - `SAMME`: May be better for datasets with clearer separations between classes.
178
- - `SAMME.R`: Can handle more nuanced class probabilities.
213
+ - `SAMME.R`: Uses class probabilities; often better for nuanced boundaries.
179
214
 
180
215
  **Note:** As of scikit-learn v1.6, the `algorithm` parameter is deprecated and will be removed in v1.8. LinearBoostClassifier will only implement the 'SAMME' algorithm in newer versions.
181
216
 
217
+ - **`boosting_type`** *(new in v0.1.7)*:
218
+ - `'adaboost'`: Classic AdaBoost (default).
219
+ - `'gradient'`: Gradient boosting on pseudo-residuals; try for highly non-linear or XOR-like data.
220
+
221
+ - **`class_weight`** *(new in v0.1.7)*:
222
+ Use `'balanced'` for imbalanced datasets so class weights are adjusted automatically.
223
+
182
224
  - **`scaler`**:
183
225
  The following scaling methods are recommended based on dataset characteristics:
184
226
  - `minmax`: Best for datasets where features are on different scales but bounded.
@@ -210,8 +252,7 @@ The following parameters yielded optimal results during testing. All results are
210
252
 
211
253
  These parameters should serve as a solid starting point for most datasets. For fine-tuning, consider using hyperparameter optimization tools like [Optuna](https://optuna.org/).
212
254
 
213
- Results
214
- -------
255
+ ## Results
215
256
 
216
257
  All of the results are reported based on 10-fold Cross-Validation. The weighted F1 score is reported, i.e. f1_score(y_valid, y_pred, average = 'weighted').
217
258
 
@@ -337,6 +378,8 @@ params = {
337
378
  'algorithm': trial.suggest_categorical('algorithm', ['SAMME', 'SAMME.R']),
338
379
  'scaler': trial.suggest_categorical('scaler', ['minmax', 'robust', 'quantile-uniform', 'quantile-normal']),
339
380
  'kernel': trial.suggest_categorical('kernel', ['linear', 'rbf', 'poly']),
381
+ 'boosting_type': trial.suggest_categorical('boosting_type', ['adaboost', 'gradient']),
382
+ 'class_weight': trial.suggest_categorical('class_weight', [None, 'balanced']),
340
383
  'subsample': trial.suggest_float('subsample', 0.6, 1.0),
341
384
  'shrinkage': trial.suggest_float('shrinkage', 0.7, 1.0),
342
385
  'early_stopping': True,
@@ -353,19 +396,18 @@ LinearBoost's combination of **runtime efficiency** and **high accuracy** makes
353
396
  *Discusses how LinearBoost outperforms traditional boosting frameworks in terms of speed while maintaining accuracy.*
354
397
 
355
398
 
356
- Future Developments
357
- -----------------------------
399
+ ## Future Developments
400
+
358
401
  These are not yet supported in this current version, but are in the future plans:
359
402
  - Supporting categorical variables natively
360
403
  - Adding regression support (`LinearBoostRegressor`)
361
404
  - Multi-output classification
362
405
 
363
- Reference Paper
364
- -----------------------------
406
+ ## Reference Paper
407
+
365
408
  The paper is written by Hamidreza Keshavarz (Independent Researcher based in Berlin, Germany) and Reza Rawassizadeh (Department of Computer Science, Metropolitan college, Boston University, United States). It will be available soon.
366
409
 
367
- License
368
- -------
410
+ ## License
369
411
 
370
412
  This project is licensed under the terms of the MIT license. See [LICENSE](https://github.com/LinearBoost/linearboost-classifier/blob/main/LICENSE) for additional details.
371
413
 
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2007-2024 The scikit-learn developers.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -11,7 +11,6 @@ authors = [
11
11
  ]
12
12
  description = "LinearBoost Classifier is a rapid and accurate classification algorithm that builds upon a very fast, linear classifier."
13
13
  readme = "README.md"
14
- readme-content-type = "text/markdown"
15
14
  keywords = [
16
15
  "classification", "classifier", "linear", "adaboost", "boosting", "boost"
17
16
  ]
@@ -22,14 +21,12 @@ classifiers = [
22
21
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
23
22
  "Topic :: Scientific/Engineering :: Information Analysis",
24
23
  "Topic :: Software Development :: Libraries :: Python Modules",
25
- "Programming Language :: Python :: 3.8",
26
- "Programming Language :: Python :: 3.9",
27
24
  "Programming Language :: Python :: 3.10",
28
25
  "Programming Language :: Python :: 3.11",
29
26
  "Programming Language :: Python :: 3.12",
30
27
  "Programming Language :: Python :: 3.13",
31
28
  ]
32
- requires-python = ">=3.8,<3.14"
29
+ requires-python = ">=3.10,<3.14"
33
30
  dependencies = [
34
31
  "scikit-learn>=1.2.2",
35
32
  "typing-extensions>=4.1.0; python_full_version < '3.11'"
@@ -41,6 +38,7 @@ dev = [
41
38
  "pre-commit>=3.5.0",
42
39
  "pytest>=7.0.0",
43
40
  "ruff>=0.9.2",
41
+ "filelock>=3.20.1", # <-- ADD THIS LINE
44
42
  ]
45
43
 
46
44
  [project.urls]
@@ -1,2 +1,3 @@
1
1
  scikit-learn>=1.2.2
2
2
  typing-extensions>=4.1.0; python_version < "3.11"
3
+ filelock>=3.20.1
@@ -0,0 +1,9 @@
1
+ __version__ = "0.1.9"
2
+
3
+ from .linear_boost import LinearBoostClassifier
4
+ from .sefr import SEFR
5
+
6
+ __all__ = [
7
+ "LinearBoostClassifier",
8
+ "SEFR",
9
+ ]