npms-io / npms-analyzer

The analyzer behind https://npms.io
MIT License
319 stars 38 forks source link

[Question] why weighted mean are not equal to 1 #162

Closed Kikobeats closed 7 years ago

Kikobeats commented 7 years ago

Hey,

I was reviewing how do you calculate the score value.

I want to comment weights in this piece of code: https://github.com/npms-io/npms-analyzer/blob/master/lib/scoring/score.js#L30

- scoreQuality → 7-7-4-2
- scorePopularity → 2-2-1-2
- scoreMaintenance → 2-1-1-2

What is the criteria for assign those weights? I don't understand why you no assign weights base in a 0 to 1 interval, where sum all weights is equal to 1.

For example:

- scoreQuality  → 0.35 - 0.35 - 0.2 - 0.1 (=1)
satazor commented 7 years ago

Those values are actually translated into values between 0-1 in which the sum is equal to 1. The reason to use weights is that it's easier to manipulate.. for instance, if we want to add a new aspect, we don't need to change all the values..