没有合适的资源?快使用搜索试试~ 我知道了~
probability_lab.pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 82 浏览量
2023-06-18
13:15:24
上传
评论
收藏 464KB PDF 举报
温馨提示
试读
6页
probability_lab.pdf
资源推荐
资源详情
资源评论
Estimate a probability density function
ML 2022: Machine Learning
https://people.sc.fsu.edu/∼jburkardt/classes/ml 2022/probability lab/probability lab.pdf
Two flies land at random points in the unit circle. On average, what is the distance between them?
Estimate a Probability Density Function!
We will estimate the answer to a probability question the experimental way. We will simply look at
many random examples of the fly in the circle problem, and average the results. This exercise will
give us practice in using Python to use random numbers, create user functions, work with arrays and
iteration, and create an interesting plot.
• Random numbers can be used to study an event with many possible outcomes;
• A histogram summarizes the number of times each outcome occurs;
• When the outcomes can be a range of real numbers, we have a probability density function;
• The shape of our histogram should approximate the exact PDF;
• Plotting will be a big help in catching mistakes and understanding results;
1 Plot a circle and some random points
Our stated problem involves two flies landing at random points in a unit circle. We’d like to use Python to
draw a picture of this situation, so we need to know:
• how to convert the mathematical circle into a “computational” circle;
• how to get access to the graphics library;
• how to draw a sequence of points as a connected curve;
• how to generate random points;
• how to add an image of those points to our plot;
• how to save a copy of our work as a jpg file;
Although we may know the formula for the points (x, y) that lie on the unit circle, to make a plot we actually
need to be able to generate a sequence of such points, and connect them. Luckily, as the angle θ goes from
0 to 2π, the coordinates of the points are (cos(θ), sin(θ)). We want to pick n equally spaced values of θ and
create a list of the corresponding points.
We could use a for loop to do this:
import numpy as np
cn = 100
cx = np . z er os ( cn )
cy = np . z er os ( cn )
1
资源评论
卷积神经网络
- 粉丝: 342
- 资源: 8460
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功