A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d5/d67/bayes__theorem_8cpp_source.html below:

TheAlgorithms/C++: probability/bayes_theorem.cpp Source File

Go to the documentation of this file. 1 10#include <iostream> 11 14double bayes_AgivenB

(

double

BgivenA,

double

A,

double

B) {

15 return

(BgivenA * A) / B;

16

}

17 20double bayes_BgivenA

(

double

AgivenB,

double

A,

double

B) {

21 return

(AgivenB * B) / A;

22

}

23 26int main

() {

27 double

A = 0.01;

28 double

B = 0.1;

29 double

BgivenA = 0.9;

30 double

AgivenB =

bayes_AgivenB

(BgivenA, A, B);

31

std::cout <<

"A given B = "

<< AgivenB << std::endl;

32

std::cout <<

"B given A = "

<<

bayes_BgivenA

(AgivenB, A, B) << std::endl;

33 return

0;

34

}

bayes_AgivenB

double bayes_AgivenB(double BgivenA, double A, double B)

Definition bayes_theorem.cpp:14 bayes_BgivenA

double bayes_BgivenA(double AgivenB, double A, double B)

Definition bayes_theorem.cpp:20 main

int main()

Definition bayes_theorem.cpp:26

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4