Set random seeds where applicable

This commit is contained in:
Alexander Hess 2024-07-15 11:26:43 +02:00
commit f0d92ed229
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
3 changed files with 82 additions and 48 deletions

View file

@ -761,9 +761,9 @@
{
"data": {
"text/plain": [
"array([1, 0, 2, 2, 1, 0, 1, 1, 1, 0, 0, 2, 2, 0, 0, 2, 0, 1, 0, 0, 2, 2,\n",
" 0, 2, 1, 0, 2, 2, 2, 1, 0, 1, 1, 2, 0, 1, 2, 1, 2, 1, 2, 1, 0, 1,\n",
" 0])"
"array([2, 1, 2, 1, 2, 2, 1, 1, 0, 2, 0, 0, 2, 2, 0, 2, 1, 0, 0, 0, 1, 0,\n",
" 1, 2, 2, 1, 1, 1, 1, 0, 2, 2, 1, 0, 2, 0, 0, 0, 0, 1, 1, 0, 2, 2,\n",
" 1])"
]
},
"execution_count": 19,
@ -772,7 +772,7 @@
}
],
"source": [
"X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.7, test_size=0.3, stratify=y)\n",
"X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.7, test_size=0.3, random_state=42, stratify=y)\n",
"\n",
"y_test"
]
@ -869,9 +869,9 @@
{
"data": {
"text/plain": [
"array([1, 0, 2, 2, 1, 0, 1, 1, 1, 0, 0, 2, 1, 0, 0, 2, 0, 2, 0, 0, 2, 2,\n",
" 0, 2, 1, 0, 2, 1, 2, 1, 0, 1, 1, 2, 0, 1, 2, 1, 2, 1, 2, 1, 0, 1,\n",
" 0])"
"array([2, 1, 2, 1, 2, 2, 1, 1, 0, 2, 0, 0, 2, 2, 0, 2, 1, 0, 0, 0, 1, 0,\n",
" 1, 2, 2, 1, 1, 1, 1, 0, 2, 2, 1, 0, 2, 0, 0, 0, 0, 1, 1, 0, 1, 2,\n",
" 1])"
]
},
"execution_count": 23,
@ -898,9 +898,9 @@
{
"data": {
"text/plain": [
"array([1, 0, 2, 2, 1, 0, 1, 1, 1, 0, 0, 2, 2, 0, 0, 2, 0, 1, 0, 0, 2, 2,\n",
" 0, 2, 1, 0, 2, 2, 2, 1, 0, 1, 1, 2, 0, 1, 2, 1, 2, 1, 2, 1, 0, 1,\n",
" 0])"
"array([2, 1, 2, 1, 2, 2, 1, 1, 0, 2, 0, 0, 2, 2, 0, 2, 1, 0, 0, 0, 1, 0,\n",
" 1, 2, 2, 1, 1, 1, 1, 0, 2, 2, 1, 0, 2, 0, 0, 0, 0, 1, 1, 0, 2, 2,\n",
" 1])"
]
},
"execution_count": 24,
@ -927,7 +927,7 @@
{
"data": {
"text/plain": [
"(array([12, 17, 27]),)"
"(array([42]),)"
]
},
"execution_count": 25,
@ -954,7 +954,7 @@
{
"data": {
"text/plain": [
"np.float64(0.9333333333333333)"
"np.float64(0.9777777777777777)"
]
},
"execution_count": 26,
@ -981,7 +981,7 @@
{
"data": {
"text/plain": [
"np.float64(0.9523809523809523)"
"np.float64(0.9714285714285714)"
]
},
"execution_count": 27,
@ -1066,35 +1066,35 @@
"name": "stdout",
"output_type": "stream",
"text": [
"1 0.9555555555555556\n",
"2 0.9333333333333333\n",
"3 0.9333333333333333\n",
"4 0.9333333333333333\n",
"5 0.9333333333333333\n",
"1 0.9333333333333333\n",
"2 0.9111111111111111\n",
"3 0.9555555555555556\n",
"4 0.9555555555555556\n",
"5 0.9777777777777777\n",
"6 0.9333333333333333\n",
"7 0.9111111111111111\n",
"8 0.9111111111111111\n",
"9 0.9111111111111111\n",
"10 0.9333333333333333\n",
"11 0.9555555555555556\n",
"12 0.9555555555555556\n",
"7 0.9555555555555556\n",
"8 0.9333333333333333\n",
"9 0.9555555555555556\n",
"10 0.9555555555555556\n",
"11 0.9333333333333333\n",
"12 0.9333333333333333\n",
"13 0.9333333333333333\n",
"14 0.9111111111111111\n",
"15 0.9333333333333333\n",
"16 0.9111111111111111\n",
"17 0.9333333333333333\n",
"18 0.9111111111111111\n",
"19 0.9333333333333333\n",
"14 0.9333333333333333\n",
"15 0.9555555555555556\n",
"16 0.9555555555555556\n",
"17 0.9555555555555556\n",
"18 0.9555555555555556\n",
"19 0.9555555555555556\n",
"20 0.9333333333333333\n",
"21 0.9333333333333333\n",
"21 0.9555555555555556\n",
"22 0.9333333333333333\n",
"23 0.9111111111111111\n",
"24 0.9555555555555556\n",
"25 0.9111111111111111\n",
"26 0.9333333333333333\n",
"27 0.9111111111111111\n",
"28 0.9333333333333333\n",
"29 0.9555555555555556\n",
"23 0.9555555555555556\n",
"24 0.9333333333333333\n",
"25 0.9333333333333333\n",
"26 0.9555555555555556\n",
"27 0.9333333333333333\n",
"28 0.9111111111111111\n",
"29 0.9111111111111111\n",
"30 0.9111111111111111\n"
]
}