Skip to content

Commit

Permalink
added clarity and fixed a few comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tebba-von-mathenstein committed May 20, 2019
1 parent 90739d0 commit 957366c
Showing 1 changed file with 38 additions and 26 deletions.
64 changes: 38 additions & 26 deletions 03-data-preprocessing/02-preprocessing-structured-data.ipynb
Expand Up @@ -2836,8 +2836,8 @@
"# Lets try to coerce the data to numeric where possible:\n",
"coerced_sales = pd.to_numeric(sales_df['SALE PRICE'], errors='coerce')\n",
"\n",
"# Ignore doesn't convert values that cannot be coerced. We can use this code to \n",
"# Examine those values:\n",
"# Values that cannot be coerced are changed to Not a Number (NaN). \n",
"# We can use this code to examine those values:\n",
"only_non_numerics = sales_df['SALE PRICE'][coerced_sales.isna()]\n",
"\n",
"# And this to print all the unique values from only_non_numerics\n",
Expand Down Expand Up @@ -3104,7 +3104,7 @@
" 'ADDRESS', # Hard to parse. Block/zip/borough/neighborhood capture all the value we need. \n",
" 'APARTMENT NUMBER', # Likely irrelevent to the price. Ought to be categorical, which would make data large.\n",
" 'SALE DATE', # Everything was within a 12 month period, likely irrelevant and hard to parse.\n",
" 'LOT' # A lot is a unique identified within a block, and categorical. Not worth it. \n",
" 'LOT' # A lot is a unique identifier within a block, and categorical. Not worth it. \n",
"])\n",
"\n",
"# Look again with dropped columns\n",
Expand Down Expand Up @@ -4184,7 +4184,7 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 26,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -4213,7 +4213,7 @@
" 6.39903588e-04, 9.94546356e-01]])"
]
},
"execution_count": 38,
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -4243,7 +4243,7 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 27,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -4422,7 +4422,7 @@
"4 C2 8000000.0 "
]
},
"execution_count": 39,
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -4440,7 +4440,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 28,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -4580,7 +4580,7 @@
"max 1.000000 1.000000 2.210000e+09 "
]
},
"execution_count": 40,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -4591,7 +4591,7 @@
},
{
"cell_type": "code",
"execution_count": 60,
"execution_count": 29,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -4693,7 +4693,7 @@
"[1 rows x 12413 columns]"
]
},
"execution_count": 60,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -4712,7 +4712,7 @@
},
{
"cell_type": "code",
"execution_count": 61,
"execution_count": 30,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -4814,14 +4814,13 @@
"[1 rows x 12412 columns]"
]
},
"execution_count": 61,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Holy crap, 12,413 columns! That's okay this is an area where deep learning\n",
"# excels. But it's worth point out. \n",
"# Holy crap, 12,413 columns!\n",
"\n",
"# Note that all our numeric columns are between 0 and 1, except SALE PRICE\n",
"# All that's left to do here is to separate the labels from the features.\n",
Expand All @@ -4834,7 +4833,7 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": 31,
"metadata": {},
"outputs": [
{
Expand All @@ -4844,7 +4843,7 @@
"Name: SALE PRICE, dtype: float64"
]
},
"execution_count": 62,
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -4855,19 +4854,29 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:From /Users/tylerbettilyon/.local/share/virtualenvs/deep-learning-intro-1Adgpw9A/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Colocations handled automatically by placer.\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"dense_6 (Dense) (None, 32) 397216 \n",
"dense_1 (Dense) (None, 32) 397216 \n",
"_________________________________________________________________\n",
"dense_7 (Dense) (None, 1) 33 \n",
"dense_2 (Dense) (None, 1) 33 \n",
"=================================================================\n",
"Total params: 397,249\n",
"Trainable params: 397,249\n",
Expand Down Expand Up @@ -4901,24 +4910,27 @@
},
{
"cell_type": "code",
"execution_count": 67,
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:From /Users/tylerbettilyon/.local/share/virtualenvs/deep-learning-intro-1Adgpw9A/lib/python3.7/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Use tf.cast instead.\n",
"Train on 67638 samples, validate on 16910 samples\n",
"Epoch 1/5\n",
"67638/67638 [==============================] - 67s 995us/step - loss: 135514476748222.7656 - val_loss: 3067340188932.0269\n",
"67638/67638 [==============================] - 62s 911us/step - loss: 135514447459043.1719 - val_loss: 3067318119042.6191\n",
"Epoch 2/5\n",
"67638/67638 [==============================] - 59s 879us/step - loss: 135514257970660.7344 - val_loss: 3067243352783.4038\n",
"67638/67638 [==============================] - 56s 827us/step - loss: 135514111749335.7969 - val_loss: 3067175639112.4248\n",
"Epoch 3/5\n",
"67638/67638 [==============================] - 58s 861us/step - loss: 135513807982214.7188 - val_loss: 3067082781382.6841\n",
"67638/67638 [==============================] - 56s 830us/step - loss: 135513500542116.6250 - val_loss: 3066945655949.0957\n",
"Epoch 4/5\n",
"67638/67638 [==============================] - 59s 872us/step - loss: 135513229462961.5625 - val_loss: 3066880789958.7749\n",
"67638/67638 [==============================] - 58s 857us/step - loss: 135512595877045.1719 - val_loss: 3066636823932.1699\n",
"Epoch 5/5\n",
"67638/67638 [==============================] - 58s 860us/step - loss: 135512464310952.6719 - val_loss: 3066634511670.1675\n"
"67638/67638 [==============================] - 54s 798us/step - loss: 135511465057289.2812 - val_loss: 3066261550239.5044\n"
]
},
{
Expand Down

0 comments on commit 957366c

Please sign in to comment.