KSU Compression Algorithm Implementation
Algortihm 1 from Nearest-Neighbor Sample Compression: Efficiency, Consistency, Infinite Dimensions
Installation
- With pip:
pip install ksu - From source:
git clone --recursive https://github.com/nimroha/ksu_classifier.gitcd ksu_classifierpython setup.py install
Usage
This package provides a class KSU(Xs, Ys, metric, [gram, prune, logLevel, n_jobs])
Xs and Ys are the data points and their respective labels as numpy arrays
metric is either a callable to compute the metric or a string that names one of our provided metrics (print ksu.KSU.METRICS.keys() for the full list)
gram (optional, default=None) a precomputed gramian matrix, will be calculated if not provided.
prune (optional, default=False) a boolean indicating whether to prune the compressed set or not (Algorithm 2 from Near-optimal sample compression for nearest neighbors)
`logLevel (optional, default='CRITICAL') a string indicating the logging level (set to 'INFO' or 'DEBUG' to get more information)
n_jobs (optional, default=1) an integer defining how many cpus to use, pass -1 to use all. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used.
KSU provides a method compressData([delta])
Which selects the subset with the lowest estimated error with confidence 1 - delta.
You can then run getClassifier() which returns a 1-NN Classifer (based on sklearn's K-NN) fitted to the compressed data.
Or, run getCompressedSet() to get the compressed data as a tuple of numpy arrays (compressedXs, compressedYs).
See scripts/ for example usage
Metadata
Release files for ksu 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ksu-0.2.1.tar.gz | 13.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ksu-0.2.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 27.6 kB
Release files / ksu-0.2.1.tar.gz
| Download URL | ksu-0.2.1.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09f4016e09c8d24be5762b14408a1ca6a7eb4188fe44fc19e74ba39b54c69529
|
|
BLAKE2b-256 checksum How to use checksums |
2029285b75c7c9a03c461908ae274981ac1e2a1b9f3f7cce8966e039b491b53b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ksu-0.2.1-py2.py3-none-any.whl
| Download URL | ksu-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a01c75719d9eaca233c58314d49d8dd2c71e78f01050bba9dc76352928984b5e
|
|
BLAKE2b-256 checksum How to use checksums |
162c985d37304c14e2f42455846c20c13e9c845600b18d39262143a7470d58fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |