{"id":22411914,"url":"https://github.com/ambrad/kfgs","last_synced_at":"2025-06-14T07:35:09.736Z","repository":{"id":125314087,"uuid":"86535746","full_name":"ambrad/kfgs","owner":"ambrad","description":"Compute the gradient of the log likelihood function from a Kalman filter using the adjoint method.","archived":false,"fork":false,"pushed_at":"2021-05-04T18:10:32.000Z","size":338,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T03:13:07.041Z","etag":null,"topics":["adjoint","kalman-filter","matlab"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ambrad.png","metadata":{"files":{"readme":"readme.txt","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-29T03:45:51.000Z","updated_at":"2022-02-07T03:10:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"58c6cc45-244e-48c2-a75a-a5359b681556","html_url":"https://github.com/ambrad/kfgs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ambrad/kfgs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambrad%2Fkfgs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambrad%2Fkfgs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambrad%2Fkfgs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambrad%2Fkfgs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ambrad","download_url":"https://codeload.github.com/ambrad/kfgs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambrad%2Fkfgs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259777052,"owners_count":22909596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["adjoint","kalman-filter","matlab"],"created_at":"2024-12-05T13:16:14.330Z","updated_at":"2025-06-14T07:35:09.660Z","avatar_url":"https://github.com/ambrad.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"KFGS: Software to compute the\n      (K)alman (F)ilter, Likelihood (G)radient, and (S)moother\nVersion 0.4\nAndrew M. Bradley\nambrad@cs.stanford.edu\nCDFM, Geophysics, Stanford\n\nThis package provides:\n\n1. Pure Matlab routines to compute stably\n   a. the Kalman filter (KF),\n   b. the gradient of the log likelihood of the data in a time proportional to\n      the time to compute the KF, with a constant of about 1-2.\n   c. the same as (b), but with a constant of about 1-10 in practice and amount\n      of storage that is very small compared with the number of time steps.\n   c. the RTS smoother, with versions like (b) or (c).\n2. A mex wrapper to Andreas Griewank's checkpointing software REVOLVE.\n\nKFGS is licensed as follows:\nOpen Source Initiative OSI - Eclipse Public License 1.0\nhttp://www.opensource.org/licenses/eclipse-1.0\n\n\nMatlab Installation\n-------------------\nYou need an ANSI C compiler if you want to use the checkpointing version of the\ngradient calculation. The most basic mex setup possible should work. At the\ncommand line, type \"make\":\n    \u003e\u003e make\n\n\nUsage\n-----\nSee ex.m for an example of usage. The primary public functions are\n    kf_loglik:           Kalman filter.\n    kf_loglik_grad:      Likelihood gradient using the adjoint method.\n    kf_loglik_grad_cp:   Same, but with checkpointing.\n    kf_loglik_smooth:    RTS smoother.\n    kf_loglik_smooth_cp: Same, but with checkpointing.\n    kf_rcd('init'):      Initialize memory or disk recording for the gradient\n                         and smoother reoutines.\n\nThe checkpointing version of a function uses the mex file revolve.c. My\nexperience is that in general the non-checkpointing version with disk I/O is\nfaster than the checkpointing version using main memory but number of\ncheckpoints \u003c number of time steps. Hence I think the only reasons to use the\ncheckpointing version are (1) the amount of disk storage necessary is greater\nthan you have or (2) I/O is particularly slow relative to FLOPS and memory\naccess.\n  Example: Nstate = 600, Nobs = 200, Nt = 3650.\n1. kf_loglik_smooth_cp with a buffer equivalent to saving 100 states took 1613s.\n2. kf_loglik_smooth saving to disk a total of ~9.8G took 1162s.\n\nIf you use this software in research that you publish, I would appreciate your\nciting this software package as follows:\n\n    A. M. Bradley, \"KFGS: Software to Compute the Kalman Filter Likelihood\n    Gradient and Smoother\", 2012.\n\nEmail me (ambrad@cs.stanford.edu) if you want to receive an email when I release\na new version.\n\n\nImportant version changes\n-------------------------\n\n\nRelease log\n-----------\n0.0.  AMB. 28 May 2012. First release.\n0.1.  AMB.\n      - _cp and no _cp versions of gradient and smoother.\n      - kf_rcd for storage management.\n0.2.  AMB.\n      - using linsolve rather than \\ in a few places.\n0.3.  AMB.\n0.4.  AMB. More docs than 3, some cosmetics.\n\nTo do\n-----\n- A subset of the operations in kf_grad.m could take advantage of symmetry for a\n  2x reduction in work and memory. Not a big deal since these are O(N^2), not\n  O(N^3) operations.\n- I could generalize the gradient computation so multiple, rather than just one,\n  quantity's gradient can be found. This would let us implement the Segall \u0026\n  Matthews 97 trick of removing an overall scaling from the problem. That trick\n  requires accumulating two quantities and taking the log of one before summing\n  them. Only one quantity is accumulated for the standard likelihood function.\n- Hessian?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambrad%2Fkfgs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fambrad%2Fkfgs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambrad%2Fkfgs/lists"}