Skip to main content

napkinXC is an extremely simple and fast library for extreme multi-class and multi-label classification.

Project description

napkinXC

C++ build Python build Documentation Status PyPI version

napkinXC is an extremely simple and fast library for extreme multi-class and multi-label classification, that focus on implementing various methods for Probabilistic Label Trees. It allows training a classifier for very large datasets in just a few lines of code with minimal resources.

Right now, napkinXC implements the following features both in Python and C++:

  • Probabilistic Label Trees (PLTs) and Hierarchical softmax (HSM),
  • different types of inference methods (top-k, above a given threshold, etc.),
  • fast prediction with labels weight, e.g., propensity scores,
  • efficient online F-measure optimization (OFO) procedure,
  • different tree building methods, including hierarchical k-means clustering method,
  • training of tree node
  • support for custom tree structures, and node weights,
  • helpers to download and load data from XML Repository,
  • helpers to measure performance (precision@k, recall@k, nDCG@k, propensity-scored precision@k, and more).

Please note that this library is still under development and also serves as a base for experiments. API may not be compatible between releases and some of the experimental features may not be documented. Do not hesitate to open an issue in case of a question or problem!

The napkinXC is distributed under the MIT license. All contributions to the project are welcome!

Python Quick Start and Documentation

Install via pip:

pip install napkinxc

We provide precompiled wheels for many Linux distros, macOS, and Windows for Python 3.7+. In case there is no wheel for your os, it will be quickly compiled from the source. Compilation from source requires modern C++17 compiler, CMake, Git, and Python 3.7+ installed.

The latest (master) version can be installed directly from the GitHub repository (not recommended):

pip install git+https://github.com/mwydmuch/napkinXC.git

A minimal example of usage:

from napkinxc.datasets import load_dataset
from napkinxc.models import PLT
from napkinxc.measures import precision_at_k

X_train, Y_train = load_dataset("eurlex-4k", "train")
X_test, Y_test = load_dataset("eurlex-4k", "test")
plt = PLT("eurlex-model")
plt.fit(X_train, Y_train)
Y_pred = plt.predict(X_test, top_k=1)
print(precision_at_k(Y_test, Y_pred, k=1)) 

More examples can be found under python/examples directory, and napkinXC's documentation is available at https://napkinxc.readthedocs.io.

Executable

napkinXC can also be used as executable to train and evaluate models using data in LIBSVM format. See documentation for more details.

References and acknowledgments

This library implements methods from the following papers (see experiments directory for scripts to replicate the results):

Another implementation of PLT model is available in extremeText library, that implements approach described in this NeurIPS paper.

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

napkinxc-0.6.1.tar.gz (12.2 MB view details)

Uploaded Source

Built Distributions

napkinxc-0.6.1-cp310-cp310-win_amd64.whl (322.6 kB view details)

Uploaded CPython 3.10 Windows x86-64

napkinxc-0.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (538.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

napkinxc-0.6.1-cp310-cp310-macosx_12_0_x86_64.whl (335.5 kB view details)

Uploaded CPython 3.10 macOS 12.0+ x86-64

napkinxc-0.6.1-cp310-cp310-macosx_11_0_x86_64.whl (343.4 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

napkinxc-0.6.1-cp310-cp310-macosx_10_15_x86_64.whl (347.6 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

napkinxc-0.6.1-cp39-cp39-win_amd64.whl (322.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

napkinxc-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (538.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

napkinxc-0.6.1-cp39-cp39-macosx_12_0_x86_64.whl (335.6 kB view details)

Uploaded CPython 3.9 macOS 12.0+ x86-64

napkinxc-0.6.1-cp39-cp39-macosx_11_0_x86_64.whl (343.5 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

napkinxc-0.6.1-cp39-cp39-macosx_10_15_x86_64.whl (347.7 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

napkinxc-0.6.1-cp38-cp38-win_amd64.whl (322.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

napkinxc-0.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (539.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

napkinxc-0.6.1-cp38-cp38-macosx_12_0_x86_64.whl (335.6 kB view details)

Uploaded CPython 3.8 macOS 12.0+ x86-64

napkinxc-0.6.1-cp38-cp38-macosx_11_0_x86_64.whl (343.4 kB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

napkinxc-0.6.1-cp38-cp38-macosx_10_15_x86_64.whl (347.6 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

napkinxc-0.6.1-cp37-cp37m-win_amd64.whl (324.3 kB view details)

Uploaded CPython 3.7m Windows x86-64

napkinxc-0.6.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (541.5 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

napkinxc-0.6.1-cp37-cp37m-macosx_12_0_x86_64.whl (333.1 kB view details)

Uploaded CPython 3.7m macOS 12.0+ x86-64

napkinxc-0.6.1-cp37-cp37m-macosx_11_0_x86_64.whl (341.0 kB view details)

Uploaded CPython 3.7m macOS 11.0+ x86-64

napkinxc-0.6.1-cp37-cp37m-macosx_10_15_x86_64.whl (344.8 kB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

File details

Details for the file napkinxc-0.6.1.tar.gz.

File metadata

  • Download URL: napkinxc-0.6.1.tar.gz
  • Upload date:
  • Size: 12.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for napkinxc-0.6.1.tar.gz
Algorithm Hash digest
SHA256 64f1c16f0f200f861fe7dab519121dbead2ce7dda2e0abd1ba12e36c1a3bd30c
MD5 5b1074f8af064f9786786935a5430cfc
BLAKE2b-256 6f8ace387bea54a37c3018c3aa3fd436911e095ef92e95b220842f8cc5e50c83

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: napkinxc-0.6.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 322.6 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for napkinxc-0.6.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5011eafcf1f854233427bc3b3d459ff445262033ec334e4f535183036e00f3f4
MD5 0713bfc5c91e9ee62d0de401e5eae02c
BLAKE2b-256 5e755652c6e312ca9b1fe50005e95244bb1cc88b62d3324bf624ed32cc71257a

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 404a8591130638ab2942ff41ae19bd844fd851a67339a5af000614fa07a18259
MD5 3111004beecced9adc513a3ec4b638dd
BLAKE2b-256 1758cce128f4d86baa6c325be8e75128137360a3d297dd98edb0f1ea8c61b218

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 974494edae2c44ab0802fed4ac80c543339232bf5fa3ca35f0d899652ecb8488
MD5 deaddb6f2450936af7502d88f81d82c0
BLAKE2b-256 2e8854a0b07a3e22c68bc423999daf5d8d14bb44e9d88afc73651c4104532b48

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 d4fbe857267486241d504cfdc82ae35b42630542e7b46c8b1c1eea4ddc14aae9
MD5 272066d7a1b8530c7bb7fe4500c44892
BLAKE2b-256 5d58a69bd1dd55f47e8e9bb4d7836e09ec61ea55b232279cfcbb5da437879ed0

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 30cb4f4b5648ce2e2b32e30d7b4f975e66b6b63d61857577e2f3a90c756d273d
MD5 a1f79342b8ea750fb09d06acab637cb8
BLAKE2b-256 a3372b17a39dda096d57be0f5b8fdfdc6cfdde93fe6e53766c7efa12c791848f

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: napkinxc-0.6.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 322.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for napkinxc-0.6.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 302d169ef9487f4dc53b3feb3490c1fea63261f6845f7e596b2d704c62208d9b
MD5 3f36989b362404979f9b1d06e859f94a
BLAKE2b-256 7225839b8f10321a714a4b2ee162db228fa4596502ef4579b6e89315cdf58917

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa52eae6fa94136a2ec2692dd534921a1514e8da25ff78dfac2a3d4b8ae38e9d
MD5 bc772117425d2e85d1319528639734fb
BLAKE2b-256 2162e3b82b96ca1998aef9cdf58e90e2b83cd4cba9c2210a33d4c5dcb6bd368c

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 4ee8bf0a15686bb97041e57fbe02d697bbec50cd87ddda91894e714c8187321a
MD5 8e12fc0420f101e6382b65727758d648
BLAKE2b-256 cf685b6e608ae07bd28eb6191d72b6873a9e9547fa421df23cffb8fad3891584

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 3082fc157f9aa5a07bcad308cd46a78755358885d878d8a70aa3a9879949ad87
MD5 9675029d073d12e2ea71d8e3b2739e16
BLAKE2b-256 949c3891ee9c200b270c1c17b800b672686c7fc9168e8ac599737ad08c38e64a

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 640b06b6502ed06206134651751757c9bb9aa91aeaf96f65300bf25944c805fb
MD5 673769071d0e0c50c9ee9ce986bfaa9e
BLAKE2b-256 f6ce89ea0b56b81cb946f86f42f6474669354b32d9fc7c017429512edaae294a

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: napkinxc-0.6.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 322.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for napkinxc-0.6.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f404b9bb23b960163bb50221be2dde73f3e890702c461c564532fae619179b54
MD5 d81dba56e870af4415cad3613eb143d3
BLAKE2b-256 f92974d7b479a28861674ed0d65ed4d57761826282b864f2d081d5543c067e1a

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d85a7b8ce7c0da750cdd088a9f718eb5666d6f81491ea771cc97527b93230b51
MD5 7b412f4cba8716c508576f846307dacd
BLAKE2b-256 6b530b9247377839f0a791b8e83c06f7fab1fb21816166907e461ed0111f0b3c

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp38-cp38-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 eddf53d620fa51be58723d8bd2aed05e37df46c62aefdd83e5074c8243481bf7
MD5 d9db587c417f16d290c1ddd1d0d0d9a7
BLAKE2b-256 99e73b94243b0a434e839176fa6dc25199cf66dffd6b02a5a81cd979d4ac5354

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 7b0a4d8aedd9c6d07d5433371e98e736178b9b813acf6e9a67a33ba2cf1d95d0
MD5 77c7190013b19d34f69d363e250d26a8
BLAKE2b-256 ed892c90b1681214d96e31062a62c295d2d000bb50c1e7dfcc077b93b44f999f

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 3fc36961834285a2a85cfc75db3bb44977409a1c471e5f996618dd89697ed374
MD5 42f8205f6fad73738a3a48d888a0f006
BLAKE2b-256 098dbdadc89e9d102d8c03d9aed50a8845c98dee5d909bb2b1aced2f13c4555d

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: napkinxc-0.6.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 324.3 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for napkinxc-0.6.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7a04318eea004e5ded9f8086849e24141487e927a8e511c6beac8df8f7dbf93d
MD5 68fd022dbac0a85f722b03e8def145d7
BLAKE2b-256 a618485b94bcc65bebb5e293914b79e1370901466d1acdbf8fcbfbf2c2e84884

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69e9c44cc98b6930a3a29c681a2aa8b38e0609deb1334bb195fbc8ab136c7dc7
MD5 c694fa39564c3cd8983d698f6b5b0145
BLAKE2b-256 1ac4ab8033693f2da8ef96e6c4d40905dbeb46d1758853cdd6c399dc7e21117c

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp37-cp37m-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp37-cp37m-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 6f71007f02b3a40d2e4f42b1c35841b501fd67c4511292e802be1b11e3e1ecde
MD5 14afd6b0781b3182ddd5fff4ff3d6516
BLAKE2b-256 add89b1f9b4c50677e4c18f4e1f411df77f49806286a15a206afd86bab9db878

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp37-cp37m-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 6285a810b466024223606534b0ae63d59b67bcc4b489cfcc16ebb507465b712e
MD5 712fca092cc3302bba23c25b2fac3206
BLAKE2b-256 c5d22930872e920e29093af22eed1355d49cc98cb3c04d5683d94eb6f7d888e6

See more details on using hashes here.

File details

Details for the file napkinxc-0.6.1-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for napkinxc-0.6.1-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 adc8bcb3b390d5dc2df451b39693f83f03c82f588fa19b79d590df9d8331d721
MD5 96de846b893b29b976959c703d3d48d3
BLAKE2b-256 30a2431312515fdfe741ca73175a7c6b8c88143fd9cb3a54023256f41cb5b741

See more details on using hashes here.

Supported by

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