emel v0.1.1 Ml.NaiveBayes View Source
A simple probabilistic classifier based on applying Bayes’ theorem with naive independence assumptions between the features. It makes classifications using the maximum posteriori decision rule in a Bayesian setting.
Link to this section Summary
Functions
Returns the function that classifies an item by using the Naive Bayes Algorithm
Link to this section Functions
Returns the function that classifies an item by using the Naive Bayes Algorithm.
Examples
iex> f = Ml.NaiveBayes.classifier([
...> %{outlook: "Sunny", temperature: "Hot", humidity: "High", wind: "Weak", decision: "No"},
...> %{outlook: "Sunny", temperature: "Hot", humidity: "High", wind: "Strong", decision: "No"},
...> %{outlook: "Overcast", temperature: "Hot", humidity: "High", wind: "Weak", decision: "Yes"},
...> %{outlook: "Rain", temperature: "Mild", humidity: "High", wind: "Weak", decision: "Yes"},
...> %{outlook: "Rain", temperature: "Cool", humidity: "Normal", wind: "Weak", decision: "Yes"},
...> %{outlook: "Rain", temperature: "Cool", humidity: "Normal", wind: "Strong", decision: "No"},
...> %{outlook: "Overcast", temperature: "Cool", humidity: "Normal", wind: "Strong", decision: "Yes"},
...> %{outlook: "Sunny", temperature: "Mild", humidity: "High", wind: "Weak", decision: "No"},
...> %{outlook: "Sunny", temperature: "Cool", humidity: "Normal", wind: "Weak", decision: "Yes"},
...> %{outlook: "Rain", temperature: "Mild", humidity: "Normal", wind: "Weak", decision: "Yes"},
...> %{outlook: "Sunny", temperature: "Mild", humidity: "Normal", wind: "Strong", decision: "Yes"},
...> %{outlook: "Overcast", temperature: "Mild", humidity: "High", wind: "Strong", decision: "Yes"},
...> %{outlook: "Overcast", temperature: "Hot", humidity: "Normal", wind: "Weak", decision: "Yes"},
...> %{outlook: "Rain", temperature: "Mild", humidity: "High", wind: "Strong", decision: "No"}
...> ], [:outlook, :temperature, :humidity, :wind], :decision)
...> f.(%{outlook: "Sunny", temperature: "Mild", humidity: "Normal", wind: "Strong"})
"Yes"
Link to this function
combined_posterior_probability(observations, values_by_attribute_B_map, attribute_A, value_A)
View Source
Link to this function
probability_B_given_A(observations, attribute_B, value_B, attribute_A, value_A)
View Source