Skip to content

Commit

Permalink
Merge pull request #4 from hoanglinh171/linh
Browse files Browse the repository at this point in the history
no message
  • Loading branch information
hoanglinh171 authored Jan 28, 2022
2 parents 91efc00 + 6448a92 commit 1004195
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 31 deletions.
94 changes: 85 additions & 9 deletions content/lectures/lecture05/notebook/s1-exa2-challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -86,7 +86,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -173,7 +173,7 @@
"5 8.7 48.9 75.0 7.2"
]
},
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -194,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -207,10 +207,86 @@
"\n",
"idx = np.argsort(data_x).values # Get indices ordered from lowest to highest values\n",
"\n",
"# Get the actual data in the order from above and turn them into numpy arrays. \n",
"# # Get the actual data in the order from above and turn them into numpy arrays. \n",
"\n",
"data_x = data_x.iloc[idx].values\n",
"data_y = data_y.iloc[idx].values"
"data_x = data_x.iloc[idx]\n",
"# data_y = data_y.iloc[idx].values"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5 8.7\n",
"6 57.5\n",
"7 120.2\n",
"8 8.6\n",
"9 199.8\n",
"10 66.1\n",
"11 214.7\n",
"12 23.8\n",
"Name: TV, dtype: float64"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_x"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([3, 0, 7, 1, 5, 2, 4, 6], dtype=int64)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"idx"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8 8.6\n",
"5 8.7\n",
"12 23.8\n",
"6 57.5\n",
"10 66.1\n",
"7 120.2\n",
"9 199.8\n",
"11 214.7\n",
"Name: TV, dtype: float64"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_x"
]
},
{
Expand Down Expand Up @@ -492,7 +568,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -506,7 +582,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions content/lectures/lecture06/notebook/s1-exc1-challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -264,7 +264,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
60 changes: 42 additions & 18 deletions content/lectures/lecture06/notebook/s2-exa1-challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,28 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting prettytable\n",
" Downloading prettytable-3.0.0-py3-none-any.whl (24 kB)\n",
"Requirement already satisfied: wcwidth in c:\\users\\ghtk\\anaconda3\\lib\\site-packages (from prettytable) (0.2.5)\n",
"Installing collected packages: prettytable\n",
"Successfully installed prettytable-3.0.0\n"
]
}
],
"source": [
"!pip install prettytable"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -66,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -76,7 +97,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -108,35 +129,35 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <th>0</th>\n",
" <td>230.1</td>\n",
" <td>37.8</td>\n",
" <td>69.2</td>\n",
" <td>22.1</td>\n",
" </tr>\n",
" <tr>\n",
" <td>1</td>\n",
" <th>1</th>\n",
" <td>44.5</td>\n",
" <td>39.3</td>\n",
" <td>45.1</td>\n",
" <td>10.4</td>\n",
" </tr>\n",
" <tr>\n",
" <td>2</td>\n",
" <th>2</th>\n",
" <td>17.2</td>\n",
" <td>45.9</td>\n",
" <td>69.3</td>\n",
" <td>9.3</td>\n",
" </tr>\n",
" <tr>\n",
" <td>3</td>\n",
" <th>3</th>\n",
" <td>151.5</td>\n",
" <td>41.3</td>\n",
" <td>58.5</td>\n",
" <td>18.5</td>\n",
" </tr>\n",
" <tr>\n",
" <td>4</td>\n",
" <th>4</th>\n",
" <td>180.8</td>\n",
" <td>10.8</td>\n",
" <td>58.4</td>\n",
Expand All @@ -155,7 +176,7 @@
"4 180.8 10.8 58.4 12.9"
]
},
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -174,7 +195,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -221,7 +242,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand All @@ -234,10 +255,10 @@
"| ['TV'] | 10.204654118800956 |\n",
"| ['Radio'] | 23.248766588129108 |\n",
"| ['Newspaper'] | 30.620733995242563 |\n",
"| ['TV', 'Radio'] | 3.137948009068354 |\n",
"| ['TV', 'Newspaper'] | 11.062557300662816 |\n",
"| ['Radio', 'Newspaper'] | 23.2046437454446 |\n",
"| ['TV', 'Radio', 'Newspaper'] | 3.174097353976104 |\n",
"| ['TV', 'Radio'] | 3.1379480090683516 |\n",
"| ['TV', 'Newspaper'] | 11.062557300662819 |\n",
"| ['Radio', 'Newspaper'] | 23.204643745444592 |\n",
"| ['TV', 'Radio', 'Newspaper'] | 3.174097353976105 |\n",
"+------------------------------+--------------------+\n"
]
}
Expand All @@ -262,12 +283,15 @@
{
"cell_type": "markdown",
"metadata": {},
"source": []
"source": [
"* Min MSE is with predictors TV and Radio, while the max is with Radio only\n",
"* "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -281,7 +305,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions content/lectures/lecture07/notebook/s2-exb1-challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -301,7 +301,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 1004195

Please sign in to comment.