$ show FalkonML/falkon
Falkon is a Python library for large-scale kernel ridge regression and logistic regression, leveraging NystrΓΆm approximation and preconditioned conjugate gradient to scale to billions of points. It provides a scikit-learn-like API (fit/predict) with GPU acceleration via custom CUDA/cuBLAS/cuSOLVER kernels and optional KeOps integration for on-the-fly kernel-vector products. The library includes hyperparameter optimization through differentiable objectives (LOOCV, GCV, NystrΓΆm compression) with gradient-based solvers, out-of-core operations for GPU memory overflow, and sparse tensor support. Benchmark infrastructure compares Falkon against GPyTorch, GPflow, and EigenPro on datasets like Higgs, TIMIT, MillionSongs. The codebase is well-tested with CI/CD for CPU/GPU builds and pre-built wheels for multiple PyTorch/CUDA combinations. While the core library is production-grade, some benchmark scripts are one-off and a few modules have TODO comments or limited platform support (Linux-only, Windows untested).
The LLM identified 3 files worth highlighting for reuse:
Provides PropagatingThread, a minimal subclass of threading.Thread that catches exceptions in the target function and re-raises them on join(). This decouples thread execution from error handling and is a reusable pattern for any multi-threaded Python code where exceptions must be surfaced to the caller.
Contains jittering_cholesky, a function that attempts Cholesky decomposition with increasing jitter (noise added to diagonal) until success. This is a reusable numerical linear algebra utility for handling near-singular positive semidefinite matrices, common in kernel methods and Gaussian processes.
Defines memory_checker, a context manager that enforces CPU/GPU memory limits during test execution. It monitors memory usage and fails tests that exceed specified budgets. This pattern is reusable for any large-scale numerical library to prevent memory blowup in test suites.