注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
楼主整理了数据科学面试过程中,出现的硬币问题及答案,求米
Say you flip a coin 10 times and observe only one head. What would be your null hypothesis and p-value for testing whether the coin is fair or not?.1point3acres
• the null hypothesis is that the coin is fair, and the alternative hypothesis is that the coin is biased
• H0: P0=0.5
• H1: P1!=0.5
• note that, since the sample size here is 10<30. you canot apply the central limit theorem
. 1point 3acres • The p-value here is the probability of observing the results obtained given that the null hypothesis is true, i.e., under the assumption that the coin is fair. In total for 10 flips of a coin, there are 2^10=1024 possible ourcones. there in only 10 of them are there 9 tails and one heads. Hence, the exact probability of the given results is the p-value, which is 10/1024=0.0098. Therefore, with a significance level set, for example, at 0.05, we can reject the null hypothesis.
. 1point 3acres
Given an unfair coin, how to generate a fair coin?.--
• assume the probability of head is p, and toss it twice
• we could take (head, tail) as head, the probability is p(1-p)
• we could take (tail, head) as tail, the probability is p(1-p). Χ
• When (tail, tail) or (head, head), we just ignore them
.
Assume two coins, one fair and the other unfair (having both side tails). You pick one at random, flip it five times, and obser that it comes up as tails all five times. What is the probability that you are flipping the unfair coin?
F as fair coin, U as unfair coin, 5T as five tails. 1point 3acres
- P(5T)=P(U)*P(5T│U)+P(F)*P(5T│F)=0.5*1+0.5*(1/32)
- P(U)=P(F)=0.5
- P(U │ 5T)=P(5T | U)*P(U)/P(5T)=0.97
. .и
. 1point 3acres
|