Skip to content

Commit

Permalink
Bring back different damping factors
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahdigh committed Sep 29, 2024
1 parent 4e2849d commit 124dfa9
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/utils/mathematical-logic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ export const toFixedNumber = (num: number, digits: number) => {
};

const isRankingUseful = (ranking: number[]) => {
// const numOfZeros = ranking.filter(
// (score) => toFixedNumber(score, 3) <= 0.001,
// ).length;
const numOfZeros = ranking.filter(
(score) => toFixedNumber(score, 3) <= 0.001,
).length;

// if (numOfZeros > 0) return false;
if (numOfZeros > 0) return false;

// const sortedRanking = [...ranking].sort();
const sortedRanking = [...ranking].sort();

// let median = sortedRanking[Math.floor(sortedRanking.length / 2)];
// if (sortedRanking.length % 2 === 0) {
// median =
// (median + sortedRanking[Math.floor(sortedRanking.length / 2) - 1]) / 2;
// }
// const max = sortedRanking[sortedRanking.length - 1];
let median = sortedRanking[Math.floor(sortedRanking.length / 2)];
if (sortedRanking.length % 2 === 0) {
median =
(median + sortedRanking[Math.floor(sortedRanking.length / 2) - 1]) / 2;
}
const max = sortedRanking[sortedRanking.length - 1];

// if (max / median > 10) return false;
if (max / median > 10) return false;

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

export const getRankingForSetOfDampingFactors = (input: number[][]) => {
const dampingFactors = [0.85];
// const dampingFactors = [
// 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,
// 0.3, 0.25, 0.2, 0.15, 0.1, 0.05, 0,
// ];
// const dampingFactors = [0.85];
const dampingFactors = [
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,
0.3, 0.25, 0.2, 0.15, 0.1, 0.05, 0,
];
// const dampingFactors = [
// 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,
// 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1,
Expand Down

0 comments on commit 124dfa9

Please sign in to comment.