{"id":16513005,"url":"https://github.com/lckr/pykrlst","last_synced_at":"2026-03-13T19:05:27.252Z","repository":{"id":49374650,"uuid":"293843167","full_name":"lckr/PyKRLST","owner":"lckr","description":"Kernel Recursive Least Squares Tracker in Python","archived":false,"fork":false,"pushed_at":"2020-09-10T20:54:36.000Z","size":323,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T04:37:35.294Z","etag":null,"topics":["gaussian-processes","krls","numpy","online-gaussian-process","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lckr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-08T14:57:26.000Z","updated_at":"2024-12-25T03:15:01.000Z","dependencies_parsed_at":"2022-08-25T08:02:09.994Z","dependency_job_id":null,"html_url":"https://github.com/lckr/PyKRLST","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lckr/PyKRLST","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lckr%2FPyKRLST","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lckr%2FPyKRLST/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lckr%2FPyKRLST/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lckr%2FPyKRLST/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lckr","download_url":"https://codeload.github.com/lckr/PyKRLST/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lckr%2FPyKRLST/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30472989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T17:15:31.527Z","status":"ssl_error","status_checked_at":"2026-03-13T17:15:22.394Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gaussian-processes","krls","numpy","online-gaussian-process","python"],"created_at":"2024-10-11T16:06:55.560Z","updated_at":"2026-03-13T19:05:27.208Z","avatar_url":"https://github.com/lckr.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyKRLST\nPython implementation of the Kernel Recursive Least Squares Tracker (KRLS-T) by S. Van Vaerenbergh, M. Lazaro-Gredilla, and I. Santamaria.T\n\n## Details\nThis library is a python port of the Matlab implementation of the KRLS-T which is part of the [Kernel Methods Tools](https://github.com/steven2358/kmbox) by Steven Van Vaerenbergh.\n\n## Usage\n\n```python\n    import pyKRLST\n    import numpy as np\n    import matplotlib.pyplot as plt\n    from sklearn.gaussian_process.kernels import RBF\n\n    def f(x):\n        \"\"\"The function to predict.\"\"\"\n        return x * np.sin(x)\n\n    # Observations\n    X = np.atleast_2d([1.0, 3.0, 5.0, 6.0, 7.0, 8.0]).T\n    y = f(X).ravel()\n\n    x = np.atleast_2d(np.linspace(0, 10, 1000)).T\n\n    kernel = RBF(10, (1e-2, 1e2))   # Kernel    \n    M = 4                           # Dictionary budget\n    lambda_ = 0.99                  # Forgetting factor\n    c = 1e-5                        # Noise-to-signal ratio (used for regulariation)\n    mode = \"B2P\"                    # Forget mode\n    krlst = KRLST(kernel=kernel,\n                  l=lambda_, \n                  c=c,\n                  M=M,\n                  forgetmode=mode)\n\n    # Train in online fashion using at most four basis elements\n    for t, a, b in zip(np.arange(10), X, y):\n        krlst.observe(a, b, t)\n\n    # Predict for unknown data\n    y_pred, y_std = krlst.predict(x)\n\n    plt.figure(figsize=(10,5))\n    plt.plot(x, f(x), 'r:', label=r'$f(x) = x\\,\\sin(x)$')\n    plt.plot(krlst.Xb, krlst.mu, 'k.', markersize=20, marker=\"*\",label=\"Dictionary Elements\")\n    plt.plot(X, y, 'r.', markersize=15, label='Observations')\n    plt.plot(x, y_pred, 'b-', label='Prediction')\n    plt.fill(np.concatenate([x, x[::-1]]),\n             np.concatenate([y_pred - 1.9600 * y_std,\n                            (y_pred + 1.9600 * y_std)[::-1]]),\n             alpha=.25, fc='b', ec='None', label='95% confidence interval')\n    plt.xlabel('$x$')\n    plt.ylabel('$f(x)$')\n    plt.ylim(-10, 20)\n    plt.legend(loc='upper left')\n    plt.show()\n\n```\n![](plot.png)\n\n\nPlease also refer to the `PyKRLST_demo.ipynb` notebook.\n\n**Note**: This KRLS-T implementation uses `sklearn.gaussian_process.kernel.Kernel` objects to compute the covariances between the data point. This allows the usage of custom kernels that satisfy the `Kernel` interface.  \nNote that this libary only uses a subset of the exposed methods of a `Kernel`object, namely the `__call__()` method. Therefore, the KRLS-T will **not** optimize any kernel parameters.\n\n## References:\n- Van Vaerenbergh, Steven, Miguel Lázaro-Gredilla, and Ignacio Santamaría. \"Kernel recursive least-squares tracker for time-varying regression.\" IEEE transactions on neural networks and learning systems 23.8 (2012): 1313-1326\n- Lázaro-Gredilla, Miguel, Steven Van Vaerenbergh, and Ignacio Santamaría. \"A Bayesian approach to tracking with kernel recursive least-squares.\" 2011 IEEE International Workshop on Machine Learning for Signal Processing. IEEE, 2011.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flckr%2Fpykrlst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flckr%2Fpykrlst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flckr%2Fpykrlst/lists"}