Documentation ¶
Overview ¶
Package theorem is an Bayes' theorem implementation.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bayes ¶
Bayes returns the probability from the given probability based on Bayes' theorem.
Example ¶
package main import ( "fmt" "github.com/KEINOS/go-bayes/pkg/theorem" ) func main() { // Validation of figures // Bayes' theorem x := 0.3 * 0.4 y := x + (1.-0.3)*0.5 expect := x / y // Prior probability to be B. PriorProbToB := 0.3 // Prior probability to be B if the previous was A. PriorProbFromAtoB := 0.4 // Prior probability not to be B if the previous was A. PriorProbNotFromAtoB := 0.5 actual := theorem.Bayes(PriorProbToB, PriorProbFromAtoB, PriorProbNotFromAtoB) if expect == actual { fmt.Println("OK") } }
Output: OK
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.