251 lines
35 KiB
Plaintext
251 lines
35 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"id": "535c30a1-6335-4314-83a1-6e7d23ada40d",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 14,
|
||
|
"id": "7e9842e7-4fb8-404c-b6da-283510f314dc",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# hint: Pseudo Random and True Random"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "b702eeef-b651-4286-9236-2edca6f0353d",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Random Numbers"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"id": "ee62a0e7-e2ce-4570-ae65-ef815526d99b",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"88\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"x = np.random.randint(100)\n",
|
||
|
"\n",
|
||
|
"print(x)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 16,
|
||
|
"id": "ad3c430b-dde2-4202-8782-8cfc2cb434f1",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"0.6204661862066633\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"x = np.random.rand()\n",
|
||
|
"\n",
|
||
|
"print(x)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"id": "8e033582-3f93-43b6-b254-5dc0d2baad70",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[90 98 7 34 80]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"x=np.random.randint(100, size=(5))\n",
|
||
|
"\n",
|
||
|
"print(x)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 18,
|
||
|
"id": "bf4cf008-ec0f-4291-a990-eb3cf2b76f14",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"5\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"x = np.random.choice([3, 5, 7, 9])\n",
|
||
|
"\n",
|
||
|
"print(x)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "820e0a69-f14d-4fa9-9abf-ba6259de2abf",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Random Distribution"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"id": "d04aefc6-a1c0-4ee5-822a-bca76cc5bbc1",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[7 7 3 7 3 7 7 7 7 5 7 7 7 5 7 7 5 5 7 5 5 7 5 7 7 3 7 3 7 3 7 7 7 7 7 7 5\n",
|
||
|
" 7 7 3 7 3 7 7 7 5 7 7 5 7 5 7 5 7 5 7 7 7 7 7 3 5 3 7 5 7 7 7 5 5 7 5 7 5\n",
|
||
|
" 5 5 7 7 5 7 7 5 7 3 7 5 7 3 5 5 5 7 5 7 7 3 7 5 7 7]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Probability Density Function: A function that describes a continuous probability. \n",
|
||
|
"# i.e. probability of all values in an array.\n",
|
||
|
"x = np.random.choice([3, 5, 7, 9], p=[0.1, 0.3, 0.6, 0.0], size=(100))\n",
|
||
|
"\n",
|
||
|
"print(x)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "2e5627e9-7b03-45f8-a776-89bcd069fc71",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Normal (Gaussian) Distribution"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 24,
|
||
|
"id": "b561d19f-041a-4f10-b6b6-ba1827c79abf",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[[0.17858464 4.11191574 1.13382304]\n",
|
||
|
" [2.57882466 1.42017738 0.54116511]]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# loc - (Mean) where the peak of the bell exists.\n",
|
||
|
"# scale - (Standard Deviation) how flat the graph distribution should be.\n",
|
||
|
"# size - The shape of the returned array.\n",
|
||
|
"x = np.random.normal(loc=1, scale=2, size=(2, 3))\n",
|
||
|
"\n",
|
||
|
"print(x)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 38,
|
||
|
"id": "1c683c75-bcc2-40ca-8c27-9ed9aa0ccdd4",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAeoAAAHpCAYAAABN+X+UAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliL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2bUNRURHWrFkDwNolXVJSgp07dwIA3njjDURHRyMhIQGAdV31K6+8gkceecT+zOeffx6zZs3C6NGjYTAY8NprryE3NxdvvPGG498gkQPYZntPiw2EUiF8NKvfbMvKvi6oQUubGRovheCKiJyD0KBetmwZqqur8cILL6CsrAyJiYnYu3cvYmJiAABlZWUoKrp6sLzFYsGGDRuQn58PpVKJ+Ph4vPTSS3j44Yft99TV1eGhhx5CeXk5dDodkpKScPDgQcyYMcPh74/IEY7au71dc3zaJi7YF2FaNa4YjMgpqkNKvGt24xMNNpnEKZadGAwG6HQ66PV6aLWu25VI7k+SJEz/7WeoajDi72tSMD3WtcP6kfQcfHyiFI8tGINHF4wWXQ6RU3DdfjIiQnFNM6oajPBSyDBxhE50OQM2o33W+rGCasGVEDkPBjWRCzteaB2fThyhc4sxXdvysuzCWrSaLIKrIXIODGoiF5ZdWAsASI4OEFzJ4BgVMgwBPl5oabPgu1K96HKInAKDmsiF2YM6xj2CWi6X2cfZj+XXCK6GyDkwqIlclKGlzb6Ll7sENXB1nProJY5TEwEMaiKXlVtUB0kCogK9Eap1n2NcbUH9TVEd9/0mAoOayGW52/i0TUK4FiqlHPrmNhRUN4kuh0g
|
||
|
"text/plain": [
|
||
|
"<Figure size 500x500 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import seaborn as sns\n",
|
||
|
"\n",
|
||
|
"sns.displot(np.random.normal(size=1000), kind=\"kde\")\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "fbfc0beb-9716-48b6-9b08-d3ef4b867f27",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"\"Some\" other Distributions\n",
|
||
|
"- Normal Distribution\n",
|
||
|
"- Binomial Distribution\n",
|
||
|
"- Poisson Distribution\n",
|
||
|
"- Uniform Distribution\n",
|
||
|
"- Logistic Distribution\n",
|
||
|
"- Multinomial Distribution\n",
|
||
|
"- Exponential Distribution\n",
|
||
|
"- Chi Square Distribution\n",
|
||
|
"- Rayleigh Distribution\n",
|
||
|
"- Pareto Distribution\n",
|
||
|
"- Zipf Distribution\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "b7261962-15f5-48db-b2ee-950b2c3c1dc0",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3 (ipykernel)",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.11.7"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|