Updates and fixes

This commit is contained in:
Sylvain Gugger
2020-03-31 13:57:32 -07:00
parent 5f20883426
commit d7094481f5
8 changed files with 50 additions and 87 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -966,9 +966,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [
{
"data": {
@@ -1135,7 +1133,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1569,18 +1567,6 @@
"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.7.4"
}
},
"nbformat": 4,

View File

@@ -411,8 +411,7 @@
"source": [
"bears = bears.new(item_tfms=RandomResizedCrop(128, min_scale=0.3))\n",
"dls = bears.dataloaders(path)\n",
"dls.train.get_idxs = lambda: Inf.ones\n",
"dls.train.show_batch(max_n=4, nrows=1)"
"dls.train.show_batch(max_n=4, nrows=1, unique=True)"
]
},
{
@@ -443,8 +442,7 @@
"source": [
"bears = bears.new(item_tfms=Resize(128), batch_tfms=aug_transforms(mult=2))\n",
"dls = bears.dataloaders(path)\n",
"dls.train.get_idxs = lambda: Inf.ones\n",
"dls.train.show_batch(max_n=8, nrows=2)"
"dls.train.show_batch(max_n=8, nrows=2, unique=True)"
]
},
{
@@ -1082,18 +1080,6 @@
"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.7.4"
}
},
"nbformat": 4,

View File

@@ -1182,7 +1182,7 @@
}
],
"source": [
"movie_bias = learn.model.movie_bias.weight.squeeze()\n",
"movie_bias = learn.model.movie_bias.squeeze()\n",
"idxs = movie_bias.argsort()[:5]\n",
"[dls.classes['title'][i] for i in idxs]"
]
@@ -1236,7 +1236,7 @@
"g = ratings.groupby('title')['rating'].count()\n",
"top_movies = g.sort_values(ascending=False).index.values[:1000]\n",
"top_idxs = tensor([learn.dls.classes['title'].o2i[m] for m in top_movies])\n",
"movie_w = learn.model.movie_factors.weight[top_idxs].cpu().detach()\n",
"movie_w = learn.model.movie_factors[top_idxs].cpu().detach()\n",
"movie_pca = movie_w.pca(3)\n",
"fac0,fac1,fac2 = movie_pca.t()\n",
"idxs = np.random.choice(len(top_movies), 50, replace=False)\n",
@@ -1703,6 +1703,18 @@
"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.7.4"
}
},
"nbformat": 4,