Skip to content

Commit

Permalink
updates for lecture 4
Browse files Browse the repository at this point in the history
  • Loading branch information
profjsb committed Jun 5, 2019
1 parent 97c7f71 commit eafd5f4
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 40 deletions.
53 changes: 14 additions & 39 deletions Exercises/regression_breakout_00.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
"source": [
"## Regression: Breakout ##\n",
"\n",
"**ML Course (Columbia, J. Bloom, 2019)**"
"**ML Course (Bogotá, Colombia, J. Bloom, 2019)**"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/2/20/Columbia-Aquidneck-2011.jpg\" width=80%>\n",
"\n",
"A yacht named \"Columbia\" was used to win the [America's Cup in 1958](https://en.wikipedia.org/wiki/1958_America%27s_Cup). Technology has improved a lot since then. In this breakout, you're going making a predictive model to determine the resistance of a boat given it's geometry and speed. This is usually only measureable with advanced simulations but we can get <a href=\"http://archive.ics.uci.edu/ml/datasets/Yacht+Hydrodynamics\">7-dimensional data to build a model</a> and then determine this value for arbitrary new boat design:\n",
"A yacht named \"Columbia\" (not Colombia 😏) was used to win the [America's Cup in 1958](https://en.wikipedia.org/wiki/1958_America%27s_Cup). Technology has improved a lot since then. In this breakout, you're going making a predictive model to determine the resistance of a boat given it's geometry and speed. This is usually only measureable with advanced simulations but we can get <a href=\"http://archive.ics.uci.edu/ml/datasets/Yacht+Hydrodynamics\">7-dimensional data to build a model</a> and then determine this value for arbitrary new boat design:\n",
"\n",
"<ul>\n",
"<li> *Prediction of residuary resistance of sailing yachts at the initial design stage is of a great value for evaluating the ship's performance and for estimating the required propulsive power. Essential inputs include the basic hull dimensions and the boat velocity. The Delft data set comprises 308 full-scale experiments, which were performed at the Delft Ship Hydromechanics Laboratory for that purpose. These experiments include 22 different hull forms...*\n",
Expand All @@ -43,7 +42,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -55,7 +54,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -76,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -103,22 +102,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"KNeighborsRegressor(algorithm='auto', leaf_size=30, metric='minkowski',\n",
" metric_params=None, n_jobs=None, n_neighbors=5, p=2,\n",
" weights='uniform')"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sklearn import neighbors\n",
"\n",
Expand All @@ -134,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -152,20 +138,9 @@
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"124.31701740865698"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mean_squared_error(test_Y,Y.mean()*np.ones(test_Y.shape))"
]
Expand All @@ -179,7 +154,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -189,7 +164,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand Down
131 changes: 131 additions & 0 deletions Lectures/4_NeuralNetworksIntroduction/tensorboard.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Using tensorboard inside of Jupyter\n",
"\n",
"see https://www.tensorflow.org/tensorboard/r2/tensorboard_in_notebooks"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting tf-nightly-2.0-preview\n",
" Using cached https://files.pythonhosted.org/packages/b2/21/f31e83814a6f37c96a2d11f63cd63bbc2a1099cde12e703775ce92cc4572/tf_nightly_2.0_preview-2.0.0.dev20190520-cp36-cp36m-macosx_10_9_x86_64.whl\n",
"Requirement already satisfied: numpy<2.0,>=1.14.5 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (1.16.2)\n",
"Collecting wrapt>=1.11.1 (from tf-nightly-2.0-preview)\n",
"Requirement already satisfied: google-pasta>=0.1.6 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (0.1.6)\n",
"Requirement already satisfied: gast>=0.2.0 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (0.2.0)\n",
"Requirement already satisfied: keras-preprocessing>=1.0.5 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (1.0.5)\n",
"Collecting tb-nightly<1.15.0a0,>=1.14.0a0 (from tf-nightly-2.0-preview)\n",
" Using cached https://files.pythonhosted.org/packages/6f/99/4220b50dc87814988e969cc859c07d070423bea820bc24d16c2023057eb6/tb_nightly-1.14.0a20190520-py3-none-any.whl\n",
"Requirement already satisfied: absl-py>=0.7.0 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (0.7.1)\n",
"Requirement already satisfied: keras-applications>=1.0.6 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (1.0.6)\n",
"Requirement already satisfied: grpcio>=1.8.6 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (1.12.1)\n",
"Requirement already satisfied: protobuf>=3.6.1 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (3.7.1)\n",
"Requirement already satisfied: wheel>=0.26 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (0.30.0)\n",
"Requirement already satisfied: six>=1.10.0 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (1.11.0)\n",
"Requirement already satisfied: termcolor>=1.1.0 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (1.1.0)\n",
"Requirement already satisfied: tensorflow-estimator-2.0-preview in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (1.14.0.dev2019052000)\n",
"Requirement already satisfied: astor>=0.6.0 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tf-nightly-2.0-preview) (0.7.1)\n",
"Requirement already satisfied: markdown>=2.6.8 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tb-nightly<1.15.0a0,>=1.14.0a0->tf-nightly-2.0-preview) (2.6.11)\n",
"Requirement already satisfied: werkzeug>=0.11.15 in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from tb-nightly<1.15.0a0,>=1.14.0a0->tf-nightly-2.0-preview) (0.14.1)\n",
"Requirement already satisfied: h5py in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from keras-applications>=1.0.6->tf-nightly-2.0-preview) (2.7.1)\n",
"Requirement already satisfied: setuptools in /Users/jbloom/anaconda3/lib/python3.6/site-packages (from protobuf>=3.6.1->tf-nightly-2.0-preview) (39.1.0)\n",
"Installing collected packages: wrapt, tb-nightly, tf-nightly-2.0-preview\n",
"Successfully installed tb-nightly-1.14.0a20190520 tf-nightly-2.0-preview-2.0.0.dev20190520 wrapt-1.11.1\n"
]
}
],
"source": [
"!pip install tf-nightly-2.0-preview"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Load the TensorBoard notebook extension ... you may need to restart your kernel\n",
"%load_ext tensorboard"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import tensorflow as tf\n",
"import datetime, os"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"800\"\n",
" src=\"http://localhost:6006\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0xb2964dcf8>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%tensorboard --logdir nn_results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit eafd5f4

Please sign in to comment.