It's so common to use histograms in data science. Why not ?
And its just some code like this

{min, max} = enumerable |> Enum.min_max()

interval_size = max - min 

buckets = oṕts(:buckets_number)
bucket_size = interval_size / buckets  

enumerable 
|> Enum.frequencies_by(fn element -> trunc((element - min)/bucket_size) end)
|> Enum.map(fn {key, frequency} -> 
   bucket_min = (key*bucket_size) + min
  bucket_max = min(max,bucket_min + bucket_size)
   {{bucket_min, bucket_max}, frequency }
end)

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/176bfe73-effd-47d0-be85-2961c897a67en%40googlegroups.com.

Reply via email to