Skip to content

Commit 124dfa9

Browse files
committed
Bring back different damping factors
1 parent 4e2849d commit 124dfa9

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/utils/mathematical-logic/index.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,22 @@ export const toFixedNumber = (num: number, digits: number) => {
3939
};
4040

4141
const isRankingUseful = (ranking: number[]) => {
42-
// const numOfZeros = ranking.filter(
43-
// (score) => toFixedNumber(score, 3) <= 0.001,
44-
// ).length;
42+
const numOfZeros = ranking.filter(
43+
(score) => toFixedNumber(score, 3) <= 0.001,
44+
).length;
4545

46-
// if (numOfZeros > 0) return false;
46+
if (numOfZeros > 0) return false;
4747

48-
// const sortedRanking = [...ranking].sort();
48+
const sortedRanking = [...ranking].sort();
4949

50-
// let median = sortedRanking[Math.floor(sortedRanking.length / 2)];
51-
// if (sortedRanking.length % 2 === 0) {
52-
// median =
53-
// (median + sortedRanking[Math.floor(sortedRanking.length / 2) - 1]) / 2;
54-
// }
55-
// const max = sortedRanking[sortedRanking.length - 1];
50+
let median = sortedRanking[Math.floor(sortedRanking.length / 2)];
51+
if (sortedRanking.length % 2 === 0) {
52+
median =
53+
(median + sortedRanking[Math.floor(sortedRanking.length / 2) - 1]) / 2;
54+
}
55+
const max = sortedRanking[sortedRanking.length - 1];
5656

57-
// if (max / median > 10) return false;
57+
if (max / median > 10) return false;
5858

5959
return true;
6060
};
@@ -66,11 +66,11 @@ function cloneArray<T extends unknown[]>(a: T): T {
6666
}
6767

6868
export const getRankingForSetOfDampingFactors = (input: number[][]) => {
69-
const dampingFactors = [0.85];
70-
// const dampingFactors = [
71-
// 1, 0.95, 0.9, 0.85, 0.8, 0.75, 0.7, 0.65, 0.6, 0.55, 0.5, 0.45, 0.4, 0.35,
72-
// 0.3, 0.25, 0.2, 0.15, 0.1, 0.05, 0,
73-
// ];
69+
// const dampingFactors = [0.85];
70+
const dampingFactors = [
71+
1, 0.95, 0.9, 0.85, 0.8, 0.75, 0.7, 0.65, 0.6, 0.55, 0.5, 0.45, 0.4, 0.35,
72+
0.3, 0.25, 0.2, 0.15, 0.1, 0.05, 0,
73+
];
7474
// const dampingFactors = [
7575
// 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65,
7676
// 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1,

0 commit comments

Comments
 (0)