Skip to content

Commit

Permalink
fix: remove percentile exclusion from gini coefficient
Browse files Browse the repository at this point in the history
  • Loading branch information
thearyadev committed Dec 29, 2024
1 parent 49cb163 commit 7517a70
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions frontend/app/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ export function calculateStandardDeviation(numbers: number[]): number {
}

export function calculateGiniCoefficient(numbers: number[]): number {
const x_us = numbers.sort((a, b) => a - b);
const n = x_us.length;
// removing percentile slice for now.
// const x_us = numbers.sort((a, b) => a - b);
// const n = x_us.length;

const percentileIndex = Math.floor(n * 0.1);
const x = x_us.slice(percentileIndex);
// const percentileIndex = Math.floor(n * 0.1);
// const x = x_us.slice(percentileIndex);

const x = numbers.sort((a, b) => a - b);
const n = x.length;

if (n === 0) return 0;

Expand Down

0 comments on commit 7517a70

Please sign in to comment.