{"id":16804921,"url":"https://github.com/cookpete/soccer-predictor","last_synced_at":"2025-07-30T06:08:20.093Z","repository":{"id":56853504,"uuid":"89616940","full_name":"cookpete/soccer-predictor","owner":"cookpete","description":"A JS library that predicts soccer match outcomes using basic mathematics","archived":false,"fork":false,"pushed_at":"2017-09-27T08:30:11.000Z","size":84,"stargazers_count":29,"open_issues_count":1,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-06T04:07:25.583Z","etag":null,"topics":["football","poisson","prediction","probability","soccer"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cookpete.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-27T16:14:56.000Z","updated_at":"2025-04-23T00:55:46.000Z","dependencies_parsed_at":"2022-09-13T21:11:56.714Z","dependency_job_id":null,"html_url":"https://github.com/cookpete/soccer-predictor","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cookpete/soccer-predictor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fsoccer-predictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fsoccer-predictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fsoccer-predictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fsoccer-predictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cookpete","download_url":"https://codeload.github.com/cookpete/soccer-predictor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fsoccer-predictor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267820859,"owners_count":24149291,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["football","poisson","prediction","probability","soccer"],"created_at":"2024-10-13T09:46:30.949Z","updated_at":"2025-07-30T06:08:20.050Z","avatar_url":"https://github.com/cookpete.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Soccer Predictor\n\n[![Latest npm version](https://img.shields.io/npm/v/soccer-predictor.svg)](https://www.npmjs.com/package/soccer-predictor)\n[![Build Status](https://img.shields.io/travis/CookPete/soccer-predictor/master.svg)](https://travis-ci.org/CookPete/soccer-predictor)\n[![Dependency Status](https://img.shields.io/david/CookPete/soccer-predictor.svg)](https://david-dm.org/CookPete/soccer-predictor)\n[![devDependency Status](https://img.shields.io/david/dev/CookPete/soccer-predictor.svg)](https://david-dm.org/CookPete/soccer-predictor?type=dev)\n[![Test Coverage](https://img.shields.io/codecov/c/github/cookpete/soccer-predictor.svg)](https://codecov.io/gh/CookPete/soccer-predictor)\n\nA JS library that predicts soccer match outcomes using basic mathematics.\n\n## Installation\n\nUse [yarn](https://yarnpkg.com) or [npm](https://www.npmjs.com) to install.\n\n```shell\nyarn add soccer-predictor           # yarn\nnpm install soccer-predictor --save # npm\n```\n\n### Install locally\n\n```shell\ngit clone https://github.com/CookPete/soccer-predictor.git\ncd soccer-predictor\nyarn # or npm install\nnpm run build\n```\n\n### Testing locally\n\n```shell\nnpm test # Run tests\n```\n\n## Usage\n\n```js\nimport { analyseResults, calculateProbabilities } from 'soccer-predictor'\n\n// Some basic example data\nconst results = [\n  { homeTeam: 'Team A', awayTeam: 'Team B', homeGoals: 1, awayGoals: 0 },\n  { homeTeam: 'Team B', awayTeam: 'Team C', homeGoals: 2, awayGoals: 1 },\n  { homeTeam: 'Team C', awayTeam: 'Team A', homeGoals: 1, awayGoals: 3 }\n]\n\n// Function to map match data to soccer-predictor data\nfunction getMatchDetails (match) {\n  return {\n    homeTeamName: match.homeTeam,\n    awayTeamName: match.awayTeam,\n    homeGoals: match.homeGoals,\n    awayGoals: match.awayGoals\n  }\n}\n\n// Parse results into an array of teams with calculated stats\nconst teams = analyseResults(results, getMatchDetails)\n\n// Use calculateProbabilities to calculate the chance of\n// various outcomes of a match between two teams\nconst probabilities = calculateProbabilities(teams[0], teams[1])\n\nconsole.log(probabilities.result) // Probability of a home win, away win or draw\n// {\n//   home: 0.657541673613264,\n//   draw: 0.252533180170396,\n//   away: 0.089924594462736\n// }\n\nconsole.log(probabilities.scores[1][0]) // Probability of a 1-0 result\n// 0.2300324502673927\n\nconsole.log(probabilities.over['2.5']) // Probability of over 2.5 goals\n// 0.2895346409101279\n\nconsole.log(probabilities.btts.yes) // Probability of both teams to score\n// 0.2429353553660894\n\n```\n\nFor more examples, see [`examples`](./examples).\n\n## FAQ\n\n### How does it work?\n\nThere are plenty of articles available that go into depth about basic poisson prediction. Essentially the library parses a series of match results and provides functions to return a rough percentage likelyhood of various outcomes of a match between two teams.\n\nFurther reading:\n\n* https://plus.maths.org/content/understanding-uncertainty-football-crazy\n* http://opisthokonta.net/?p=296\n* https://www.sbo.net/strategy/football-prediction-model-poisson-distribution/\n\n### Isn’t it called football?\n\nYes, but `football-predictor` seems too ambigious. Everyone knows what [soccer](https://en.wikipedia.org/wiki/Soccer) is.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcookpete%2Fsoccer-predictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcookpete%2Fsoccer-predictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcookpete%2Fsoccer-predictor/lists"}