gkm: Generalized Kernel Method (deprecated)
DEPRECATED.
gkmis no longer maintained; 0.1.2 is the final release. It is superseded byoptimized-svm(documentation, repository), which providesKernelGLMRegressorandOptimizedKernelGLMRegressorfrom version 0.4.0. See the theory page https://wotzlaff.github.io/optimized-svm/theory/glm/ and the migration table below.import gkmemits aDeprecationWarning.
What gkm was
gkm connected generalized linear models (GLMs)
with kernel methods:
- kernel machines whose loss is the deviance of an exponential-family distribution (Gaussian, Poisson, binomial, negative binomial, exponential),
- training by Newton's method with line search (
GKM), - hyperparameter tuning (regularization
lmbda, RBF kernel width(s)gamma) by gradient descent on a K-fold cross-validation objective (relative deviance), where the hypergradient is computed with an adjoint ("sensitivity") approach instead of differentiating through the solver (OptimizedGKM).
Migration to optimized-svm
| gkm | optimized-svm (>= 0.4.0) |
|---|---|
GKM |
KernelGLMRegressor |
OptimizedGKM |
OptimizedKernelGLMRegressor |
deviance.gaussian |
SmoothSVR / OptimizedSVR with loss="squared" (identity link) |
deviance.poisson |
family="poisson" |
deviance.Binomial |
family="binomial" (logit link) |
deviance.NegativeBinomial (geometric) |
family="negative_binomial" |
deviance.exponential |
family="gamma" (the exponential distribution is the gamma family with shape 1) |
Notes:
- Links. In gkm the negative binomial and exponential deviances use the
canonical link, so the linear predictor satisfies
t < 0. optimized-svm uses log links (logit for binomial). Fitted models are therefore not parameter-compatible; refit instead of converting. - Scaling of lambda. gkm weights the loss by
1/n(the objective is0.5 * <a, K a>/lmbda + mean(loss)), optimized-svm does not, solambdadiffers by a factor ofn. - No counterpart:
regularization.penalize_gamma, the AMSGrad optimizer (minimize_method='amsgrad'), thelinksmodule, andglm.GLM(linear GLM without kernel). - optimized-svm additionally supports the tweedie family, offsets/exposure and a hypergradient-tuned negative binomial dispersion.
Known issues (will not be fixed)
RBF.__call__ignoresidx1/idx2and always returns the full kernel matrix (gkm/kernel/rbf.py:34-36), soOptimizedGKM(sample_objective < 1)withkernel_type='rbf'fails.RBF.computeoverwrites the stored training distance matrix_dsqr(gkm/kernel/rbf.py:41), soderivreturns wrong values afterpredict.GKM(kernel_type='multi-rbf')raises at construction:get_initialneedsdim, which needsprepareto have been called (gkm/gkm.py:29,gkm/kernel/multi_rbf.py:34-35).- The AMSGrad step is not a correct AMSGrad: the first moment uses
beta**tinstead ofbetaas decay factor and there is no bias correction (gkm/amsgrad.py:46). glm.GLMprints debug output (gkm/glm.py:54) andfitreturnsNoneinstead ofself.
License
MIT
Metadata
Release files for gkm 0.1.2
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 |
|---|---|---|---|---|
| gkm-0.1.2.tar.gz | 17.4 kB | Without provenance | Details for gkm-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gkm-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for gkm-0.1.2-py3-none-any.whl |
Total release size: 37.5 kB
Release files / gkm-0.1.2.tar.gz
| Download URL | gkm-0.1.2.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51a360acf774836b6588e8a84c742ac6e2c1b7e157ba88887c7b27afac8fceb2
|
|
BLAKE2b-256 checksum How to use checksums |
096846804fd5413e4d529bf82a2280cf4b0eebd59bea2dd173b9560f8ebf60b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / gkm-0.1.2-py3-none-any.whl
| Download URL | gkm-0.1.2-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f545f88dfb445d8af04382f86da391e03de48b6947cbe23353ee2abbb8bc619d
|
|
BLAKE2b-256 checksum How to use checksums |
a1382102bf9876f17c27d23249747cd906f1ff0332c8cc639c6437c06079efc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for gkm 0.1.2
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.