{"id":26207245,"url":"https://github.com/oelin/surprisal","last_synced_at":"2026-04-22T11:06:03.803Z","repository":{"id":65670467,"uuid":"597000002","full_name":"oelin/surprisal","owner":"oelin","description":"Compute the surprisal of an event given its probability.","archived":false,"fork":false,"pushed_at":"2023-02-03T13:57:58.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-26T22:49:25.086Z","etag":null,"topics":["probability","statistics","suprisal"],"latest_commit_sha":null,"homepage":"https://npmjs.com/surprisal","language":"JavaScript","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/oelin.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":"2023-02-03T12:02:15.000Z","updated_at":"2023-02-03T13:58:58.000Z","dependencies_parsed_at":"2023-02-18T07:45:27.089Z","dependency_job_id":null,"html_url":"https://github.com/oelin/surprisal","commit_stats":null,"previous_names":["oelin/suprisal"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/oelin/surprisal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oelin%2Fsurprisal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oelin%2Fsurprisal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oelin%2Fsurprisal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oelin%2Fsurprisal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oelin","download_url":"https://codeload.github.com/oelin/surprisal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oelin%2Fsurprisal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32132976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T08:34:57.708Z","status":"ssl_error","status_checked_at":"2026-04-22T08:34:55.583Z","response_time":58,"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":["probability","statistics","suprisal"],"created_at":"2025-03-12T05:31:27.217Z","updated_at":"2026-04-22T11:06:03.785Z","avatar_url":"https://github.com/oelin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# surprisal\n\nCompute the surprisal of an event given its probability.\n\n\n## Installation\n\n```sh\nnpm i surprisal\n```\n\n\n## Usage\n\n```js\nimport surprisal from 'surprisal'\n\nsurprisal(0.5) // returns 1.0\n\nsurprisal(1.0) // returns 0.0\n\nsurprisal(0.0) // returns Infinity\n```\n\nSuprisal is given in bits (base 2) by default, however you can also specify other bases via the second argument. For example, to compute surprisal in nats (base 10):\n\n```js\nsurprisal(0.5, base=10) // returns 0.301\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foelin%2Fsurprisal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foelin%2Fsurprisal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foelin%2Fsurprisal/lists"}