Skip to content

Commit

Permalink
remove outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
inchiosa committed Jul 30, 2018
1 parent 8e726cc commit 0429242
Showing 1 changed file with 14 additions and 223 deletions.
237 changes: 14 additions & 223 deletions notebooks/samples/108 - Model Deployment with Spark Serving.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand All @@ -32,130 +32,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>education</th>\n",
" <th>marital-status</th>\n",
" <th>hours-per-week</th>\n",
" <th>income</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>10.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>25.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>28.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>30.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>32.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>35.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>37.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>38.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>38.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>10th</td>\n",
" <td>Divorced</td>\n",
" <td>40.0</td>\n",
" <td>&lt;=50K</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" education marital-status hours-per-week income\n",
"0 10th Divorced 10.0 <=50K\n",
"1 10th Divorced 25.0 <=50K\n",
"2 10th Divorced 28.0 <=50K\n",
"3 10th Divorced 30.0 <=50K\n",
"4 10th Divorced 32.0 <=50K\n",
"5 10th Divorced 35.0 <=50K\n",
"6 10th Divorced 37.0 <=50K\n",
"7 10th Divorced 38.0 <=50K\n",
"8 10th Divorced 38.0 <=50K\n",
"9 10th Divorced 40.0 <=50K"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"dataFilePath = \"AdultCensusIncome.csv\"\n",
"import os, urllib\n",
Expand All @@ -181,7 +60,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand All @@ -201,25 +80,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"root\n",
" |-- education: string (nullable = true)\n",
" |-- marital-status: string (nullable = true)\n",
" |-- hours-per-week: double (nullable = true)\n",
" |-- income: string (nullable = true)\n",
" |-- scores: vector (nullable = true)\n",
" |-- scored_probabilities: vector (nullable = true)\n",
" |-- scored_labels: double (nullable = false)\n",
"\n"
]
}
],
"outputs": [],
"source": [
"from mmlspark import ComputeModelStatistics, TrainedClassifierModel\n",
"prediction = model.transform(test)\n",
Expand All @@ -228,65 +91,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>evaluation_type</th>\n",
" <th>confusion_matrix</th>\n",
" <th>accuracy</th>\n",
" <th>precision</th>\n",
" <th>recall</th>\n",
" <th>AUC</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Classification</td>\n",
" <td>DenseMatrix([[ 5797., 408.],\\n [...</td>\n",
" <td>0.822389</td>\n",
" <td>0.688787</td>\n",
" <td>0.464985</td>\n",
" <td>0.87002</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" evaluation_type confusion_matrix \\\n",
"0 Classification DenseMatrix([[ 5797., 408.],\\n [... \n",
"\n",
" accuracy precision recall AUC \n",
"0 0.822389 0.688787 0.464985 0.87002 "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"metrics = ComputeModelStatistics().transform(prediction)\n",
"metrics.limit(10).toPandas()"
Expand All @@ -302,7 +109,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand Down Expand Up @@ -339,17 +146,9 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Response 0.0\n"
]
}
],
"outputs": [],
"source": [
"import requests\n",
"data = u'{\" education\":\" 10th\",\" marital-status\":\" Divorced\",\" hours-per-week\":40.0}'\n",
Expand All @@ -359,17 +158,9 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Response 1.0\n"
]
}
],
"outputs": [],
"source": [
"import requests\n",
"data = u'{\" education\":\" Masters\",\" marital-status\":\" Married-civ-spouse\",\" hours-per-week\":40.0}'\n",
Expand All @@ -379,7 +170,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {
"collapsed": true
},
Expand Down

0 comments on commit 0429242

Please sign in to comment.