Skip to content

Commit 9a11fcf

Browse files
committed
fix(nlp) names gender updates
1 parent 4c920ec commit 9a11fcf

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

rnns/Names gender 1.ipynb

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"**Work in progress**\n",
1212
"\n",
13-
"## Extra: Text one-hot encoding, names part 1\n",
13+
"## RNN: Text one-hot encoding, names part 1\n",
1414
"\n",
1515
"We use [US Baby Names - Kaggle Dataset](https://www.kaggle.com/kaggle/us-baby-names).\n",
1616
"If needed, you can use: `!wget https://www.dropbox.com/s/s14l44ptqevgech/NationalNames.csv.zip?dl=1`\n",
@@ -49,7 +49,7 @@
4949
"metadata": {},
5050
"outputs": [],
5151
"source": [
52-
"names = pd.read_csv(\"NationalNames.csv\")"
52+
"names = pd.read_csv(\"./data/NationalNames.csv\")"
5353
]
5454
},
5555
{
@@ -283,7 +283,7 @@
283283
"metadata": {},
284284
"outputs": [],
285285
"source": [
286-
"with h5py.File(\"names.h5\") as f:\n",
286+
"with h5py.File(\"data/names_dense.h5\") as f:\n",
287287
" f.create_dataset('X_train', data=X_train)\n",
288288
" f.create_dataset('y_train', data=y_train)\n",
289289
" f.create_dataset('X_test', data=X_test)\n",
@@ -302,9 +302,9 @@
302302
],
303303
"metadata": {
304304
"kernelspec": {
305-
"display_name": "Python [default]",
305+
"display_name": "Python [conda env:py37]",
306306
"language": "python",
307-
"name": "python3"
307+
"name": "conda-env-py37-py"
308308
},
309309
"language_info": {
310310
"codemirror_mode": {
@@ -316,7 +316,7 @@
316316
"name": "python",
317317
"nbconvert_exporter": "python",
318318
"pygments_lexer": "ipython3",
319-
"version": "3.5.4"
319+
"version": "3.7.2"
320320
},
321321
"varInspector": {
322322
"cols": {

rnns/Names gender 2.ipynb

+13-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"**Work in progress**\n",
1212
"\n",
13-
"## Extra: LSTMs for on-hot encoded data\n",
13+
"## RNNs: LSTMs for on-hot encoded data\n",
1414
"\n",
1515
"We use recurrent networks. For wonderful introductions:\n",
1616
"\n",
@@ -29,6 +29,15 @@
2929
"* [Contiguous() and permute()](https://discuss.pytorch.org/t/contiguous-and-permute/20673)"
3030
]
3131
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": null,
35+
"metadata": {},
36+
"outputs": [],
37+
"source": [
38+
"!pip install livelossplot --quiet"
39+
]
40+
},
3241
{
3342
"cell_type": "code",
3443
"execution_count": 1,
@@ -54,7 +63,7 @@
5463
"metadata": {},
5564
"outputs": [],
5665
"source": [
57-
"with h5py.File(\"../data/preprocessed/names.h5\", 'r') as data:\n",
66+
"with h5py.File(\"./data/names_dense.h5\", 'r') as data:\n",
5867
" X_train = data['X_train'].value\n",
5968
" y_train = data['y_train'].value\n",
6069
" X_test = data['X_test'].value\n",
@@ -79,9 +88,9 @@
7988
"metadata": {},
8089
"outputs": [],
8190
"source": [
82-
"print(X_train.shape) # should be: (24783, 26, 15)\n",
91+
"print(X_train.shape) # should be: (24783, 26, 16)\n",
8392
"print(y_train.shape) # should be: (24783)\n",
84-
"print(X_test.shape) # should be: (8261, 26, 15)\n",
93+
"print(X_test.shape) # should be: (8261, 26, 16)\n",
8594
"print(y_test.shape) # should be: (8261)"
8695
]
8796
},

rnns/Word vectors.ipynb

+12
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,18 @@
465465
"language": "python",
466466
"name": "conda-env-py37-py"
467467
},
468+
"language_info": {
469+
"codemirror_mode": {
470+
"name": "ipython",
471+
"version": 3
472+
},
473+
"file_extension": ".py",
474+
"mimetype": "text/x-python",
475+
"name": "python",
476+
"nbconvert_exporter": "python",
477+
"pygments_lexer": "ipython3",
478+
"version": "3.7.2"
479+
},
468480
"varInspector": {
469481
"cols": {
470482
"lenName": 16,

0 commit comments

Comments
 (0)