You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The statistical mode is a very common metric for data and very useful with nominal/categorical data. For example, say a table is of days with categories ["Sunny", "Cloudy", "Rainy"] -- knowing most days are "Rainy" is more useful than using unique() and knowing that the weather can be those categories.
A rough implementation of one can be seen below. The reason for the weird Array.from(counts).find(...) is that most implementations of mode from what I can tell tend to prefer finding the first element with the maximum count when there is a tie. I am open to other implementations if this isn't a concern.
The statistical mode is a very common metric for data and very useful with nominal/categorical data. For example, say a table is of days with categories
["Sunny", "Cloudy", "Rainy"]
-- knowing most days are"Rainy"
is more useful than usingunique()
and knowing that the weather can be those categories.A rough implementation of one can be seen below. The reason for the weird
Array.from(counts).find(...)
is that most implementations ofmode
from what I can tell tend to prefer finding the first element with the maximum count when there is a tie. I am open to other implementations if this isn't a concern.And here is a StackBlitz implementation showing it passes unit tests.
The text was updated successfully, but these errors were encountered: