Skip to main content

A library to build Gradient boosted trees for ordinal labels

Project description

Python application

OrdinalGBT

Introduction

OrdinalGBT, which stands for Ordinal gradient boosted trees, is a Python package that implements an ordinal regression loss function using the lightGBM framework. Ordinal regression is a type of regression analysis used for predicting an ordinal variable, i.e. a variable that can be sorted in some order. LightGBM is a gradient boosting framework that uses tree-based learning algorithms and is designed to be distributed and efficient.

Installation

You can install OrdinalGBT using pip:

pip install ordinalgbt

Usage

Here are a few examples on how to use the LGBMOrdinal class:

  1. Fitting the model
from ordinalgbt.lgb import LGBMOrdinal
import numpy as np

# Create the model
model = LGBMOrdinal()

# Generate some data
X = np.random.rand(100, 10)
y = np.random.randint(0, 3, 100)

# Fit the model
model.fit(X, y)
  1. Predicting with the model

After fitting the model, you can use it to make predictions:

# Generate some new data
X_new = np.random.rand(10, 10)

# Use the model to make predictions
# the .predict method returns the class prediction rather than raw score or
# probabilities
y_pred = model.predict(X_new)

print(y_pred)
  1. Predicting probabilities with the model

The predict_proba method can be used to get the probabilities of each class:

# Use the model to predict probabilities
y_proba = model.predict_proba(X_new)

print(y_proba)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ordinalgbt-0.1.2.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ordinalgbt-0.1.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file ordinalgbt-0.1.2.tar.gz.

File metadata

  • Download URL: ordinalgbt-0.1.2.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for ordinalgbt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a306202d94691e15bf32a81a310b45c272483ffd1406903a86188a554a94953e
MD5 85c8d718f687f8d754bfb1969ece4e9a
BLAKE2b-256 89b5243d1a20aca39a47f646b9ea49bfb1ed4dc7143cb803871a58a29b311278

See more details on using hashes here.

File details

Details for the file ordinalgbt-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ordinalgbt-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for ordinalgbt-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd8c7e45c53af89c28227d65d0837bbc27179b9d8971c0df972d999133bd2e08
MD5 db1095ba81b44284d029774413658d7a
BLAKE2b-256 d82a6bdd43a3b81faabd1c4074881b258e436ec91fd6585c11aaa952f22350d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page