Skip to content

Commit

Permalink
Visual enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Sokolov committed Apr 23, 2019
1 parent 475f6ac commit eea2bd3
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions Recommendation/MLPMF.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
"# Recommend movies using Matrix Factorization with Gluon"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Demonstrates matrix factorization with MXNet on the MovieLens 100k dataset. We perform collaborative filtering, where the recommendations are based on previous rating of users.\n",
"\n",
"We are trying to learn embeddings for users and movies, based on user partial ratings of movies, to estimate future movie ratings\n",
"\n",
"![](https://i.imgur.com/twyWChh.png)"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down Expand Up @@ -353,9 +364,16 @@
"net.collect_params()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Visualize network"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 28,
"metadata": {
"slideshow": {
"slide_type": "skip"
Expand Down Expand Up @@ -510,19 +528,16 @@
"</svg>\n"
],
"text/plain": [
"<graphviz.dot.Digraph at 0x105d2e9b0>"
"<graphviz.dot.Digraph at 0x119f87780>"
]
},
"execution_count": 9,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"input_sym1 = mx.sym.var('user')\n",
"input_sym2 = mx.sym.var('item')\n",
"output_sym = net(input_sym1, input_sym2)\n",
"mx.viz.plot_network(output_sym, )"
"mx.viz.plot_network(net(mx.sym.var('user'), mx.sym.var('item')))"
]
},
{
Expand Down Expand Up @@ -759,7 +774,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 25,
"metadata": {},
"outputs": [
{
Expand All @@ -770,14 +785,22 @@
"<NDArray 10 @cpu(0)>"
]
},
"execution_count": 24,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"recommend_k_items_for_user(10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# More examples of MXNet-based recommenders\n",
"https://github.com/apache/incubator-mxnet/blob/master/example/recommenders/demo1-MF.ipynb"
]
}
],
"metadata": {
Expand Down

0 comments on commit eea2bd3

Please sign in to comment.