Fix hash() bug reported by Thiago
parent
6714ec2979
commit
dabda0f806
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue