Skip to content

Commit

Permalink
add back node 10 (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
philihp committed Feb 28, 2022
1 parent a9f1a44 commit fff7f92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
strategy:
matrix:
node-version:
- 10.x # deprecated
- 11.x # deprecated
- 12.x # maintainence ends 2022-04-30
- 13.x # deprecated
Expand Down
13 changes: 6 additions & 7 deletions src/predict-draw.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { flatten } from 'ramda'
import constants from './constants'
import util, { sum } from './util'
import { phiMajor, phiMajorInverse } from './statistics'
Expand All @@ -10,16 +11,15 @@ const predictWin = (teams, options = {}) => {
if (n === 0) return undefined
if (n === 1) return 1

const denom = (n * (n - 1)) / (n > 2 ? 1 : 2)
const teamRatings = teamRating(teams)
const drawMargin =
Math.sqrt(teams.flat().length) * BETA * phiMajorInverse((1 + 1 / n) / 2)

const denom = (n * (n - 1)) / (n > 2 ? 1 : 2)
Math.sqrt(flatten(teams).length) * BETA * phiMajorInverse((1 + 1 / n) / 2)

return (
Math.abs(
teamRatings
.map(([muA, sigmaSqA], i) =>
flatten(
teamRatings.map(([muA, sigmaSqA], i) =>
teamRatings
.filter((_, q) => i !== q)
.map(([muB, sigmaSqB]) => {
Expand All @@ -32,8 +32,7 @@ const predictWin = (teams, options = {}) => {
)
})
)
.flat()
.reduce(sum, 0)
).reduce(sum, 0)
) / denom
)
}
Expand Down

0 comments on commit fff7f92

Please sign in to comment.