-
-
Notifications
You must be signed in to change notification settings - Fork 362
/
Copy pathpoisson.py
37 lines (24 loc) · 1.06 KB
/
poisson.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
"""poisson-distribution-and-poisson-process-tutorial.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1u-t6oSxbMd2FrzaIMimXnPMR5dfV6Gel
# Diving Into the Poisson Distribution and Poisson Process
* Tutorial: https://news.towardsai.net/pd
* Github: https://github.com/towardsai/tutorials/tree/master/poisson-distribution-process
A TV Assembly unit performs a defects analysis task to understand the number of defects that could happen for a given defective TV. Using past quality and audit data is noted that 12 defects are marked on an average for a defective TV, calculate below:
* The probability that a defective laptop has exactly 5 defects.
* The probability that a defective laptop has less than 5 defects.
"""
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
n = np.arange(0,30)
n
rate = 12
poisson = stats.poisson.pmf(n,rate)
poisson
poisson[5]
poisson[0] + poisson[1] + poisson[2] + poisson[3] + poisson[4]
plt.plot(n,poisson, 'o-')
plt.show()