Skip to content

Commit

Permalink
Fix hash() bug reported by Thiago
Browse files Browse the repository at this point in the history
  • Loading branch information
ageron committed Nov 3, 2016
1 parent 8ec0636 commit ae81f69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 02_end_to_end_machine_learning_project.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
"import hashlib\n",
"\n",
"def test_set_check(identifier, test_ratio, hash):\n",
" return hash(identifier).digest()[-1] < 256 * test_ratio\n",
" return hash(str(identifier).encode(\"ascii\")).digest()[-1] < 256 * test_ratio\n",
"\n",
"def split_train_test_by_id(data, test_ratio, id_column, hash=hashlib.md5):\n",
" ids = data[id_column]\n",
Expand Down Expand Up @@ -3438,7 +3438,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"version": "3.5.2"
},
"nav_menu": {
"height": "279px",
Expand Down

0 comments on commit ae81f69

Please sign in to comment.