Skip to content

Commit

Permalink
retrain Binary-classification
Browse files Browse the repository at this point in the history
  • Loading branch information
linjing-lab committed Oct 27, 2023
1 parent b998e35 commit 2b84694
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 29 deletions.
Binary file modified released_box/models/credit.ckpt
Binary file not shown.
80 changes: 51 additions & 29 deletions released_box/tests/Binary-classification Task.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
{
"data": {
"text/plain": [
"((30000, 23), (30000,))"
"'1: 6636, 0: 23364'"
]
},
"execution_count": 5,
Expand All @@ -350,6 +350,27 @@
}
],
"source": [
"'1: {}, 0: {}'.format(numpy.sum(labels == 1), numpy.sum(labels == 0)) # nums of 1 and 0"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"((30000, 23), (30000,))"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# dataset are imbalanced by labels\n",
"features.shape, labels.shape"
]
},
Expand All @@ -371,7 +392,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -406,7 +427,7 @@
" ('device', device(type='cuda'))])"
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -429,7 +450,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -446,23 +467,24 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch [1/2], Step [100/3000], Training Loss: 828.4427, Validation Loss: 1241.4515\n",
"Epoch [1/2], Step [200/3000], Training Loss: 94.2689, Validation Loss: 64.1411\n",
"Epoch [1/2], Step [300/3000], Training Loss: 0.3855, Validation Loss: 14.7295\n",
"Epoch [1/2], Step [400/3000], Training Loss: 0.3561, Validation Loss: 4.1548\n",
"Epoch [1/2], Step [500/3000], Training Loss: 2.6463, Validation Loss: 4.9783\n",
"Epoch [1/2], Step [600/3000], Training Loss: 0.4240, Validation Loss: 3.0171\n",
"Epoch [1/2], Step [700/3000], Training Loss: 3.8731, Validation Loss: 1.5793\n",
"Epoch [1/2], Step [800/3000], Training Loss: 0.2598, Validation Loss: 0.9340\n",
"Epoch [1/2], Step [900/3000], Training Loss: 0.5623, Validation Loss: 0.7461\n",
"Epoch [1/2], Step [1000/3000], Training Loss: 0.7324, Validation Loss: 0.6750\n",
"Epoch [1/2], Step [100/3000], Training Loss: 0.0000, Validation Loss: 751.9165\n",
"Epoch [1/2], Step [200/3000], Training Loss: 151.6677, Validation Loss: 147.1012\n",
"Epoch [1/2], Step [300/3000], Training Loss: 11.5891, Validation Loss: 11.9286\n",
"Epoch [1/2], Step [400/3000], Training Loss: 102.6795, Validation Loss: 6.6973\n",
"Epoch [1/2], Step [500/3000], Training Loss: 0.2132, Validation Loss: 4.4743\n",
"Epoch [1/2], Step [600/3000], Training Loss: 3.4273, Validation Loss: 3.1016\n",
"Epoch [1/2], Step [700/3000], Training Loss: 0.6728, Validation Loss: 1.4565\n",
"Epoch [1/2], Step [800/3000], Training Loss: 0.3786, Validation Loss: 8.3835\n",
"Epoch [1/2], Step [900/3000], Training Loss: 0.4249, Validation Loss: 1.1698\n",
"Epoch [1/2], Step [1000/3000], Training Loss: 0.5671, Validation Loss: 0.7559\n",
"Epoch [1/2], Step [1100/3000], Training Loss: 0.7306, Validation Loss: 0.9674\n",
"Process stop at epoch [1/2] with patience 10 within tolerance 0.001\n"
]
}
Expand All @@ -481,14 +503,14 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loss of Box on the 3000 test dataset: 1.061116337776184.\n"
"loss of Box on the 3000 test dataset: 1.4942820072174072.\n"
]
},
{
Expand All @@ -500,13 +522,13 @@
" ('column', ('label name', ('true numbers', 'total numbers'))),\n",
" ('labels', {0: [2282, 3000], 1: [2282, 3000]}),\n",
" ('loss',\n",
" {'train': 0.5675961375236511,\n",
" 'val': 0.6755267381668091,\n",
" 'test': 1.061116337776184}),\n",
" {'train': 0.2478877156972885,\n",
" 'val': 0.6973171234130859,\n",
" 'test': 1.4942820072174072}),\n",
" ('sorted', [(0, [2282, 3000]), (1, [2282, 3000])])])"
]
},
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -525,7 +547,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -545,7 +567,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -562,14 +584,14 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loss of Box on the 3000 test dataset: 1.0611168146133423.\n"
"loss of Box on the 3000 test dataset: 1.494282841682434.\n"
]
},
{
Expand All @@ -581,13 +603,13 @@
" ('column', ('label name', ('true numbers', 'total numbers'))),\n",
" ('labels', {0: [2282, 3000], 1: [2282, 3000]}),\n",
" ('loss',\n",
" {'train': 0.5675961375236511,\n",
" 'val': 0.6755267381668091,\n",
" 'test': 1.0611168146133423}),\n",
" {'train': 0.2478877156972885,\n",
" 'val': 0.6973171234130859,\n",
" 'test': 1.494282841682434}),\n",
" ('sorted', [(0, [2282, 3000]), (1, [2282, 3000])])])"
]
},
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit 2b84694

Please sign in to comment.