Gradient Boosting Ordinal Regression
Project description
Gradient Boosting for Ordinal Regression (GBOR)
gbor is a scikit-learn-compatible, Python package designed for gradient boosting tailored to ordinal regression problems. It does so by alternating between fitting a base learner - GradientBoostingRegressor, by default - to predict a latent score that specifies the mean of a cumulative density function for the observed discrete outcomes, and fitting a set of thresholds that convert the latent score to the discrete outcome. It can be viewed as 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.
- Supports sample weighting for robust handling of imbalanced datasets.
- Subsampling for stochastic gradient boosting.
- Early stopping based on validation loss.
- Utilities for data loading and evaluation metrics.
Installation
Clone the repository and install the package:
git clone https://github.com/yourusername/gbor.git
cd gbor
pip install .
Quick Start
Load the Wine Quality Dataset
The package includes a utility to load the wine quality dataset from the UCI repository.
from gbor.data 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 gbor.main 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 gbor.main 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.
For issues or contributions, feel free to create a pull request or open an issue on the GitHub repository.
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.0-py3-none-any.whl.
File metadata
- Download URL: ogboost-0.5.0-py3-none-any.whl
- Upload date:
- Size: 15.9 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 |
548bba39e58fe6c5679782dc2e1dbb4c97f34e3fa3f1a3a26fb21a50eb7badc9
|
|
| MD5 |
5cc6f0017ef1928626a4bb60b2aa2b07
|
|
| BLAKE2b-256 |
9ce69d150c853b6bf0c989e181419e49db968deff9315c14b5fefa3a2431a412
|