wideboost
Implements wide boosting using popular boosting frameworks as a backend. XGBoost supports the most wideboost features currently. Previous versions supported LightGBM, but this has since been deprecated.
Getting started
pip install wideboost
Sample scripts
The examples folder contains sample scripts for regression, binary classification, multivariate classification and multioutput binary classification. Currently xgboost is the only supported backend.
Starter script
import xgboost as xgb
from wideboost.wrappers import wxgb
from pydataset import data
import numpy as np
########
## Get and format the data
DAT = np.asarray(data('Yogurt'))
X = DAT[:,0:9]
Y = np.zeros([X.shape[0],1])
Y[DAT[:,9] == 'dannon'] = 1
Y[DAT[:,9] == 'hiland'] = 2
Y[DAT[:,9] == 'weight'] = 3
Y = wxgb.onehot(Y)
n = X.shape[0]
np.random.seed(123)
train_idx = np.random.choice(np.arange(n),round(n*0.4),replace=False)
test_idx = np.setdiff1d(np.arange(n),train_idx)
xtrain, ytrain = X[train_idx,:], Y[train_idx,]
xtest, ytest = X[test_idx,:],Y[test_idx,]
########
param = {
'eta':0.1,
'btype':'I', ## wideboost param -- one of 'I', 'In', 'R', 'Rn'
'extra_dims':1, ## wideboost param -- integer >= -output_dim
'beta_eta': 0.01, ## wideboost param -- learning rate for B. Can be unstable -- set to 0 to start.
'output_dim': 4, ## wideboost param -- Y must be in a 2D format (ie not a vector of categories)
'objective':'manybinary:logistic', ## treat response columns as separate binary problems
'eval_metric':['many_logloss'] ## average binary logloss across columns
}
num_round = 100
watchlist = [((xtrain, ytrain),'train'),((xtest, ytest),'test')]
wxgb_results = dict()
bst = wxgb.fit(xtrain, ytrain, param, num_round, watchlist, evals_result=wxgb_results, verbose_eval=10)
Parameter Explanations
'btype'indicates how to initialize the beta matrix. Settings are'I','In','R','Rn'.'beta_eta'learning rate for the beta matrix. Sometimes unstable. Start with 0.'output_dim'width of Y. All Y need to be in 2D matrix format and onehotted if doing categorical prediction.'extra_dims'integer indicating how many "wide" dimensions are used. When'extra_dims'is set to0(and'btype'is set to'I'and'beta_eta'is0) then wide boosting is equivalent to standard gradient boosting.
New Objectives
'multi:squarederror'multidimension output regression.'manybinary:logistic'loss is independent logloss average across response columns
New Evals
'many_logloss'logloss averaged across response columns'many_auc'auc averaged across response columns
Reference
https://arxiv.org/pdf/2007.09855.pdf
Analyses included in the paper are in the examples/paper_examples/ folder.
Metadata
Release files for wideboost 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wideboost-0.4.2.tar.gz | 12.8 kB | Without provenance | Details for wideboost-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wideboost-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for wideboost-0.4.2-py3-none-any.whl |
Total release size: 30.9 kB
Release files / wideboost-0.4.2.tar.gz
| Download URL | wideboost-0.4.2.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
faf78d5cdaa1a1d7457eb7581faff9e0d872a6ad7777f16a9e1442f92521e9a9
|
|
BLAKE2b-256 checksum How to use checksums |
88b3ab19ac02f35288f62f11827b04222166e5af7021b9d51d8c2a557b4a15be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0
|
Release files / wideboost-0.4.2-py3-none-any.whl
| Download URL | wideboost-0.4.2-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b17d08a5b3e304e7e028c5e5232df1eaf79ef1252073728859f33d5a88dc880
|
|
BLAKE2b-256 checksum How to use checksums |
ba7a7f5071ae71a7661ca3952244fc122fa12eb0428cbfa633030b54a5c1f9b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0
|
Security for wideboost 0.4.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.