Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

week5 lab3 done #228

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 159 additions & 27 deletions lab-intro-probability.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"0.8844772466215431"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"from scipy.stats import binom, norm\n",
"n = 460\n",
"p = 0.97\n",
"binom_ = binom(n, p)\n",
"proba = binom_.cdf(450)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -72,11 +88,29 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 24,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"0.49"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"from scipy.stats import geom\n",
"\n",
"p = 0.3\n",
"geom_p = geom(p)\n",
"proba = 1 - (geom_p.cdf(2))\n",
"proba\n",
"\n",
"\n"
]
},
{
Expand Down Expand Up @@ -107,11 +141,28 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 30,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"0.01289822084039205"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"from scipy.stats import poisson\n",
"#p(x > 550)\n",
"\n",
"m = 500\n",
"poiss = poisson(m)\n",
"proba = 1 - poiss.cdf(550)\n",
"proba"
]
},
{
Expand All @@ -123,11 +174,27 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 38,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"1.0"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"from scipy.stats import expon\n",
"\n",
"lambda_ = 500 * 24\n",
"poiss = poisson(lambda_)\n",
"proba_result = 1 - poiss.cdf(550)\n",
"proba_result"
]
},
{
Expand Down Expand Up @@ -157,10 +224,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"0.3934693402873666"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lambdda = 0.1\n",
"la = expon(scale= 1/lambdda)\n",
"result = la.cdf(5)\n",
"result"
]
},
{
"cell_type": "markdown",
Expand All @@ -173,10 +256,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"0.7768698398515702"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lambdda = 0.1\n",
"la = expon(scale= 1/lambdda)\n",
"result = la.cdf(15)\n",
"result"
]
},
{
"cell_type": "markdown",
Expand All @@ -196,11 +295,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 46,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"0.6826894921370859"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"mean = 150\n",
"std = 10\n",
"\n",
"norm_dist = norm(loc=mean,scale=std)\n",
"proba = norm_dist.cdf(160) - norm_dist.cdf(140)\n",
"proba"
]
},
{
Expand All @@ -219,17 +334,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 50,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"0.4511883639059735"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"mean_during = 50\n",
"panne = 30\n",
"\n",
"lambda2 = 1 / mean_during\n",
"lambda2_inv = expon(scale= 1/lambda2)\n",
"lambda2_inv.cdf(30)\n",
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -243,9 +375,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.12.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}