Skip to main content

quantile-tree

Non-crossing quantile estimation with:

  • LightGBM
  • XGBoost

Installation

Install using pip:

pip install quantile-tree

Usage

Features

  • QuantileRegressorLgb: quantile regressor based on LightGBM
  • QuantileRegressorXgb: quantile regressor based on XGBoost

Parameters

x         # Explanatory data (e.g. pd.DataFrame)
          # Column name '_tau' must be not included
y         # Response data (e.g. np.ndarray)
alphas    # Target quantiles
objective # [Optional] objective to minimize, "check"(default) or "huber"
delta     # [Optional] parameter in "huber" objective, used when objective == "huber"
          # delta must be smaller than 0.1

Methods

train     # train quantile model
          # Any params related to model can be used except "objective"
predict   # predict with input data

Example

import numpy as np
from quantile_tree import QuantileRegressorLgb, QuantileRegressorXgb

## Generate sample
sample_size = 500
x = np.linspace(-10, 10, sample_size)
y = np.sin(x) + np.random.uniform(-0.4, 0.4, sample_size)
x_test = np.linspace(-10, 10, sample_size)
y_test = np.sin(x_test) + np.random.uniform(-0.4, 0.4, sample_size)

## target quantiles
alphas = [0.3, 0.4, 0.5, 0.6, 0.7]

## QuantileRegressorLgb
monotonic_quantile_lgb = QuantileRegressorLgb(
    x=x,
    y=y_test,
    alphas=alphas,
    objective="huber",
    delta=0.05,
)
lgb_params = {
    "max_depth": 4,
    "num_leaves": 15,
    "learning_rate": 0.1,
    "boosting_type": "gbdt",
}
monotonic_quantile_lgb.train(params=lgb_params)
preds_lgb = monotonic_quantile_lgb.predict(x=x_test, alphas=alphas)


## QuantileRegressorXgb
monotonic_quantile_xgb = QuantileRegressorXgb(
    x=x,
    y=y_test,
    alphas=alphas
)
xgb_params = {
    "learning_rate": 0.65,
    "max_depth": 10,
}
monotonic_quantile_xgb.train(params=xgb_params)
preds_xgb = monotonic_quantile_xgb.predict(x=x_test, alphas=alphas)

Metadata

Release files for quantile-tree 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quantile-tree 0.1.2
File Size Uploaded Provenance Actions
quantile_tree-0.1.2.tar.gz 5.5 kB Without provenance Details for quantile_tree-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quantile-tree 0.1.2
File Interpreter ABI Platform Actions
quantile_tree-0.1.2-py3-none-any.whl Python 3 none any Details for quantile_tree-0.1.2-py3-none-any.whl

Total release size: 12.5 kB

Release files / quantile_tree-0.1.2.tar.gz

Download URL quantile_tree-0.1.2.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d0798785341aaa471d0708451276003dedb10e05c47de1d9365f8dead36ab16f
BLAKE2b-256 checksum
How to use checksums
f83ae01570f93a3b349677b8ad1b676ac5e1c7477764d6732da805f5daaff4ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / quantile_tree-0.1.2-py3-none-any.whl

Download URL quantile_tree-0.1.2-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54de76ff246964fd71f85ceff4bedd27798c4929a89a3820dd83c1b110f182f0
BLAKE2b-256 checksum
How to use checksums
0e37bc098f59b2d81c9fa7e3a1c60224e32689c76297b0e38d8bf4e8ac2581da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Security for quantile-tree 0.1.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page