My solutions to Harvard's online course CS50AI, An Introduction to Machine Learning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

836 lines
26 KiB

4 years ago
  1. https://en.wikipedia.org/wiki/Probability
  2. Probability is a numerical description of how likely an event is to occur or how likely it is that a proposition is true. Probability is a number between 0 and 1, where, roughly speaking, 0 indicates impossibility and 1 indicates certainty. The higher the probability of an event, the more likely it is that the event will occur. A simple example is the tossing of a fair (unbiased) coin. Since the coin is fair, the two outcomes ("heads" and "tails") are both equally probable; the probability of "heads" equals the probability of "tails"; and since no other outcomes are possible, the probability of either "heads" or "tails" is 1/2 (which could also be written as 0.5 or 50%).
  3. These concepts have been given an axiomatic mathematical formalization in probability theory, which is used widely in such areas of study as mathematics, statistics, finance, gambling, science (in particular physics), artificial intelligence/machine learning, computer science, game theory, and philosophy to, for example, draw inferences about the expected frequency of events. Probability theory is also used to describe the underlying mechanics and regularities of complex systems.
  4. == Interpretations ==
  5. When dealing with experiments that are random and well-defined in a purely theoretical setting (like tossing a fair coin), probabilities can be numerically described by the number of desired outcomes divided by the total number of all outcomes. For example, tossing a fair coin twice will yield "head-head", "head-tail", "tail-head", and "tail-tail" outcomes. The probability of getting an outcome of "head-head" is 1 out of 4 outcomes, or, in numerical terms, 1/4, 0.25 or 25%. However, when it comes to practical application, there are two major competing categories of probability interpretations, whose adherents possess different views about the fundamental nature of probability:
  6. Objectivists assign numbers to describe some objective or physical state of affairs. The most popular version of objective probability is frequentist probability, which claims that the probability of a random event denotes the relative frequency of occurrence of an experiment's outcome, when repeating the experiment. This interpretation considers probability to be the relative frequency "in the long run" of outcomes. A modification of this is propensity probability, which interprets probability as the tendency of some experiment to yield a certain outcome, even if it is performed only once.
  7. Subjectivists assign numbers per subjective probability, i.e., as a degree of belief. The degree of belief has been interpreted as, "the price at which you would buy or sell a bet that pays 1 unit of utility if E, 0 if not E." The most popular version of subjective probability is Bayesian probability, which includes expert knowledge as well as experimental data to produce probabilities. The expert knowledge is represented by some (subjective) prior probability distribution. These data are incorporated in a likelihood function. The product of the prior and the likelihood, normalized, results in a posterior probability distribution that incorporates all the information known to date. By Aumann's agreement theorem, Bayesian agents whose prior beliefs are similar will end up with similar posterior beliefs. However, sufficiently different priors can lead to different conclusions regardless of how much information the agents share.
  8. == Etymology ==
  9. The word probability derives from the Latin probabilitas, which can also mean "probity", a measure of the authority of a witness in a legal case in Europe, and often correlated with the witness's nobility. In a sense, this differs much from the modern meaning of probability, which, in contrast, is a measure of the weight of empirical evidence, and is arrived at from inductive reasoning and statistical inference.
  10. == History ==
  11. The scientific study of probability is a modern development of mathematics. Gambling shows that there has been an interest in quantifying the ideas of probability for millennia, but exact mathematical descriptions arose much later. There are reasons for the slow development of the mathematics of probability. Whereas games of chance provided the impetus for the mathematical study of probability, fundamental issues are still obscured by the superstitions of gamblers. According to Richard Jeffrey, "Before the middle of the seventeenth century, the term 'probable' (Latin probabilis) meant approvable, and was applied in that sense, univocally, to opinion and to action. A probable action or opinion was one such as sensible people would undertake or hold, in the circumstances." However, in legal contexts especially, 'probable' could also apply to propositions for which there was good evidence.
  12. The earliest known forms of probability and statistics were developed by Middle Eastern mathematicians studying cryptography between the 8th and 13th centuries. Al-Khalil (717–786) wrote the Book of Cryptographic Messages which contains the first use of permutations and combinations to list all possible Arabic words with and without vowels. Al-Kindi (801–873) made the earliest known use of statistical inference in his work on cryptanalysis and frequency analysis. An important contribution of Ibn Adlan (1187–1268) was on sample size for use of frequency analysis.
  13. The sixteenth century Italian polymath Gerolamo Cardano demonstrated the efficacy of defining odds as the ratio of favourable to unfavourable outcomes (which implies that the probability of an event is given by the ratio of favourable outcomes to the total number of possible outcomes).
  14. Aside from the elementary work by Cardano, the doctrine of probabilities dates to the correspondence of Pierre de Fermat and Blaise Pascal (1654). Christiaan Huygens (1657) gave the earliest known scientific treatment of the subject. Jakob Bernoulli's Ars Conjectandi (posthumous, 1713) and Abraham de Moivre's Doctrine of Chances (1718) treated the subject as a branch of mathematics. See Ian Hacking's The Emergence of Probability and James Franklin's The Science of Conjecture for histories of the early development of the very concept of mathematical probability.
  15. The theory of errors may be traced back to Roger Cotes's Opera Miscellanea (posthumous, 1722), but a memoir prepared by Thomas Simpson in 1755 (printed 1756) first applied the theory to the discussion of errors of observation. The reprint (1757) of this memoir lays down the axioms that positive and negative errors are equally probable, and that certain assignable limits define the range of all errors. Simpson also discusses continuous errors and describes a probability curve.
  16. The first two laws of error that were proposed both originated with Pierre-Simon Laplace. The first law was published in 1774 and stated that the frequency of an error could be expressed as an exponential function of the numerical magnitude of the error, disregarding sign. The second law of error was proposed in 1778 by Laplace and stated that the frequency of the error is an exponential function of the square of the error. The second law of error is called the normal distribution or the Gauss law. "It is difficult historically to attribute that law to Gauss, who in spite of his well-known precocity had probably not made this discovery before he was two years old."Daniel Bernoulli (1778) introduced the principle of the maximum product of the probabilities of a system of concurrent errors.
  17. Adrien-Marie Legendre (1805) developed the method of least squares, and introduced it in his Nouvelles méthodes pour la détermination des orbites des comètes (New Methods for Determining the Orbits of Comets). In ignorance of Legendre's contribution, an Irish-American writer, Robert Adrain, editor of "The Analyst" (1808), first deduced the law of facility of error,
  18. ϕ
  19. (
  20. x
  21. )
  22. =
  23. c
  24. e
  25. h
  26. 2
  27. x
  28. 2
  29. ,
  30. {\displaystyle \phi (x)=ce^{-h^{2}x^{2}},}
  31. where
  32. h
  33. {\displaystyle h}
  34. is a constant depending on precision of observation, and
  35. c
  36. {\displaystyle c}
  37. is a scale factor ensuring that the area under the curve equals 1. He gave two proofs, the second being essentially the same as John Herschel's (1850). Gauss gave the first proof that seems to have been known in Europe (the third after Adrain's) in 1809. Further proofs were given by Laplace (1810, 1812), Gauss (1823), James Ivory (1825, 1826), Hagen (1837), Friedrich Bessel (1838), W.F. Donkin (1844, 1856), and Morgan Crofton (1870). Other contributors were Ellis (1844), De Morgan (1864), Glaisher (1872), and Giovanni Schiaparelli (1875). Peters's (1856) formula for r, the probable error of a single observation, is well known.
  38. In the nineteenth century authors on the general theory included Laplace, Sylvestre Lacroix (1816), Littrow (1833), Adolphe Quetelet (1853), Richard Dedekind (1860), Helmert (1872), Hermann Laurent (1873), Liagre, Didion, and Karl Pearson. Augustus De Morgan and George Boole improved the exposition of the theory.
  39. Andrey Markov introduced the notion of Markov chains (1906), which played an important role in stochastic processes theory and its applications. The modern theory of probability based on the measure theory was developed by Andrey Kolmogorov (1931).On the geometric side (see integral geometry) contributors to The Educational Times were influential (Miller, Crofton, McColl, Wolstenholme, Watson, and Artemas Martin).
  40. == Theory ==
  41. Like other theories, the theory of probability is a representation of its concepts in formal terms—that is, in terms that can be considered separately from their meaning. These formal terms are manipulated by the rules of mathematics and logic, and any results are interpreted or translated back into the problem domain.
  42. There have been at least two successful attempts to formalize probability, namely the Kolmogorov formulation and the Cox formulation. In Kolmogorov's formulation (see probability space), sets are interpreted as events and probability itself as a measure on a class of sets. In Cox's theorem, probability is taken as a primitive (that is, not further analyzed) and the emphasis is on constructing a consistent assignment of probability values to propositions. In both cases, the laws of probability are the same, except for technical details.
  43. There are other methods for quantifying uncertainty, such as the Dempster–Shafer theory or possibility theory, but those are essentially different and not compatible with the laws of probability as usually understood.
  44. == Applications ==
  45. Probability theory is applied in everyday life in risk assessment and modeling. The insurance industry and markets use actuarial science to determine pricing and make trading decisions. Governments apply probabilistic methods in environmental regulation, entitlement analysis (Reliability theory of aging and longevity), and financial regulation.
  46. A good example of the use of probability theory in equity trading is the effect of the perceived probability of any widespread Middle East conflict on oil prices, which have ripple effects in the economy as a whole. An assessment by a commodity trader that a war is more likely can send that commodity's prices up or down, and signals other traders of that opinion. Accordingly, the probabilities are neither assessed independently nor necessarily very rationally. The theory of behavioral finance emerged to describe the effect of such groupthink on pricing, on policy, and on peace and conflict. In addition to financial assessment, probability can be used to analyze trends in biology (e.g. disease spread) as well as ecology (e.g. biological Punnett squares). As with finance, risk assessment can be used as a statistical tool to calculate the likelihood of undesirable events occurring and can assist with implementing protocols to avoid encountering such circumstances. Probability is used to design games of chance so that casinos can make a guaranteed profit, yet provide payouts to players that are frequent enough to encourage continued play. The discovery of rigorous methods to assess and combine probability assessments has changed society. Another significant application of probability theory in everyday life is reliability. Many consumer products, such as automobiles and consumer electronics, use reliability theory in product design to reduce the probability of failure. Failure probability may influence a manufacturer's decisions on a product's warranty. The cache language model and other statistical language models that are used in natural language processing are also examples of applications of probability theory.
  47. == Mathematical treatment ==
  48. Consider an experiment that can produce a number of results. The collection of all possible results is called the sample space of the experiment. The power set of the sample space is formed by considering all different collections of possible results. For example, rolling a die can produce six possible results. One collection of possible results gives an odd number on the die. Thus, the subset {1,3,5} is an element of the power set of the sample space of dice rolls. These collections are called "events". In this case, {1,3,5} is the event that the die falls on some odd number. If the results that actually occur fall in a given event, the event is said to have occurred.
  49. A probability is a way of assigning every event a value between zero and one, with the requirement that the event made up of all possible results (in our example, the event {1,2,3,4,5,6}) is assigned a value of one. To qualify as a probability, the assignment of values must satisfy the requirement that if you look at a collection of mutually exclusive events (events with no common results, e.g., the events {1,6}, {3}, and {2,4} are all mutually exclusive), the probability that at least one of the events will occur is given by the sum of the probabilities of all the individual events. The probability of an event A is written as
  50. P
  51. (
  52. A
  53. )
  54. {\displaystyle P(A)}
  55. ,
  56. p
  57. (
  58. A
  59. )
  60. {\displaystyle p(A)}
  61. , or
  62. Pr
  63. (
  64. A
  65. )
  66. {\displaystyle {\text{Pr}}(A)}
  67. . This mathematical definition of probability can extend to infinite sample spaces, and even uncountable sample spaces, using the concept of a measure.
  68. The opposite or complement of an event A is the event [not A] (that is, the event of A not occurring), often denoted as
  69. A
  70. ¯
  71. ,
  72. A
  73. ,
  74. ¬
  75. A
  76. {\displaystyle {\overline {A}},A^{\complement },\neg A}
  77. , or
  78. A
  79. {\displaystyle {\sim }A}
  80. ; its probability is given by P(not A) = 1 − P(A). As an example, the chance of not rolling a six on a six-sided die is 1 – (chance of rolling a six)
  81. =
  82. 1
  83. 1
  84. 6
  85. =
  86. 5
  87. 6
  88. {\displaystyle =1-{\tfrac {1}{6}}={\tfrac {5}{6}}}
  89. . See Complementary event for a more complete treatment.
  90. If two events A and B occur on a single performance of an experiment, this is called the intersection or joint probability of A and B, denoted as
  91. P
  92. (
  93. A
  94. B
  95. )
  96. {\displaystyle P(A\cap B)}
  97. .
  98. === Independent events ===
  99. If two events, A and B are independent then the joint probability is
  100. P
  101. (
  102. A
  103. and
  104. B
  105. )
  106. =
  107. P
  108. (
  109. A
  110. B
  111. )
  112. =
  113. P
  114. (
  115. A
  116. )
  117. P
  118. (
  119. B
  120. )
  121. ,
  122. {\displaystyle P(A{\mbox{ and }}B)=P(A\cap B)=P(A)P(B),\,}
  123. for example, if two coins are flipped the chance of both being heads is
  124. 1
  125. 2
  126. ×
  127. 1
  128. 2
  129. =
  130. 1
  131. 4
  132. {\displaystyle {\tfrac {1}{2}}\times {\tfrac {1}{2}}={\tfrac {1}{4}}}
  133. .
  134. === Mutually exclusive events ===
  135. If either event A or event B but never both occurs on a single performance of an experiment, then they are called mutually exclusive events.
  136. If two events are mutually exclusive then the probability of both occurring is denoted as
  137. P
  138. (
  139. A
  140. B
  141. )
  142. {\displaystyle P(A\cap B)}
  143. .
  144. P
  145. (
  146. A
  147. and
  148. B
  149. )
  150. =
  151. P
  152. (
  153. A
  154. B
  155. )
  156. =
  157. 0
  158. {\displaystyle P(A{\mbox{ and }}B)=P(A\cap B)=0}
  159. If two events are mutually exclusive then the probability of either occurring is denoted as
  160. P
  161. (
  162. A
  163. B
  164. )
  165. {\displaystyle P(A\cup B)}
  166. .
  167. P
  168. (
  169. A
  170. or
  171. B
  172. )
  173. =
  174. P
  175. (
  176. A
  177. B
  178. )
  179. =
  180. P
  181. (
  182. A
  183. )
  184. +
  185. P
  186. (
  187. B
  188. )
  189. P
  190. (
  191. A
  192. B
  193. )
  194. =
  195. P
  196. (
  197. A
  198. )
  199. +
  200. P
  201. (
  202. B
  203. )
  204. 0
  205. =
  206. P
  207. (
  208. A
  209. )
  210. +
  211. P
  212. (
  213. B
  214. )
  215. {\displaystyle P(A{\mbox{ or }}B)=P(A\cup B)=P(A)+P(B)-P(A\cap B)=P(A)+P(B)-0=P(A)+P(B)}
  216. For example, the chance of rolling a 1 or 2 on a six-sided die is
  217. P
  218. (
  219. 1
  220. or
  221. 2
  222. )
  223. =
  224. P
  225. (
  226. 1
  227. )
  228. +
  229. P
  230. (
  231. 2
  232. )
  233. =
  234. 1
  235. 6
  236. +
  237. 1
  238. 6
  239. =
  240. 1
  241. 3
  242. .
  243. {\displaystyle P(1{\mbox{ or }}2)=P(1)+P(2)={\tfrac {1}{6}}+{\tfrac {1}{6}}={\tfrac {1}{3}}.}
  244. === Not mutually exclusive events ===
  245. If the events are not mutually exclusive then
  246. P
  247. (
  248. A
  249. or
  250. B
  251. )
  252. =
  253. P
  254. (
  255. A
  256. B
  257. )
  258. =
  259. P
  260. (
  261. A
  262. )
  263. +
  264. P
  265. (
  266. B
  267. )
  268. P
  269. (
  270. A
  271. and
  272. B
  273. )
  274. .
  275. {\displaystyle P\left(A{\hbox{ or }}B\right)=P(A\cup B)=P\left(A\right)+P\left(B\right)-P\left(A{\mbox{ and }}B\right).}
  276. For example, when drawing a single card at random from a regular deck of cards, the chance of getting a heart or a face card (J,Q,K) (or one that is both) is
  277. 13
  278. 52
  279. +
  280. 12
  281. 52
  282. 3
  283. 52
  284. =
  285. 11
  286. 26
  287. {\displaystyle {\tfrac {13}{52}}+{\tfrac {12}{52}}-{\tfrac {3}{52}}={\tfrac {11}{26}}}
  288. , because of the 52 cards of a deck 13 are hearts, 12 are face cards, and 3 are both: here the possibilities included in the "3 that are both" are included in each of the "13 hearts" and the "12 face cards" but should only be counted once.
  289. === Conditional probability ===
  290. Conditional probability is the probability of some event A, given the occurrence of some other event B.
  291. Conditional probability is written
  292. P
  293. (
  294. A
  295. B
  296. )
  297. {\displaystyle P(A\mid B)}
  298. , and is read "the probability of A, given B". It is defined by
  299. P
  300. (
  301. A
  302. B
  303. )
  304. =
  305. P
  306. (
  307. A
  308. B
  309. )
  310. P
  311. (
  312. B
  313. )
  314. .
  315. {\displaystyle P(A\mid B)={\frac {P(A\cap B)}{P(B)}}.\,}
  316. If
  317. P
  318. (
  319. B
  320. )
  321. =
  322. 0
  323. {\displaystyle P(B)=0}
  324. then
  325. P
  326. (
  327. A
  328. B
  329. )
  330. {\displaystyle P(A\mid B)}
  331. is formally undefined by this expression. However, it is possible to define a conditional probability for some zero-probability events using a σ-algebra of such events (such as those arising from a continuous random variable).For example, in a bag of 2 red balls and 2 blue balls (4 balls in total), the probability of taking a red ball is
  332. 1
  333. /
  334. 2
  335. {\displaystyle 1/2}
  336. ; however, when taking a second ball, the probability of it being either a red ball or a blue ball depends on the ball previously taken, such as, if a red ball was taken, the probability of picking a red ball again would be
  337. 1
  338. /
  339. 3
  340. {\displaystyle 1/3}
  341. since only 1 red and 2 blue balls would have been remaining.
  342. === Inverse probability ===
  343. In probability theory and applications, Bayes' rule relates the odds of event
  344. A
  345. 1
  346. {\displaystyle A_{1}}
  347. to event
  348. A
  349. 2
  350. {\displaystyle A_{2}}
  351. , before (prior to) and after (posterior to) conditioning on another event
  352. B
  353. {\displaystyle B}
  354. . The odds on
  355. A
  356. 1
  357. {\displaystyle A_{1}}
  358. to event
  359. A
  360. 2
  361. {\displaystyle A_{2}}
  362. is simply the ratio of the probabilities of the two events. When arbitrarily many events
  363. A
  364. {\displaystyle A}
  365. are of interest, not just two, the rule can be rephrased as posterior is proportional to prior times likelihood,
  366. P
  367. (
  368. A
  369. |
  370. B
  371. )
  372. P
  373. (
  374. A
  375. )
  376. P
  377. (
  378. B
  379. |
  380. A
  381. )
  382. {\displaystyle P(A|B)\propto P(A)P(B|A)}
  383. where the proportionality symbol means that the left hand side is proportional to (i.e., equals a constant times) the right hand side as
  384. A
  385. {\displaystyle A}
  386. varies, for fixed or given
  387. B
  388. {\displaystyle B}
  389. (Lee, 2012; Bertsch McGrayne, 2012). In this form it goes back to Laplace (1774) and to Cournot (1843); see Fienberg (2005). See Inverse probability and Bayes' rule.
  390. === Summary of probabilities ===
  391. == Relation to randomness and probability in quantum mechanics ==
  392. In a deterministic universe, based on Newtonian concepts, there would be no probability if all conditions were known (Laplace's demon), (but there are situations in which sensitivity to initial conditions exceeds our ability to measure them, i.e. know them). In the case of a roulette wheel, if the force of the hand and the period of that force are known, the number on which the ball will stop would be a certainty (though as a practical matter, this would likely be true only of a roulette wheel that had not been exactly levelled – as Thomas A. Bass' Newtonian Casino revealed). This also assumes knowledge of inertia and friction of the wheel, weight, smoothness and roundness of the ball, variations in hand speed during the turning and so forth. A probabilistic description can thus be more useful than Newtonian mechanics for analyzing the pattern of outcomes of repeated rolls of a roulette wheel. Physicists face the same situation in kinetic theory of gases, where the system, while deterministic in principle, is so complex (with the number of molecules typically the order of magnitude of the Avogadro constant 6.02×1023) that only a statistical description of its properties is feasible.
  393. Probability theory is required to describe quantum phenomena. A revolutionary discovery of early 20th century physics was the random character of all physical processes that occur at sub-atomic scales and are governed by the laws of quantum mechanics. The objective wave function evolves deterministically but, according to the Copenhagen interpretation, it deals with probabilities of observing, the outcome being explained by a wave function collapse when an observation is made. However, the loss of determinism for the sake of instrumentalism did not meet with universal approval. Albert Einstein famously remarked in a letter to Max Born: "I am convinced that God does not play dice". Like Einstein, Erwin Schrödinger, who discovered the wave function, believed quantum mechanics is a statistical approximation of an underlying deterministic reality. In some modern interpretations of the statistical mechanics of measurement, quantum decoherence is invoked to account for the appearance of subjectively probabilistic experimental outcomes.
  394. == See also ==
  395. Chance (disambiguation)
  396. Class membership probabilities
  397. Contingency
  398. Equiprobability
  399. Heuristics in judgment and decision-making
  400. Probability theory
  401. Randomness
  402. Statistics
  403. Estimators
  404. Estimation Theory
  405. Probability density functionIn LawBalance of probabilities
  406. == Notes ==
  407. == References ==
  408. == Bibliography ==
  409. Kallenberg, O. (2005) Probabilistic Symmetries and Invariance Principles. Springer-Verlag, New York. 510 pp. ISBN 0-387-25115-4
  410. Kallenberg, O. (2002) Foundations of Modern Probability, 2nd ed. Springer Series in Statistics. 650 pp. ISBN 0-387-95313-2
  411. Olofsson, Peter (2005) Probability, Statistics, and Stochastic Processes, Wiley-Interscience. 504 pp ISBN 0-471-67969-0.
  412. == External links ==
  413. Virtual Laboratories in Probability and Statistics (Univ. of Ala.-Huntsville)
  414. Probability on In Our Time at the BBC
  415. Probability and Statistics EBook
  416. Edwin Thompson Jaynes. Probability Theory: The Logic of Science. Preprint: Washington University, (1996). — HTML index with links to PostScript files and PDF (first three chapters)
  417. People from the History of Probability and Statistics (Univ. of Southampton)
  418. Probability and Statistics on the Earliest Uses Pages (Univ. of Southampton)
  419. Earliest Uses of Symbols in Probability and Statistics on Earliest Uses of Various Mathematical Symbols
  420. A tutorial on probability and Bayes' theorem devised for first-year Oxford University students
  421. [1] pdf file of An Anthology of Chance Operations (1963) at UbuWeb
  422. Introduction to Probability – eBook, by Charles Grinstead, Laurie Snell Source (GNU Free Documentation License)
  423. (in English and Italian) Bruno de Finetti, Probabilità e induzione, Bologna, CLUEB, 1993. ISBN 88-8091-176-7 (digital version)
  424. Richard P. Feynman's Lecture on probability.