- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个仪器可以通过或失败一系列的三个测试。仪器必须通过所有三个测试才能被视为成功。我如何使用贝叶斯推理来查看基于证据的每个案例通过的概率? (基于依次通过每个过去测试的仪器)。
只看第一次测试 - 我从仪器测试的历史记录中了解到这一点。您还可以看到每个测试的接受范围为 -3% 到 +3%:
我的假设:
**P(H|D) = P(H) P(D|H) / P(D)** Where:
**P(D) = P(D|H)*P(H) + P(D|’H) P(‘H)**
P(H) = P('H) = 0.5 // prob of passing/failing test-A without any information
P(D|H) = 0.84 // prob of passing test-A from historical records
P('D|H) = 0.16 // prob of failing test-A from historical records
P(D) = P(D|H)*P(H) + P(D|’H) P(‘H) = 0.84*0.5 + 0.16*0.5
P(D) = 0.5
最佳答案
所以这里有几件事情需要考虑。首先,使用的先验概率分别为 0.5 和 0.5 是对的,因为这是我们对 进行数学编码的方式。不知道发生了什么,但是您正在显示彼此独立的三个图并编写只有一维的贝叶斯方程,这违反了您的依赖假设。此外,无需在此设置中使用边缘化 P(D) 来获得您所询问的条件概率。
考虑到它在测试 A 和/或测试 B 上的表现,您真正想要的是仪器通过测试 C 的条件概率
如果你只做过测试 A,那么贝叶斯说:
P(C|A) = P(A|C)P(C)/P(A) or P(B|A) = P(A|B)P(B)/P(A)
P(C|A,B) = P(A,B|C)P(C)/P(A,B)
What is my probability of passing the next test given that I have already passed or failed this test?
“Given that the instrument passed (or failed) test 1, what is the chance it will pass test 2 and test 3”
(Number of TestA Outcomes)* (Number of TestB Outcomes)* (Number of TestC Outcomes) = 2*2*2 = 8
In our approach, the number of times that any instrument previously tested passed test A, failed test B, and Passed Test C would be found in ProbabilityHistogram [1,0,1], passing all three would be found in ProbabilityHistogram [1,1,1], failing all three ProbabilityHistogram [0,0,0], etc.
//Define Probability Histogram
double[, ,] ProbHisto = new double[2, 2, 2];// [A Test Outcome, B Test Outcome, C Test Outcome]
//Update Histogram based on historical data.
//pass in how the instrument did on each test as one dataset
void updateProbHisto(bool APassed, bool BPassed, bool CPassed) {
ProbHisto[Convert.ToInt16(APassed), Convert.ToInt16(BPassed), Convert.ToInt16(CPassed)]++;
}
//calculate the conditional probability that test B and test C will Pass given A's test reult
double[] CProb_BCgA(bool ATestResult) {
//Calculate probability of test B and test C success looking only at tests that passed or failed the same way this instrument did given the A test result
double[] rvalue = {0.0,0.0};//P(B|A), P(C|A)
double BPassesGivenA = ProbHisto[Convert.ToInt16(ATestResult),1,0] + ProbHisto[Convert.ToInt16(ATestResult),1,1];
double CPassesGivenA = ProbHisto[Convert.ToInt16(ATestResult),1,1] + ProbHisto[Convert.ToInt16(ATestResult),0,1];
rvalue[0] = BPassesGivenA /(BPassesGivenA+ProbHisto[Convert.ToInt16(ATestResult),0,0] + ProbHisto[Convert.ToInt16(ATestResult),0,1]); // BPasses over BPasses + BFailures
rvalue[1] = CPassesGivenA /(CPassesGivenA+ProbHisto[Convert.ToInt16(ATestResult),0,0] + ProbHisto[Convert.ToInt16(ATestResult),1,0]);// CPasses over CPasses + CFailures
return rvalue;
}
//Calculate the conditional probability that test C will pass looking only at tests that passed or failed the same way this instrument did given the A and B test results
double CProb_CgAB(bool ATestResult, bool BTestResult)
{
//Calculate probability of test C success given A and B test results
double rvalue = 0.0;// P(C|A,B)
double CPassesGivenAB = ProbHisto[Convert.ToInt16(ATestResult),Convert.ToInt16(BTestResult),1];
rvalue= CPassesGivenAB /(CPassesGivenAB + ProbHisto[Convert.ToInt16(ATestResult),Convert.ToInt16(BTestResult),0]);// CPasses over CPasses + CFailures
return rvalue;
}
关于probability - 贝叶斯推理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31516732/
我开始研究应用于计算机视觉和情感计算的机器学习和贝叶斯推理。 如果我理解正确的话,之间有一个很大的讨论 经典信息架构、本体论、语义网络研究人员 以及机器学习和贝叶斯专家 我认为这通常被称为强人工智能与
我有一个 MS SQL Server 2008 数据库,用于存储提供食物的地方(咖啡馆、餐馆、小餐馆等)。在连接到该数据库的网站上,人们可以从 1 到 3 的等级对地点进行评分。 在网站上有一个页面,
我正在努力学习 pyMC 3,但遇到了一些麻烦。由于 pyMC3 的教程有限,我从 Bayesian Methods for Hackers 开始工作.我正在尝试将 pyMC 2 代码移植到 Baye
我是一名优秀的程序员,十分优秀!