Simple Bayes v1.0.0 SimpleBayes.Accumulator
Link to this section Summary
Functions
Accumulates the values from the map
Accumulates the number of maps containing the specified key
Accumulates the values of the given keys from the map
Link to this section Functions
Link to this function
all(map)
Accumulates the values from the map.
Examples
iex> SimpleBayes.Accumulator.all(%{"nice" => 3, "cute" => 1, "cat" => 1, "dog" => 2})
7
iex> SimpleBayes.Accumulator.all(%{"nice" => 3.5, "cute" => 1, "cat" => 1, "dog" => 2.2})
7.7
iex> SimpleBayes.Accumulator.all(%{})
1
Link to this function
occurance(meta_map, key)
Accumulates the number of maps containing the specified key.
Examples
iex> SimpleBayes.Accumulator.occurance(%{
iex> {:cat, %{"nice" => 1, "cute" => 1, "cat" => 1}} => nil,
iex> {:dog, %{"nice" => 2, "dog" => 2}} => nil
iex> }, "cute")
1
iex> SimpleBayes.Accumulator.occurance(%{
iex> {:cat, %{"nice" => 1, "cute" => 1, "cat" => 1}} => nil,
iex> {:dog, %{"nice" => 2, "dog" => 2}} => nil
iex> }, "nice")
2
Link to this function
only(map, keys)
Accumulates the values of the given keys from the map.
Examples
iex> SimpleBayes.Accumulator.only(%{"nice" => 3, "cute" => 1, "cat" => 1, "dog" => 2}, ["nice", "cute"])
4
iex> SimpleBayes.Accumulator.only(%{"nice" => 3.5, "cute" => 1, "cat" => 1, "dog" => 2.2}, ["nice", "cute"])
4.5