Skip to main content

gkm: Generalized Kernel Method (deprecated)

DEPRECATED. gkm is no longer maintained; 0.1.2 is the final release. It is superseded by optimized-svm (documentation, repository), which provides KernelGLMRegressor and OptimizedKernelGLMRegressor from version 0.4.0. See the theory page https://wotzlaff.github.io/optimized-svm/theory/glm/ and the migration table below. import gkm emits a DeprecationWarning.

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 is 0.5 * <a, K a>/lmbda + mean(loss)), optimized-svm does not, so lambda differs by a factor of n.
  • No counterpart: regularization.penalize_gamma, the AMSGrad optimizer (minimize_method='amsgrad'), the links module, and glm.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__ ignores idx1/idx2 and always returns the full kernel matrix (gkm/kernel/rbf.py:34-36), so OptimizedGKM(sample_objective < 1) with kernel_type='rbf' fails.
  • RBF.compute overwrites the stored training distance matrix _dsqr (gkm/kernel/rbf.py:41), so deriv returns wrong values after predict.
  • GKM(kernel_type='multi-rbf') raises at construction: get_initial needs dim, which needs prepare to 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**t instead of beta as decay factor and there is no bias correction (gkm/amsgrad.py:46).
  • glm.GLM prints debug output (gkm/glm.py:54) and fit returns None instead of self.

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)

Source distribution for gkm 0.1.2
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)

Table of built distributions (wheels) for gkm 0.1.2
File Interpreter ABI Platform Actions
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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page