Skip to content
Open
Show file tree
Hide file tree
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
270 changes: 270 additions & 0 deletions Israel/problems.ipynb

Large diffs are not rendered by default.

176 changes: 176 additions & 0 deletions JULIOs_work/problems.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "ac622319",
"metadata": {},
"source": [
"# Descriptive statistics problems"
]
},
{
"cell_type": "markdown",
"id": "aa8993e4",
"metadata": {},
"source": [
"### Exercise 1"
]
},
{
"cell_type": "markdown",
"id": "5e0ab0d5",
"metadata": {},
"source": [
"We will use Numpy to obtain information to describe statistically.\n",
"\n",
"- Generate an array of 100 elements following a normal distribution.\n",
"- Generate an array of 100 elements following a chi-square distribution with 3 degrees of freedom.\n",
"- Calculate the main metrics and statistical measures that best describe the two vectors."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "34720ab6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"stats metrics for normal disturbution\n",
"mean: -0.06865936071598043\n",
"stander deviation: 0.9697609573818616\n",
"meadian: -0.12619537311221996\n",
"min: -1.9361951382884228\n",
"max: 2.277103875562215\n",
"variances: 0.9404363144621848\n",
"\n",
"stats metrics for chi square disturbution\n",
"mean: 3.14695578992872\n",
"stander deviation: 2.467973134872231\n",
"meadian: 2.1340973003611277\n",
"min: 0.18770455963586785\n",
"max: 10.0705079466792\n",
"variances: 6.0908913944510665\n"
]
}
],
"source": [
"# TODO\n",
"import numpy as np \n",
"\n",
"normal_distribution= np.random.normal(loc=0, scale=1,size=100)\n",
"\n",
"chi_square_distribution=np.random.chisquare(df=3,size=100)\n",
"\n",
"mean_normal=np.mean(normal_distribution)\n",
"std_normal=np.std(normal_distribution)\n",
"meadian_normal=np.median(normal_distribution)\n",
"min_normal=np.min(normal_distribution)\n",
"max_normal=np.max(normal_distribution)\n",
"variances_normal=np.var(normal_distribution)\n",
"\n",
"\n",
"\n",
"mean_chi_square=np.mean(chi_square_distribution)\n",
"std_chi_square=np.std(chi_square_distribution)\n",
"meadian_chi_square=np.median(chi_square_distribution)\n",
"min_chi_square=np.min(chi_square_distribution)\n",
"max_chi_square=np.max(chi_square_distribution)\n",
"variances_chi_square=np.var(chi_square_distribution)\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"print(\"stats metrics for normal disturbution\")\n",
"print(\"mean:\",mean_normal)\n",
"print(\"stander deviation:\",std_normal)\n",
"print(\"meadian:\",meadian_normal)\n",
"print(\"min:\",min_normal)\n",
"print(\"max:\",max_normal)\n",
"print(\"variances:\",variances_normal)\n",
"\n",
"print(\"\")\n",
"\n",
"print(\"stats metrics for chi square disturbution\")\n",
"print(\"mean:\",mean_chi_square)\n",
"print(\"stander deviation:\",std_chi_square)\n",
"print(\"meadian:\",meadian_chi_square)\n",
"print(\"min:\",min_chi_square)\n",
"print(\"max:\",max_chi_square)\n",
"print(\"variances:\",variances_chi_square)"
]
},
{
"cell_type": "markdown",
"id": "46c70c3d",
"metadata": {},
"source": [
"### Exercise 2\n",
"\n",
"Write a Python program to calculate the standard deviation of the following data:\n",
"\n",
"```py\n",
"data = [4, 2, 5, 8, 6]\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d590308e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"stander diviation is : 2.0\n"
]
}
],
"source": [
"# TODO\n",
"import numpy as np\n",
"\n",
"data = [4, 2, 5, 8, 6]\n",
"\n",
"mean_value=np.mean(data)\n",
"\n",
"squared_diffrince=[(x - mean_value)** 2 for x in data]\n",
"\n",
"mean_squared_diffrence=np.mean(squared_diffrince)\n",
"\n",
"std=np.sqrt(mean_squared_diffrence)\n",
"\n",
"print(\"stander diviation is :\", std)"
]
}
],
"metadata": {
"interpreter": {
"hash": "9248718ffe6ce6938b217e69dbcc175ea21f4c6b28a317e96c05334edae734bb"
},
"kernelspec": {
"display_name": "Python 3.9.12 ('ML-BOOTCAMP')",
"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.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
134 changes: 134 additions & 0 deletions Ricardo/problems.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "ac622319",
"metadata": {},
"source": [
"# Descriptive statistics problems"
]
},
{
"cell_type": "markdown",
"id": "aa8993e4",
"metadata": {},
"source": [
"### Exercise 1"
]
},
{
"cell_type": "markdown",
"id": "5e0ab0d5",
"metadata": {},
"source": [
"We will use Numpy to obtain information to describe statistically.\n",
"\n",
"- Generate an array of 100 elements following a normal distribution.\n",
"- Generate an array of 100 elements following a chi-square distribution with 3 degrees of freedom.\n",
"- Calculate the main metrics and statistical measures that best describe the two vectors."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "34720ab6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The mean of element 1 is 0.059808015534485\n",
"The Standard Deviation of element 1 is 1.0078822447165796\n",
"The mean of element 2 is 3.001840622161374\n",
"The Standard Deviation of element 2 is 2.3916810312486882\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"np.random.seed(0)\n",
"\n",
"elements1 = np.random.normal(size=100)\n",
"elements2 = np.random.chisquare(df=3, size=100)\n",
"\n",
"elements1_mean = np.mean(elements1)\n",
"elements2_mean = np.mean(elements2)\n",
"\n",
"elements1_std = np.std(elements1)\n",
"elements2_std = np.std(elements2)\n",
"\n",
"print(f\"The mean of element 1 is {elements1_mean}\")\n",
"print(f\"The Standard Deviation of element 1 is {elements1_std}\")\n",
"print(f\"The mean of element 2 is {elements2_mean}\")\n",
"print(f\"The Standard Deviation of element 2 is {elements2_std}\")\n"
]
},
{
"cell_type": "markdown",
"id": "46c70c3d",
"metadata": {},
"source": [
"### Exercise 2\n",
"\n",
"Write a Python program to calculate the standard deviation of the following data:\n",
"\n",
"```py\n",
"data = [4, 2, 5, 8, 6]\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "d590308e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Standard Deviation: 2.0\n"
]
}
],
"source": [
"data = [4, 2, 5, 8, 6]\n",
"\n",
"\n",
"mean = sum(data) / len(data)\n",
"\n",
"variance = sum((x - mean) ** 2 for x in data) / len(data)\n",
"\n",
"standard_deviation = variance ** 0.5\n",
"\n",
"print(\"Standard Deviation:\", standard_deviation)"
]
}
],
"metadata": {
"interpreter": {
"hash": "9248718ffe6ce6938b217e69dbcc175ea21f4c6b28a317e96c05334edae734bb"
},
"kernelspec": {
"display_name": "Python 3.9.12 ('ML-BOOTCAMP')",
"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.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading