Skip to content

Instantly share code, notes, and snippets.

@triestpa

triestpa/dem_analysis.ipynb Secret

Last active Jun 7, 2016
Embed
What would you like to do?
Demonstration Analysis
{
"cells": [
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false,
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>pclass</th>\n",
" <th>survived</th>\n",
" <th>name</th>\n",
" <th>sex</th>\n",
" <th>age</th>\n",
" <th>sibsp</th>\n",
" <th>parch</th>\n",
" <th>ticket</th>\n",
" <th>fare</th>\n",
" <th>embarked</th>\n",
" <th>home.dest</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>Allison, Miss. Helen Loraine</td>\n",
" <td>female</td>\n",
" <td>2.0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>113781</td>\n",
" <td>151.5500</td>\n",
" <td>S</td>\n",
" <td>Montreal, PQ / Chesterville, ON</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>Allison, Mr. Hudson Joshua Creighton</td>\n",
" <td>male</td>\n",
" <td>30.0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>113781</td>\n",
" <td>151.5500</td>\n",
" <td>S</td>\n",
" <td>Montreal, PQ / Chesterville, ON</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>Allison, Mrs. Hudson J C (Bessie Waldo Daniels)</td>\n",
" <td>female</td>\n",
" <td>25.0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>113781</td>\n",
" <td>151.5500</td>\n",
" <td>S</td>\n",
" <td>Montreal, PQ / Chesterville, ON</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Anderson, Mr. Harry</td>\n",
" <td>male</td>\n",
" <td>48.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>19952</td>\n",
" <td>26.5500</td>\n",
" <td>S</td>\n",
" <td>New York, NY</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>Artagaveytia, Mr. Ramon</td>\n",
" <td>male</td>\n",
" <td>71.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>PC 17609</td>\n",
" <td>49.5042</td>\n",
" <td>C</td>\n",
" <td>Montevideo, Uruguay</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>Astor, Col. John Jacob</td>\n",
" <td>male</td>\n",
" <td>47.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>PC 17757</td>\n",
" <td>227.5250</td>\n",
" <td>C</td>\n",
" <td>New York, NY</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>Barkworth, Mr. Algernon Henry Wilson</td>\n",
" <td>male</td>\n",
" <td>80.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>27042</td>\n",
" <td>30.0000</td>\n",
" <td>S</td>\n",
" <td>Hessle, Yorks</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>Baxter, Mr. Quigg Edmond</td>\n",
" <td>male</td>\n",
" <td>24.0</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>PC 17558</td>\n",
" <td>247.5208</td>\n",
" <td>C</td>\n",
" <td>Montreal, PQ</td>\n",
" </tr>\n",
" <tr>\n",
" <th>336</th>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>Beane, Mr. Edward</td>\n",
" <td>male</td>\n",
" <td>32.0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>2908</td>\n",
" <td>26.0000</td>\n",
" <td>S</td>\n",
" <td>Norwich / New York, NY</td>\n",
" </tr>\n",
" <tr>\n",
" <th>341</th>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>Becker, Miss. Ruth Elizabeth</td>\n",
" <td>female</td>\n",
" <td>12.0</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>230136</td>\n",
" <td>39.0000</td>\n",
" <td>S</td>\n",
" <td>Guntur, India / Benton Harbour, MI</td>\n",
" </tr>\n",
" <tr>\n",
" <th>605</th>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>Abelseth, Mr. Olaus Jorgensen</td>\n",
" <td>male</td>\n",
" <td>25.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>348122</td>\n",
" <td>7.6500</td>\n",
" <td>S</td>\n",
" <td>Perkins County, SD</td>\n",
" </tr>\n",
" <tr>\n",
" <th>606</th>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>Abrahamsson, Mr. Abraham August Johannes</td>\n",
" <td>male</td>\n",
" <td>20.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>SOTON/O2 3101284</td>\n",
" <td>7.9250</td>\n",
" <td>S</td>\n",
" <td>Taalintehdas, Finland Hoboken, NJ</td>\n",
" </tr>\n",
" <tr>\n",
" <th>613</th>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>Albimona, Mr. Nassef Cassem</td>\n",
" <td>male</td>\n",
" <td>26.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>2699</td>\n",
" <td>18.7875</td>\n",
" <td>C</td>\n",
" <td>Syria Fredericksburg, VA</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" pclass survived name \\\n",
"2 1 0 Allison, Miss. Helen Loraine \n",
"3 1 0 Allison, Mr. Hudson Joshua Creighton \n",
"4 1 0 Allison, Mrs. Hudson J C (Bessie Waldo Daniels) \n",
"5 1 1 Anderson, Mr. Harry \n",
"9 1 0 Artagaveytia, Mr. Ramon \n",
"10 1 0 Astor, Col. John Jacob \n",
"14 1 1 Barkworth, Mr. Algernon Henry Wilson \n",
"16 1 0 Baxter, Mr. Quigg Edmond \n",
"336 2 1 Beane, Mr. Edward \n",
"341 2 1 Becker, Miss. Ruth Elizabeth \n",
"605 3 1 Abelseth, Mr. Olaus Jorgensen \n",
"606 3 1 Abrahamsson, Mr. Abraham August Johannes \n",
"613 3 1 Albimona, Mr. Nassef Cassem \n",
"\n",
" sex age sibsp parch ticket fare embarked \\\n",
"2 female 2.0 1 2 113781 151.5500 S \n",
"3 male 30.0 1 2 113781 151.5500 S \n",
"4 female 25.0 1 2 113781 151.5500 S \n",
"5 male 48.0 0 0 19952 26.5500 S \n",
"9 male 71.0 0 0 PC 17609 49.5042 C \n",
"10 male 47.0 1 0 PC 17757 227.5250 C \n",
"14 male 80.0 0 0 27042 30.0000 S \n",
"16 male 24.0 0 1 PC 17558 247.5208 C \n",
"336 male 32.0 1 0 2908 26.0000 S \n",
"341 female 12.0 2 1 230136 39.0000 S \n",
"605 male 25.0 0 0 348122 7.6500 S \n",
"606 male 20.0 0 0 SOTON/O2 3101284 7.9250 S \n",
"613 male 26.0 0 0 2699 18.7875 C \n",
"\n",
" home.dest \n",
"2 Montreal, PQ / Chesterville, ON \n",
"3 Montreal, PQ / Chesterville, ON \n",
"4 Montreal, PQ / Chesterville, ON \n",
"5 New York, NY \n",
"9 Montevideo, Uruguay \n",
"10 New York, NY \n",
"14 Hessle, Yorks \n",
"16 Montreal, PQ \n",
"336 Norwich / New York, NY \n",
"341 Guntur, India / Benton Harbour, MI \n",
"605 Perkins County, SD \n",
"606 Taalintehdas, Finland Hoboken, NJ \n",
"613 Syria Fredericksburg, VA "
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"prediction = tf_clf_dnn.predict(X_test)\n",
"passenger_set[passenger_set.survived != prediction]"
]
}
],
"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.4.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.