mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-02-03 21:47:50 +01:00
Fix hash() bug reported by Thiago
This commit is contained in:
@@ -235,7 +235,7 @@
|
|||||||
"import hashlib\n",
|
"import hashlib\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def test_set_check(identifier, test_ratio, hash):\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",
|
"\n",
|
||||||
"def split_train_test_by_id(data, test_ratio, id_column, hash=hashlib.md5):\n",
|
"def split_train_test_by_id(data, test_ratio, id_column, hash=hashlib.md5):\n",
|
||||||
" ids = data[id_column]\n",
|
" ids = data[id_column]\n",
|
||||||
@@ -1336,7 +1336,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.5.1"
|
"version": "3.5.2"
|
||||||
},
|
},
|
||||||
"nav_menu": {
|
"nav_menu": {
|
||||||
"height": "279px",
|
"height": "279px",
|
||||||
|
|||||||
Reference in New Issue
Block a user