Skip to main content

QXGBoost: Quantized XGBoost for FPGA deployment

Project description

qxgb

QXGBoost: quantized XGBoost Classifier for FPGA Deployment.

qxgb provides QXGBClassifier inheriting from xgboost.XGBClassifier with quantization aware training and registers the Alkaid tracer plugin for converting trained (Q)XGBoost boosters into RTL designs with Alkaid.

Installation

pip install qxgb

Quick Start

from qxgb import QXGBClassifier

model = QXGBClassifier(
    scale=4,
    bias=2,
    n_estimators=32,
    max_depth=3,
)

model.fit(X_train, y_train)
y_pred = model.predict(X_test)

hw_bst = model.ibooster() # Integer booster

from alkaid.converter import trace_model
from alkaid.trace import FVArray, trace

inp = FVArray.new(16).quantize(0, 8, 0).as_new()
_, out = trace_model(hw_bst, inputs=inp, mode='mux')
comb = trace(inp, out)

hw_pred = comb.predict(X_test) # == y_pred

Examples

Notebook examples are in examples/:

  • jsc.ipynb
  • mnist.ipynb
  • nid.ipynb

License

LGPLv3. See LICENSE.

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

qxgb-0.1.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

qxgb-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file qxgb-0.1.0.tar.gz.

File metadata

  • Download URL: qxgb-0.1.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qxgb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9b5e0a4702d3b9e6e0322f2bde56012bc2a9f5686e4be7d53d00fc28d19d2826
MD5 e6a9776afc54ce448319ee1297e53f82
BLAKE2b-256 ea760b9ad17df97f558568017cdef7f39c396b22bbab3a05f4f4f52b316cfc53

See more details on using hashes here.

Provenance

The following attestation bundles were made for qxgb-0.1.0.tar.gz:

Publisher: python-publish.yml on calad0i/qxgb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qxgb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qxgb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qxgb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d3752ada9cee3c02a3564a644520b8892ee31e4f32f4de00cfac240a0fc2463
MD5 bc2f58a6a1769022d67e9702a261c998
BLAKE2b-256 249c0b6c121db898afb5684cf924f976c33db475d01741cebb5d2891b1894a8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for qxgb-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on calad0i/qxgb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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