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.0
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.0.tar.gz | 11.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ksu-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 25.8 kB
Release files / ksu-0.2.0.tar.gz
| Download URL | ksu-0.2.0.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
813b483c84ab0369cf96492d053685ca22e247bef0ee7c83df1b8c460c27ae59
|
|
BLAKE2b-256 checksum How to use checksums |
8ad10822690c3eff4275904ada9a34a1b37e0cc0d6ab62194de5b7f9cc68be41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ksu-0.2.0-py2.py3-none-any.whl
| Download URL | ksu-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2f151577254d1fff452a0f54fff38832a016f0918c6845c01013d075c39c941a
|
|
BLAKE2b-256 checksum How to use checksums |
ba8040a7b13f75e478de68dd18d2909126f98d98bb797109b26fad272c8c39b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |