cnumr / GreenIT-Analysis

GreenIT-Analysis
GNU Affero General Public License v3.0
147 stars 32 forks source link

Issue? Current implementation gives EcoIndex between -5 and 94 instead of 0 to 99 #61

Closed Olivier-Descout closed 1 year ago

Olivier-Descout commented 1 year ago

Hi, I suspect there is an issue (or an inconsistency against the Ecoindex specification) in the current EcoIndex implementation located in the file ecoIndex.js.

As it is currently computed, EcoIndex value is between -5 and 94 rather than between 0 and 99 :

Rachel Pellin's EcoIndex simulator (https://rachelwe.github.io/Simulateur-ecoindex/), which uses ecoIndex.js current implementation, helps highligting this behaviour:

In my opinion, the issue lies in the calculateIndex function, which should return: return ((i - 1) + (value - quantiles[i - 1]) / (quantiles[i] - quantiles[i - 1])); and return quantiles.length - 1; instead of: return (i + (value - quantiles[i - 1]) / (quantiles[i] - quantiles[i - 1])); and return quantiles.length;

If such a change were to be made, the grade computation would obviously have to be also altered, by adding 5 to every threshold: case score >= 80: return 'A'; // instead of 75 case score >= 70: return 'B'; // instead of 65 ... case score >= 10: return 'F'; // instead of 5

Best Regards, Olivier Descout

didierfred commented 1 year ago

Yes you are right , following a pull request , i worked on a correction regarding this topic a year ago and never merged it : https://github.com/cnumr/GreenIT-Analysis/commit/350ca5a16df4102edbac1531160d31d5632b997b

I will have a look

bordage commented 1 year ago

Thanks Olivier (and Rachel) for this point. IT's obvious we should implent this patch asap. The good news is that this will have a negligeable side effect to already computed EcoIndex evaluation.

didierfred commented 1 year ago

The patch is integrated in release 3.1.0 available on chrome web store and firefox add ons

Olivier-Descout commented 1 year ago

Merci !

Le sam., sept. 10, 2022 à 18:04, @.***> a écrit:

The patch is integrated in release 3.1.0 available on chrome web store and firefox add ons

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>