Adaptive Density Variance (ADV) Kernel — a locally-adaptive hybrid RBF×Polynomial kernel for scikit-learn SVMs
Project description
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
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adv_kernel-0.1.0.tar.gz.
File metadata
- Download URL: adv_kernel-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4922f97bab3bf71a058f66c42f7f1b30abd37e98e253e37191f42aab117c41d6
|
|
| MD5 |
c573e6aef40fbf9ad6286941aeade96d
|
|
| BLAKE2b-256 |
c474749fbb243a5ea62207dacb8da5ab2046b6c18be32910a7e930e7ff892060
|
Provenance
The following attestation bundles were made for adv_kernel-0.1.0.tar.gz:
Publisher:
ci.yml on InquietoPartho/adv_kernel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adv_kernel-0.1.0.tar.gz -
Subject digest:
4922f97bab3bf71a058f66c42f7f1b30abd37e98e253e37191f42aab117c41d6 - Sigstore transparency entry: 1581878602
- Sigstore integration time:
-
Permalink:
InquietoPartho/adv_kernel@f71406aa22c7a8372c914468eeadc67f0bb4bbb9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/InquietoPartho
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@f71406aa22c7a8372c914468eeadc67f0bb4bbb9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file adv_kernel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: adv_kernel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1954a322d0b65f18ac42983ff3e0590dd08f1da4cca51e8caca83ad4b33cdd0
|
|
| MD5 |
18ed6522a56601e78ac11fee88c498fd
|
|
| BLAKE2b-256 |
5b235cb16a8e9b2441224eb488c666ef2126bd0a1a13d2f858216263df70f6e7
|
Provenance
The following attestation bundles were made for adv_kernel-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on InquietoPartho/adv_kernel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adv_kernel-0.1.0-py3-none-any.whl -
Subject digest:
a1954a322d0b65f18ac42983ff3e0590dd08f1da4cca51e8caca83ad4b33cdd0 - Sigstore transparency entry: 1581878768
- Sigstore integration time:
-
Permalink:
InquietoPartho/adv_kernel@f71406aa22c7a8372c914468eeadc67f0bb4bbb9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/InquietoPartho
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@f71406aa22c7a8372c914468eeadc67f0bb4bbb9 -
Trigger Event:
push
-
Statement type: