Skip to content

Commit

Permalink
use pandas dtype helper in example notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
MainRo committed Oct 8, 2021
1 parent 9be960d commit a3241a6
Showing 1 changed file with 29 additions and 35 deletions.
64 changes: 29 additions & 35 deletions examples/convert.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,16 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 4,
"id": "corporate-bleeding",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/sah0023/venv/ebm2onnx/lib/python3.6/site-packages/sklearn/utils/validation.py:63: DataConversionWarning:\n",
"\n",
"A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
"\n"
"/home/sah0023/venv/ebm2onnx/lib/python3.6/site-packages/sklearn/utils/validation.py:63: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" return f(*args, **kwargs)\n"
]
},
{
Expand All @@ -237,7 +235,7 @@
" interactions=2)"
]
},
"execution_count": 10,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -260,7 +258,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 5,
"id": "canadian-telephone",
"metadata": {
"scrolled": false
Expand All @@ -269,8 +267,8 @@
{
"data": {
"text/html": [
"<!-- http://127.0.0.1:7001/140115281061760/ -->\n",
"<iframe src=\"http://127.0.0.1:7001/140115281061760/\" width=100% height=800 frameBorder=\"0\"></iframe>"
"<!-- http://127.0.0.1:7001/140010521935944/ -->\n",
"<iframe src=\"http://127.0.0.1:7001/140010521935944/\" width=100% height=800 frameBorder=\"0\"></iframe>"
]
},
"metadata": {},
Expand All @@ -293,18 +291,14 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 7,
"id": "vocational-globe",
"metadata": {},
"outputs": [],
"source": [
"onnx_model = ebm2onnx.to_onnx(\n",
" model=ebm,\n",
" dtype={\n",
" 'Age': 'double',\n",
" 'Fare': 'double',\n",
" 'Pclass': 'int',\n",
" },\n",
" dtype=ebm2onnx.get_dtype_from_pandas(x_train),\n",
" name=\"ebm\",\n",
")"
]
Expand All @@ -319,7 +313,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 8,
"id": "appropriate-powder",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -351,18 +345,18 @@
" <tbody>\n",
" <tr>\n",
" <th>Precision</th>\n",
" <td>1.000000</td>\n",
" <td>0.750000</td>\n",
" <td>0.500000</td>\n",
" <td>0.738095</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Recall</th>\n",
" <td>0.153846</td>\n",
" <td>1.000000</td>\n",
" <td>0.939394</td>\n",
" </tr>\n",
" <tr>\n",
" <th>FScore</th>\n",
" <td>0.266667</td>\n",
" <td>0.857143</td>\n",
" <td>0.235294</td>\n",
" <td>0.826667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Support</th>\n",
Expand All @@ -375,13 +369,13 @@
],
"text/plain": [
" 0 1\n",
"Precision 1.000000 0.750000\n",
"Recall 0.153846 1.000000\n",
"FScore 0.266667 0.857143\n",
"Precision 0.500000 0.738095\n",
"Recall 0.153846 0.939394\n",
"FScore 0.235294 0.826667\n",
"Support 13.000000 33.000000"
]
},
"execution_count": 14,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -401,7 +395,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 9,
"id": "described-beatles",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -440,18 +434,18 @@
" <tbody>\n",
" <tr>\n",
" <th>Precision</th>\n",
" <td>1.000000</td>\n",
" <td>0.750000</td>\n",
" <td>0.500000</td>\n",
" <td>0.738095</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Recall</th>\n",
" <td>0.153846</td>\n",
" <td>1.000000</td>\n",
" <td>0.939394</td>\n",
" </tr>\n",
" <tr>\n",
" <th>FScore</th>\n",
" <td>0.266667</td>\n",
" <td>0.857143</td>\n",
" <td>0.235294</td>\n",
" <td>0.826667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Support</th>\n",
Expand All @@ -464,13 +458,13 @@
],
"text/plain": [
" 0 1\n",
"Precision 1.000000 0.750000\n",
"Recall 0.153846 1.000000\n",
"FScore 0.266667 0.857143\n",
"Precision 0.500000 0.738095\n",
"Recall 0.153846 0.939394\n",
"FScore 0.235294 0.826667\n",
"Support 13.000000 33.000000"
]
},
"execution_count": 15,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit a3241a6

Please sign in to comment.