ADV Kernel — Adaptive Density Variance Kernel
A scikit-learn compatible SVM kernel that adapts its bandwidth sample-by-sample using two complementary signals:
| Signal | Meaning |
|---|---|
| k-NN density | Sparse neighbourhood → wider kernel |
| Feature variance | High intra-sample heterogeneity → wider kernel |
The final kernel is a pointwise product of an adaptive RBF and a polynomial term:
K(xᵢ, xⱼ) = exp(−‖xᵢ−xⱼ‖² / 2σᵢσⱼ) × (1 + β⟨xᵢ,xⱼ⟩)^degree
Installation
pip install adv-kernel
Or directly from GitHub:
pip install git+https://github.com/InquietoPartho/adv_kernel.git
Quick start
from adv_kernel import ADVKernelSVC
clf = ADVKernelSVC(C=1.0, beta=0.5, degree=2, probability=True)
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
y_proba = clf.predict_proba(X_test)
Use kernel functions directly
from adv_kernel import adv_bandwidth, adv_kernel
sigma = adv_bandwidth(X, k=10, gamma_density=1.0, gamma_var=0.5)
K = adv_kernel(X, X, sigma, sigma, beta=0.5, degree=2)
scikit-learn GridSearchCV
from sklearn.model_selection import GridSearchCV
from adv_kernel import ADVKernelSVC
param_grid = {"C": [0.1, 1.0, 10.0], "beta": [0.2, 0.5], "gamma_density": [0.5, 1.0]}
gs = GridSearchCV(ADVKernelSVC(), param_grid, cv=5, n_jobs=-1)
gs.fit(X_train, y_train)
print(gs.best_params_)
API reference
adv_bandwidth(X, k=10, gamma_density=1.0, gamma_var=0.5)
Returns per-sample bandwidth array of shape (n_samples,).
adv_kernel(X, Y, sigma_X, sigma_Y, beta=0.5, degree=2)
Returns kernel matrix of shape (n_X, n_Y).
ADVKernelSVC parameters
| Parameter | Default | Description |
|---|---|---|
C |
1.0 |
SVM regularisation |
beta |
0.5 |
Polynomial scaling |
degree |
2 |
Polynomial degree |
k_bw |
10 |
k-NN neighbours for bandwidth |
gamma_density |
1.0 |
Density term weight |
gamma_var |
0.5 |
Variance term weight |
probability |
True |
Enable predict_proba |
License
MIT © Pijush Kanti Roy Partho
Release files for adv-kernel 0.1.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 | |
|---|---|---|---|
| adv_kernel-0.1.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| adv_kernel-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.4 kB
Release files / adv_kernel-0.1.0.tar.gz
| Download URL | adv_kernel-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4922f97bab3bf71a058f66c42f7f1b30abd37e98e253e37191f42aab117c41d6
|
|
BLAKE2b-256 checksum How to use checksums |
c474749fbb243a5ea62207dacb8da5ab2046b6c18be32910a7e930e7ff892060
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency logRelease files / adv_kernel-0.1.0-py3-none-any.whl
| Download URL | adv_kernel-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1954a322d0b65f18ac42983ff3e0590dd08f1da4cca51e8caca83ad4b33cdd0
|
|
BLAKE2b-256 checksum How to use checksums |
5b235cb16a8e9b2441224eb488c666ef2126bd0a1a13d2f858216263df70f6e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency log