Ordinal Gradient Boosting
Project description
Ordinal Gradient Boosting (OGBoost)
OGBoost is a scikit-learn-compatible, Python package designed for gradient boosting tailored to ordinal regression problems. It does so by alternating between 1) fitting a base learner - which is, by default, a DecisionTreeRegressor - to predict a latent score that specifies the mean of a probability density function (PDF), and 2) fitting a set of thresholds that generate discrete outcomes from the PDF. In other words, OGBoost implements coordinate-descent optimization that combines functional gradient descent (the boosting stage) with ordinary gradient descent (for adjusting thresholds).
The main class in the package, GradientBoostingOrdinal, supports custom link functions, sample weighting, early stopping criteria, and staged predictions. In addition to methods for predicting class labels and probabilities, similar to nominal classifiers, the decision_function method of the class predicts the latent score, which can be used to achieve superior performance in discreiminative/ranking tasks.
Features
- Fully compatible with scikit-learn pipelines.
- Customizable link functions: Probit, Logit, and Complementary Log-Log.
- Sample weighting for robust handling of imbalanced datasets.
- Subsampling for stochastic gradient boosting.
- Early stopping based on validation-set loss.
- Utility for downlaoding and using the
wine-qualitydataset from the UCI ML repository.
Installation
pip install ogboost
Quick Start
Load the Wine Quality Dataset
The package includes a utility to load the wine quality dataset from the UCI repository.
from ogboost import load_wine_quality
# Load data
red_wine, white_wine = load_wine_quality()
X = red_wine.drop(columns="quality")
y = red_wine["quality"]
Train a Gradient Boosting Ordinal Model
from ogboost import GradientBoostingOrdinal
# Initialize and fit the model
model = GradientBoostingOrdinal(n_estimators=100, link_function='logit', verbose=1)
model.fit(X, y)
# Predict class labels and probabilities
predicted_labels = model.predict(X)
predicted_probabilities = model.predict_proba(X)
# Evaluate using the concordance index
from ogboost import concordance_index
c_index = concordance_index(y, model.decision_function(X))
print(f"Concordance Index: {c_index:.3f}")
License
This package is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ogboost-0.5.1-py3-none-any.whl.
File metadata
- Download URL: ogboost-0.5.1-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53ec442503476d27ea7182bb5020e02644fef0c72b2e69b3fae4e54b7def7de0
|
|
| MD5 |
976e53e034063f1385bf95ca41b4f6ef
|
|
| BLAKE2b-256 |
55ace70f97865314602e8d4a42ec2062cb2ed6d0c231038f70f9b75e6dbd6339
|