Skip to content

Commit

Permalink
Merge pull request #1092 from seanytak/seanytak/ncf_test_tuning
Browse files Browse the repository at this point in the history
seanytak/ncf test tuning
  • Loading branch information
miguelgfierro authored May 1, 2020
2 parents 3a981bb + 4f8a3f1 commit 069d050
Show file tree
Hide file tree
Showing 7 changed files with 1,066 additions and 115 deletions.
84 changes: 51 additions & 33 deletions notebooks/02_model/ncf_deep_dive.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,31 @@
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/anaconda/envs/recommenders_gpu/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
" _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n",
"/anaconda/envs/recommenders_gpu/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
" _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n",
"/anaconda/envs/recommenders_gpu/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
" _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n",
"/anaconda/envs/recommenders_gpu/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
" _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n",
"/anaconda/envs/recommenders_gpu/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
" _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n",
"/anaconda/envs/recommenders_gpu/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
" np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"System version: 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) \n",
"System version: 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54) \n",
"[GCC 7.3.0]\n",
"Pandas version: 0.24.2\n",
"Pandas version: 0.25.3\n",
"Tensorflow version: 1.12.0\n"
]
}
Expand Down Expand Up @@ -206,7 +224,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"4.93MB [00:00, 18.4MB/s] \n"
"100%|██████████| 4.81k/4.81k [00:00<00:00, 10.6kKB/s]\n"
]
},
{
Expand Down Expand Up @@ -380,7 +398,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Took 662.0558905601501 seconds for training.\n"
"Took 663.2377220259996 seconds for training.\n"
]
}
],
Expand Down Expand Up @@ -443,43 +461,43 @@
" <th>0</th>\n",
" <td>1.0</td>\n",
" <td>149.0</td>\n",
" <td>0.150561</td>\n",
" <td>0.029076</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1.0</td>\n",
" <td>88.0</td>\n",
" <td>0.307006</td>\n",
" <td>0.632505</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1.0</td>\n",
" <td>101.0</td>\n",
" <td>0.346554</td>\n",
" <td>0.492521</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1.0</td>\n",
" <td>110.0</td>\n",
" <td>0.185647</td>\n",
" <td>0.081617</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1.0</td>\n",
" <td>103.0</td>\n",
" <td>0.002877</td>\n",
" <td>0.004513</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" userID itemID prediction\n",
"0 1.0 149.0 0.150561\n",
"1 1.0 88.0 0.307006\n",
"2 1.0 101.0 0.346554\n",
"3 1.0 110.0 0.185647\n",
"4 1.0 103.0 0.002877"
"0 1.0 149.0 0.029076\n",
"1 1.0 88.0 0.632505\n",
"2 1.0 101.0 0.492521\n",
"3 1.0 110.0 0.081617\n",
"4 1.0 103.0 0.004513"
]
},
"execution_count": 8,
Expand Down Expand Up @@ -514,7 +532,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Took 2.801203966140747 seconds for prediction.\n"
"Took 3.0358772649997263 seconds for prediction.\n"
]
}
],
Expand Down Expand Up @@ -546,10 +564,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"MAP:\t0.044980\n",
"NDCG:\t0.189388\n",
"Precision@K:\t0.170626\n",
"Recall@K:\t0.094332\n"
"MAP:\t0.046273\n",
"NDCG:\t0.190750\n",
"Precision@K:\t0.173277\n",
"Recall@K:\t0.096688\n"
]
}
],
Expand Down Expand Up @@ -592,8 +610,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"HR:\t0.489403\n",
"NDCG:\t0.385408\n"
"HR:\t0.488564\n",
"NDCG:\t0.383339\n"
]
}
],
Expand Down Expand Up @@ -674,7 +692,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Took 514.4518468379974 seconds for training.\n"
"Took 513.9623115730001 seconds for training.\n"
]
}
],
Expand Down Expand Up @@ -717,7 +735,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Took 565.3551139831543 seconds for training.\n"
"Took 566.8783325639997 seconds for training.\n"
]
}
],
Expand Down Expand Up @@ -778,7 +796,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Took 660.8611929416656 seconds for training.\n"
"Took 655.1110815689999 seconds for training.\n"
]
}
],
Expand Down Expand Up @@ -807,7 +825,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Took 2.8479833602905273 seconds for prediction.\n"
"Took 3.083744528999887 seconds for prediction.\n"
]
}
],
Expand Down Expand Up @@ -839,10 +857,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"MAP:\t0.041600\n",
"NDCG:\t0.174057\n",
"Precision@K:\t0.160657\n",
"Recall@K:\t0.091654\n"
"MAP:\t0.043232\n",
"NDCG:\t0.181301\n",
"Precision@K:\t0.165111\n",
"Recall@K:\t0.094437\n"
]
}
],
Expand Down Expand Up @@ -919,9 +937,9 @@
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "reco_gpu",
"display_name": "Python (recommenders_gpu)",
"language": "python",
"name": "reco_gpu"
"name": "recommenders_gpu"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -933,9 +951,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.6.10"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}
1 change: 1 addition & 0 deletions notebooks/04_model_select_and_optimize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ In this directory, notebooks are provided to demonstrate how to tune and optimiz
| [azureml_hyperdrive_wide_and_deep](azureml_hyperdrive_wide_and_deep.ipynb) | Quickstart tutorial on utilizing [Azure Machine Learning service](https://azure.microsoft.com/en-us/services/machine-learning-service/) for hyperparameter tuning of wide-and-deep model.
| [azureml_hyperdrive_surprise_svd](azureml_hyperdrive_surprise_svd.ipynb) | Quickstart tutorial on utilizing [Azure Machine Learning service](https://azure.microsoft.com/en-us/services/machine-learning-service/) for hyperparameter tuning of the matrix factorization method SVD from [Surprise library](https://surprise.readthedocs.io/en/stable/).
| [nni_surprise_svd](nni_surprise_svd.ipynb) | Quickstart tutorial on utilizing the [Neural Network Intelligence toolkit](https://github.com/Microsoft/nni) for hyperparameter tuning of the matrix factorization method SVD from [Surprise library](https://surprise.readthedocs.io/en/stable/).
| [nni_ncf](nni_ncf.ipynb) | Quickstart tutorial on utilizing the [Neural Network Intelligence toolkit](https://github.com/Microsoft/nni) as a tool to tune the [NCF model](../02_model/ncf_deep_dive.ipynb) and [SVD model](../02_model/surprise_svd_deep_dive.ipynb) and compare their performance against one another

### Prerequisites
To run the examples running on the Azure Machine Learning service, the [`azureml-sdk`](https://pypi.org/project/azureml-sdk/) is required. The AzureML Python SDK is already installed after setting up the conda environments from this repository (see [SETUP.md](../../SETUP.md)).
Expand Down
Loading

0 comments on commit 069d050

Please sign in to comment.