-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add tsconfig * update package libs * rename everything to *.ts * add jest types * tell eslint about typescript * fix issue where eslint doesnt resolve ty pescript * eslint lets you have unused _vars * the fun part of typescript migration * fix build * have jest ask babel to transpile typescript before running tests * no tsx files * pin eslint typescript import resolver module * remove support for node 15 * allow esmodules
- Loading branch information
Showing
51 changed files
with
199 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"presets": ["@babel/preset-env"] | ||
"presets": [ | ||
["@babel/preset-env", {"targets": {"node": "current"}}], | ||
"@babel/preset-typescript" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ benchmark/* | |
.husky/ | ||
CONTRIBUTING.md | ||
.editorconfig | ||
tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Options } from './types' | ||
|
||
export const z = (options: Options) => options?.z ?? 3 | ||
export const mu = (options: Options) => options?.mu ?? 25 | ||
export const sigma = (options: Options) => | ||
options?.sigma ?? mu(options) / z(options) | ||
|
||
export const epsilon = (options: Options) => options?.epsilon ?? 0.0001 | ||
export const beta = (options: Options) => options?.beta ?? sigma(options) / 2 | ||
export const betaSq = (options: Options) => beta(options) ** 2 | ||
|
||
export default (options: Options) => ({ | ||
EPSILON: epsilon(options), | ||
TWOBETASQ: 2 * betaSq(options), | ||
BETA: beta(options), | ||
BETASQ: betaSq(options), | ||
Z: z(options), | ||
}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion
3
src/models/bradley-terry-full.js → src/models/bradley-terry-full.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/models/bradley-terry-part.js → src/models/bradley-terry-part.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/models/thurstone-mosteller-full.js → src/models/thurstone-mosteller-full.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import constants from './constants' | ||
import { Rating, Options } from './types' | ||
|
||
const ordinal = (rating: Rating, options: Options = {}) => { | ||
const { sigma, mu } = rating | ||
const { Z } = constants(options) | ||
return mu - Z * sigma | ||
} | ||
|
||
export default ordinal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { mu as defaultMu, sigma as defaultSigma } from './constants' | ||
import { Rating } from './types' | ||
|
||
const rating = (init?: Rating, options = {}) => ({ | ||
mu: init?.mu ?? defaultMu(options), | ||
sigma: init?.sigma ?? defaultSigma({ ...options, mu: init?.mu }), | ||
}) | ||
|
||
export default rating |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export type Rating = { | ||
mu: number | ||
sigma: number | ||
} | ||
|
||
export type Model = | ||
| 'thurstoneMostellerPart' | ||
| 'thurstoneMostellerFull' | ||
| 'bradleyTerryPart' | ||
| 'bradleyTerryFull' | ||
| 'plackettLuce' | ||
|
||
export type Options = { | ||
z?: number | ||
mu?: number | ||
sigma?: number | ||
epsilon?: number | ||
gamma?: number | ||
beta?: number | ||
model?: Model | ||
rank?: number[] | ||
score?: number[] | ||
tau?: number | ||
preventSigmaIncrease?: boolean | ||
} |
Oops, something went wrong.