{"id":19876711,"url":"https://github.com/dirktoewe/gaupros","last_synced_at":"2025-06-25T17:03:59.041Z","repository":{"id":176082574,"uuid":"171298307","full_name":"DirkToewe/gaupros","owner":"DirkToewe","description":"Gaussian Processes in Scala(JS)","archived":false,"fork":false,"pushed_at":"2019-02-20T21:52:55.000Z","size":153,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T05:35:08.501Z","etag":null,"topics":["gaussian-processes","machine-learning","regression","scala","stochastic-processes"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DirkToewe.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-18T14:25:11.000Z","updated_at":"2019-02-20T21:52:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"1d256ac1-6a55-485d-a031-3e417924e996","html_url":"https://github.com/DirkToewe/gaupros","commit_stats":null,"previous_names":["dirktoewe/gaupros"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgaupros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgaupros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgaupros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DirkToewe%2Fgaupros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DirkToewe","download_url":"https://codeload.github.com/DirkToewe/gaupros/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241304294,"owners_count":19941101,"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":["gaussian-processes","machine-learning","regression","scala","stochastic-processes"],"created_at":"2024-11-12T16:34:00.049Z","updated_at":"2025-03-01T01:42:47.921Z","avatar_url":"https://github.com/DirkToewe.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\nGauProS is a lightweight, memory-friendly implementation of Gaussian Processes for Scala and ScalaJS.\nAside from the Scala Standard Library there are no deployment dependencies, particularly no native\ndependencies. An interactive example of `GauProS` running in the Browser can be found [here](\n  https://dirktoewe.github.io/gaupros_sandbox/gaupros_sandbox-0.1.0.html#QxfmC0GxF/xDsMFRP/MzM0JrYVZCRryQQ/GDQkK0bpBDc8HQQs6U2UNlX/VDHjRsQy0nP0OXA35D3T8wQ6gCx0P2vh5DualsQ/Db50P1zkZDnnzoRAhN9UL+yH5EG+qsQtosf0Qp+NpDrDdoRCyWR0PAe3pEMdEjQ8w/50RJBlBEBS1qREJ8vkQOqBhEbkmrQ4b0DURqCdlDlf1DRHphxkO2BcNEhYaxQ50uMUSKl7VDiOof\n).\n\n# GP without Hyperparameters\nThe Kernel function is a functional trait of type `(xi: A, xj: A) =\u003e Double`. If the Kernel only has fixed/known\nhyperparameters, it can simply be instantiated using a lambda expression.\n\n```scala\nimport gps.regression._\n\n// SOURCE: https://data.bls.gov/timeseries/APU0000711211\nval banana_prices = Vec(\n  0.629, 0.641, 0.634, 0.629, 0.622, 0.617, 0.616, 0.611, 0.605, 0.598, 0.561, 0.571, 0.586, 0.587, 0.575, 0.580, 0.571, 0.577, 0.583, 0.576, 0.573, 0.580, 0.581, 0.587,\n  0.596, 0.625, 0.621, 0.621, 0.617, 0.614, 0.611, 0.606, 0.607, 0.607, 0.598, 0.599, 0.604, 0.603, 0.607, 0.603, 0.599, 0.605, 0.604, 0.595, 0.597, 0.602, 0.600, 0.606,\n  0.609, 0.611, 0.609, 0.597, 0.603, 0.603, 0.602, 0.595, 0.601, 0.586, 0.587, 0.592, 0.595, 0.599, 0.597, 0.597, 0.603, 0.607, 0.606, 0.608, 0.606, 0.582, 0.592, 0.585,\n  0.583, 0.591, 0.593, 0.597, 0.582, 0.574, 0.581, 0.580, 0.580, 0.577, 0.575, 0.580, 0.581, 0.573, 0.586, 0.574, 0.570, 0.569, 0.567, 0.562, 0.575, 0.570, 0.573, 0.576,\n  0.573, 0.573, 0.571, 0.571, 0.564, 0.572, 0.565, 0.561, 0.544, 0.548, 0.551, 0.558, 0.568, 0.574, 0.582, 0.578, 0.575, 0.575, 0.575, 0.569, 0.573, 0.574, 0.566, 0.577,\n  0.576\n)\nval months = Array.tabulate(banana_prices.length)(-banana_prices.length + 1.0 + _)\n\nval σ_f = 1.0 / 64\nval l   = 1.0\nval mean_price = banana_prices.sum / banana_prices.length\nval kernel: Kernel[Double] = (xi,xj) =\u003e σ_f*σ_f * Math.exp( -(xi-xj)*(xi-xj) / (2*l*l) )\n\nval gpr = GPR( x=months, y=banana_prices, y_shift=mean_price, kernel=kernel )\n\ngps.regression.gpr.plot1d(gpr, Vec(months: _*), banana_prices, marginAbs=0.5, marginRel=0.0)\n```\n\n# GP Regression with Hyperparameter Optimization\n`GauProS` allows the easy composition and training of kernels with hyperparameters.\nTrainable parameters are identified by a `Symbol`. `GauProS` uses an (un)boxed variant\nof a BFGS optimizer. Said optimizer does not yet support starting from the box borders.\nThe initial hyperparameter values have to be well inside and not on the boundary of\nthe box.\n\n```scala\n// http://www.gaussianprocess.org/gpml/chapters/RW2.pdf#page=13\nval kernel = Noise('σ_n * 'σ_n)  +  'σ_f * 'σ_f * Exp( - AbsDelta.pow(2.0) / (2 * 'l * 'l) )\n\nval gpr = GPR.fit_shifted(\n  x=months       ,\n  y=banana_prices,\n  y_shift = 'y_shift,\n  kernel=kernel,\n  likelihood_fn = GPR.logp_loo[Double], // \u003c- The loss/likelihood function used for optimization.\n                                        //    Built-in: GPR.logp_marginal and GPR.logp_loo\n  param_init = Map(\n    'σ_n -\u003e 1,\n    'σ_f -\u003e 1,\n    'l -\u003e 4\n  ),\n  param_min = Map.empty[Symbol,Double] withDefaultValue Double.NegativeInfinity,\n  param_max = Map.empty[Symbol,Double] withDefaultValue Double.PositiveInfinity\n)\nprintln(gpr.params) // \u003c- the trained hyperparameter values\n\ngps.regression.gpr.plot1d(gpr, Vec(months: _*), banana_prices, marginAbs=0.5, marginRel=0.0)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirktoewe%2Fgaupros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdirktoewe%2Fgaupros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirktoewe%2Fgaupros/lists"}