- Training Systems Using Python Statistical Modeling
- Curtis Miller
- 367字
- 2021-06-24 14:20:46
Using Bayesian analysis to solve a hit-and-run
In this case, we're going to be solving a hit-and-run. In a certain city, 95% of cabs are owned by the Yellow Cab Company, and 5% are owned by Green Cab, Inc. Recently, a cab was involved in a hit-and-run accident, injuring a pedestrian. A witness saw the accident and claimed that the cab that hit the pedestrian was a green cab. Tests by investigators revealed that, under similar circumstances, this witness is correctly able to identify a green cab 90% of the time and correctly identify a yellow cab 85% of the time. This means that they incorrectly call a yellow cab a green cab 15% of the time, and incorrectly call a green cab a yellow cab 10% of the time. So, the question is, should we pursue Green Cab, Inc.?
The following formula shows Bayes' theorem:

Here, H represents the event that a green cab hit the pedestrian, while G represents the event that the witness claims to have seen a green cab.
So, let's encode these probabilities, as follows:

Now that we have these probabilities, we can use Bayes' theorem to compute the posterior probability, which is given as follows:

So, the result is that the prior probability that the cab was actually green was 0.05, which was very low. The posterior probability, that is, the probability that the cab that hit the pedestrian was green, given that the witness said the cab was green, is now 32%, which is higher than that number, but it is still less than 50%.
Additionally, considering that this city consists only of yellow cabs and green cabs, this indicates that even though the witness saw a green cab or claimed to have seen a green cab, there are too few green cabs and the witness is not accurate enough to override how few green cabs there are. This means that it's still more likely that the pedestrian was hit by a yellow cab and that the witness made a mistake.
Now, let's take a look at some useful applications of Bayesian analysis. We will go through topics similar to those seen previously, but from the Bayesian perspective.
- Docker and Kubernetes for Java Developers
- 移動UI設計(微課版)
- 兩周自制腳本語言
- 算法大爆炸:面試通關步步為營
- Learn Programming in Python with Cody Jackson
- 老“碼”識途
- Microsoft System Center Orchestrator 2012 R2 Essentials
- Extending Puppet(Second Edition)
- SQL Server 2016 從入門到實戰(視頻教學版)
- Laravel Application Development Blueprints
- Python函數式編程(第2版)
- 深入實踐DDD:以DSL驅動復雜軟件開發
- Java多線程并發體系實戰(微課視頻版)
- Java EE項目應用開發
- 深入淺出 HTTPS:從原理到實戰