napkinXC is an extremely simple and fast library for extreme multi-class and multi-label classification.
Project description
napkinXC
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):
- Probabilistic Label Trees for Extreme Multi-label Classification
- Online probabilistic label trees
- Propensity-scored Probabilistic Label Trees
- Efficient Algorithms for Set-Valued Prediction in Multi-Class Classification
Another implementation of PLT model is available in extremeText library, that implements approach described in this NeurIPS paper.
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 Distribution
Built Distributions
File details
Details for the file napkinxc-0.6.2.tar.gz
.
File metadata
- Download URL: napkinxc-0.6.2.tar.gz
- Upload date:
- Size: 43.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 927766f18fa214d9789901810b28dcce7ea360650229c5438ba17698d1e56868 |
|
MD5 | 501c0327b4690b3777b30bae879a4baf |
|
BLAKE2b-256 | c17633b6e22db312fd2f8105b94382083d023003b44b88fe602b6a5e2df96463 |
File details
Details for the file napkinxc-0.6.2-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 324.0 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5bf60e6ea0cb14935513e57ac76b2aeadb1d0d3a04163692b0a998ff5d0d331 |
|
MD5 | d2f1ca3d46f87ae05a9e44120242fe15 |
|
BLAKE2b-256 | b978831352f1835cfa174d35c9446e1fe91935624abeadcc2847266e0ba09b02 |
File details
Details for the file napkinxc-0.6.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 540.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c88f1578d4a5c77243930693ccfbe1fcfa197f19f3e8f4d801785de05e32cb2c |
|
MD5 | a167b54eac6e99992c683cf8a44ad26c |
|
BLAKE2b-256 | 4e31487777c0993e46a104918aeb88a0732e39e3083079c2be10ab8cd188a539 |
File details
Details for the file napkinxc-0.6.2-cp310-cp310-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp310-cp310-macosx_12_0_x86_64.whl
- Upload date:
- Size: 334.8 kB
- Tags: CPython 3.10, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2662424ec21b946b4722918e8ab778e5aa4944e7f257aba0883f62db35a9d4fb |
|
MD5 | f7eb5e054edf529f799a206d2a51d298 |
|
BLAKE2b-256 | 9aa3f286bbae2c900a6f1dd89b5a3bf8c098cc85f49b019c20fefb36c6ed3d70 |
File details
Details for the file napkinxc-0.6.2-cp310-cp310-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp310-cp310-macosx_11_0_x86_64.whl
- Upload date:
- Size: 344.7 kB
- Tags: CPython 3.10, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be9a3496b0c4c9fec2127767aa87ade9a1cbdf379b0dd768ebaa20638c534f85 |
|
MD5 | f34aae68ec4e1f3c622374d6dbeb68ed |
|
BLAKE2b-256 | 1856034c8ca7828bf528531225a4328c2d8e1f51ca08758014364eb0dd29b5d1 |
File details
Details for the file napkinxc-0.6.2-cp310-cp310-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp310-cp310-macosx_10_15_x86_64.whl
- Upload date:
- Size: 349.0 kB
- Tags: CPython 3.10, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74c2e1c253ea6dcd207600427824a4942984d975ec2e684eb450a8bb265a950c |
|
MD5 | 9ef5d194efa30edf878a45dbaae7f825 |
|
BLAKE2b-256 | 4a9ef3977906e58caf7d7f803e72d97781cdbc1b2b6f84b6a23726abc9d4eeaf |
File details
Details for the file napkinxc-0.6.2-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 324.1 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b09ab729ab8ab5fc8bb904ab80cd75c78e7263ad2f22a3f1edc5e4db49ba64e |
|
MD5 | a8ddd8df00ee3613fe36565101c5ef67 |
|
BLAKE2b-256 | ce3ef89940f57f993953553eeed4d72301c88f95e7396af41420c130483fcb27 |
File details
Details for the file napkinxc-0.6.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 540.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f90ff1a91052fc16aefab7e25e473a549c1f127e2790ba3ac79a03ec41dc5e |
|
MD5 | 718c1aa32114392260bebddf07c8a3ca |
|
BLAKE2b-256 | b77ee1edfca4c810907d8d2614d60cfb170ad373ae325417fb47def30a250ac6 |
File details
Details for the file napkinxc-0.6.2-cp39-cp39-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp39-cp39-macosx_12_0_x86_64.whl
- Upload date:
- Size: 334.9 kB
- Tags: CPython 3.9, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abeb2df62590bd39ba572aa9f0156c6a2779757ea1cb1617faf0e6b0aed9aa11 |
|
MD5 | 36da9ca9d54e8ce024ebb2163d0b26ac |
|
BLAKE2b-256 | 7329bb452c30061846bfcbd51433bff2ed970cf5fd8436ce049cafdaea726686 |
File details
Details for the file napkinxc-0.6.2-cp39-cp39-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp39-cp39-macosx_11_0_x86_64.whl
- Upload date:
- Size: 344.8 kB
- Tags: CPython 3.9, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b466d52dac0716ba47f01e66b23f89f138c1dead096415513d8b9514b6c43607 |
|
MD5 | 0398fda7d42310eec3c428822534cc6a |
|
BLAKE2b-256 | 67e70426fb913f9ac294a826856dd975c1f75d911ffde209cb59618e157bcfa5 |
File details
Details for the file napkinxc-0.6.2-cp39-cp39-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp39-cp39-macosx_10_15_x86_64.whl
- Upload date:
- Size: 349.0 kB
- Tags: CPython 3.9, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ece2378e65802f28db5e7b9878bcc279e5ed31c83aab1d145fc70bfd0ce3daf |
|
MD5 | 86bd940b7eca1fac369d29a62bab572a |
|
BLAKE2b-256 | feec3b054ee58fcbc217f462796101ac2ecd0c4ebd59a31e72c60092f92a1ae0 |
File details
Details for the file napkinxc-0.6.2-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 324.0 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 603449127c3feb7c51ef690f52bd986cb8ed14755718743417fe744a36262072 |
|
MD5 | 5f0590aebe91d298f9d16ef791dda3c8 |
|
BLAKE2b-256 | 2b8cccd01549f1294f2fd3653de3256b8217ba3b718cdf4e6b9a0f5fb3b86a32 |
File details
Details for the file napkinxc-0.6.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 540.4 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7bafab04e06e0da759285340a49cd28e12eff0404e441fa0df62185b95838a9 |
|
MD5 | 7a441b7a788eaf8eba35a8e7530f259d |
|
BLAKE2b-256 | 07f0fecffddaf333dac15e6bc88c267265aa4816a0694b51d60adbfb03c17faa |
File details
Details for the file napkinxc-0.6.2-cp38-cp38-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp38-cp38-macosx_12_0_x86_64.whl
- Upload date:
- Size: 334.9 kB
- Tags: CPython 3.8, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eae1e3c622f7102df46252114f476b16ef01c3f972f6ae4a8cdf1654096da24f |
|
MD5 | 2a3775aa1f9253b8a6d1d41ef2f8ce43 |
|
BLAKE2b-256 | 86098f9a7193e6b01bfb7a3c298aee1618d1ed9c69088ed6b98d5079be7ca577 |
File details
Details for the file napkinxc-0.6.2-cp38-cp38-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp38-cp38-macosx_11_0_x86_64.whl
- Upload date:
- Size: 344.8 kB
- Tags: CPython 3.8, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d204005066b24675669a3dbc6967a531568fdf0b7307e5437307fb9d05ef0bb |
|
MD5 | 21588c89b85352a6b85ea7db49aeef22 |
|
BLAKE2b-256 | 75004cc9ec2a501059d024aa144af2811b4899001208d1b1e9db6efff5b20109 |
File details
Details for the file napkinxc-0.6.2-cp38-cp38-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp38-cp38-macosx_10_15_x86_64.whl
- Upload date:
- Size: 349.0 kB
- Tags: CPython 3.8, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 023a93b7d375d9f5c903080b5138e9ac8414b5685c330c4032aac7e0863329f3 |
|
MD5 | d2d065acac5c561a6e13155e9a9420d8 |
|
BLAKE2b-256 | e0d04d55760d8c6486dce8cb26efb54564631a2321a3a8f61697db09c32ea322 |
File details
Details for the file napkinxc-0.6.2-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 325.7 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f1fde1370918da711310b9bb89d792421bb7f91481bf84d47e1f518b61a6727 |
|
MD5 | f700dd5bcf80deaa54689fde7d502139 |
|
BLAKE2b-256 | 3f57e155db19cbaa61e8f0115a0028c019eb91d9c31ae721ff007987a2b88661 |
File details
Details for the file napkinxc-0.6.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 542.9 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a994232a95327b1d1a3cbf917e517488b2aa2f8e9beabd86d7e208d843b20fa6 |
|
MD5 | fff7dd7f1b109b15e5c25c8cda0ca7c5 |
|
BLAKE2b-256 | c4355667fd3284dedc914bb1f636847adea0ce1426390955b248559f80fc3443 |
File details
Details for the file napkinxc-0.6.2-cp37-cp37m-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp37-cp37m-macosx_12_0_x86_64.whl
- Upload date:
- Size: 332.3 kB
- Tags: CPython 3.7m, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a18efe11c0994b0141f19e6142e071683b6916a72585797932086d19a1b87c07 |
|
MD5 | ce126eca986c155138303875ce76bd74 |
|
BLAKE2b-256 | cfcc168220bf821cf21caf6b1a957c72ed1f7e3a493c1c4a6c4acb22d2432808 |
File details
Details for the file napkinxc-0.6.2-cp37-cp37m-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp37-cp37m-macosx_11_0_x86_64.whl
- Upload date:
- Size: 342.4 kB
- Tags: CPython 3.7m, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d702f1883874cbbdfb87027322d0e94c16f58fa37716b8a54b5371984853a1f8 |
|
MD5 | 42fdae1adc35361fc7eb6d601151e033 |
|
BLAKE2b-256 | d6195037e68fc3ebcceb534bbe9ef44e2e3e954b6277809453bbf148049eb19d |
File details
Details for the file napkinxc-0.6.2-cp37-cp37m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: napkinxc-0.6.2-cp37-cp37m-macosx_10_15_x86_64.whl
- Upload date:
- Size: 346.2 kB
- Tags: CPython 3.7m, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0673296670260588f2a4ff89cf97419962d2059b9fd6eb34dccd824a81bafc47 |
|
MD5 | be9a128f8aad0ceffac6e68cb8522241 |
|
BLAKE2b-256 | d69c4d3cffe440af5796f35815f0ecddb2236988ec4409e4b5278121e8fe15ac |