Skip to content

Commit 92d30e3

Browse files
committed
Initial commit
0 parents  commit 92d30e3

3 files changed

Lines changed: 431 additions & 0 deletions

File tree

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2020] [Fan Zhou]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# basic-probability
2+
Matlab source code for basic probability used in information theory.
3+
Static methods are defined in a class named 'probabilityTool'.
4+
Simply call a function in this class by probabilityTool.<functionname>.
5+
All methods provides default input for computation.
6+
Your inputs are collected using <varargin>.
7+
8+
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
9+
Example:
10+
Jointly distributed random variables X and Y are defined with a joint probability distribution pXY(x,y) = Pr(X = x, Y = y).
11+
Then the marginal distribution pX(x) and pY(y) can be computed by:
12+
[px,py] = probabilityTool.marginalize(pxy) %pxy is the joint probability distribution pXY(x,y)
13+
or
14+
[px,py] = probabilityTool.marginalize(pxy,'r') which returns rational number.
15+
16+
The program also provides default values, invoking
17+
[px,py] = probabilityTool.marginalize
18+
19+
20+
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
21+
Type methods(probabilityTool) to see all methods in this class.
22+
23+
The software provides the following functions.
24+
- Theorem of total probability @probabilityTool.PRy
25+
- Marginalization @probabilityTool.marginalize
26+
- Compute joint distribution @probabilityTool.computeJointDistribution
27+
- Compute "all-related" probability @probabilityTool.computeAllP
28+
- Bayes rule @probabilityTool.bayes
29+
- Compute expected value @probabilityTool.computeExpection
30+
- Expected value of a function @probabilityTool.expectionOfaFunction
31+
- Compute variance @probabilityTool.computeVariance
32+
- An example of binary random vector @probabilityTool.binaryRandomVectorExample (uses @binomialPR)
33+
- Use Chebyshev inequality on random vectors @largeNumberExperiment (uses @randomSamples)
34+
35+
36+
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
37+
38+
Notations in source code:
39+
- px: Pr(X = x)
40+
- py: Pr(Y = y)
41+
- pxy: Pr(X=x,Y=y) joint probability
42+
- pxgy: Pr(X=x | Y=y) conditional probability
43+
- pygx: Pr(Y=y | X=x) conditional probability
44+
- EX: E[X] expection of pX(x)
45+
- EgX: E[g(x)] expection of a function g(x), where g(x) is a function of pX(x)
46+
- Var: Var[X] variance of pX(x)
47+
48+
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
49+
50+
51+
52+
53+
v1.0 June 29, 2020 Initial release

0 commit comments

Comments
 (0)