kSVMlib
Kernel SVM library based on sklearn and GPlib. Provides similar functionality to GPlib for SVMs.
Setup kSVMlib
-
Create and activate venv
python3 -m venv .env source .env/bin/activate
-
Upgrade pip
python -m pip install --upgrade pip
-
Install kSVMlib package
python -m pip install ksvmlib
Use kSVMlib
-
Import kSVMlib to use it in your python script.
import ksvmlib
-
Generate some random data.
import numpy as np data = {} data['X'] = np.vstack(( np.random.multivariate_normal([1, 1], [[1, 0], [0, 1]], 100), np.random.multivariate_normal([3, 3], [[1, 0], [0, 1]], 100) )) data['Y'] = np.vstack(( np.ones((100, 1)), np.zeros((100, 1)), )) validation = ksvmlib.vm.RandFold(fold_len=0.2, n_folds=1) train_set, test_set = validation.get_folds(data)[0]
-
Initialize the KSVM model and a metric to measure the results.
model = ksvmlib.KSVM(ksvmlib.ker.SquaredExponential()) accuracy = ksvmlib.me.Accuracy()
-
Fit the model to the data.
fitting_method = ksvmlib.fit.GridSearch( obj_fun=accuracy.fold_measure, max_fun_call=300 ) train_validation = ksvmlib.vm.RandFold(fold_len=0.2, n_folds=3) log = fitting_method.fit(model, train_validation.get_folds( train_set )) print("Fitting log: {}".format(log))
-
Finally plot the results.
print("Accuracy: {}".format(accuracy.measure(model, train_set, test_set))) ksvmlib.plot.kernel_sort_data(model, test_set)
-
There are more examples in examples/ directory. Check them out!
Develop kSVMlib
-
Update API documentation
source ./.env/bin/activate pip install Sphinx cd docs/ sphinx-apidoc -f -o ./ ../ksvmlib
Metadata
Release files for ksvmlib 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 | Provenance | Actions |
|---|---|---|---|---|
| ksvmlib-0.2.1.tar.gz | 28.9 kB | Without provenance | Details for ksvmlib-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ksvmlib-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for ksvmlib-0.2.1-py3-none-any.whl |
Total release size: 60.6 kB
Release files / ksvmlib-0.2.1.tar.gz
| Download URL | ksvmlib-0.2.1.tar.gz |
|---|---|
| Size | 28.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
611dd6789ee93cd24bf459baa2e1afcbca8529e008aa9a93a2ee45ce4e08d47c
|
|
BLAKE2b-256 checksum How to use checksums |
2b16739673c3fe91b7ee168d47482201ad2c99036e4b25ffd221bdbd531494f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / ksvmlib-0.2.1-py3-none-any.whl
| Download URL | ksvmlib-0.2.1-py3-none-any.whl |
|---|---|
| Size | 31.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa744e767fbb2f629790bbecbcfae0fe50d6d47b926924438f3020fd88637874
|
|
BLAKE2b-256 checksum How to use checksums |
3f7d5505a20ec1ac714913c3d3d83eac96bc6eb40ae2c659dbfb68e82f63bce5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for ksvmlib 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.