Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Fix> evaluation dataset, printed samples #836

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions 08-seq_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
"\n",
" with torch.no_grad():\n",
" for batch_idx in range(len(data_generator)):\n",
" data, target = test_data_gen[batch_idx]\n",
" data, target = data_generator[batch_idx]\n",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to inspect sequences from the test set, no?
I didn't get it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why are we declaring the "data_generator", with a different seed, and not using it to sample data?

" data, target = torch.from_numpy(data).float().to(device), torch.from_numpy(target).long().to(device)\n",
"\n",
" data_decoded = data_generator.decode_x_batch(data.cpu().numpy())\n",
Expand Down Expand Up @@ -527,18 +527,22 @@
" print(f'{label}: {num_correct} / {count_classes[label]} correct')\n",
"\n",
" # Report some random sequences for examination\n",
" num_sequences_to_print = min(10, len(correct))\n",
" idxs = random.sample(range(len(correct)), num_sequences_to_print)\n",
"\n",
" print('\\nHere are some example sequences:')\n",
" for i in range(10):\n",
" sequence, truth, prediction = correct[random.randrange(0, 10)]\n",
" for i in idxs:\n",
" sequence, truth, prediction = correct[i]\n",
" print(f'{sequence} -> {truth} was labelled {prediction}')\n",
"\n",
" # Report misclassified sequences for investigation\n",
" if incorrect and verbose:\n",
" print('\\nThe following sequences were misclassified:')\n",
" for sequence, truth, prediction in incorrect:\n",
" print(f'{sequence} -> {truth} was labelled {prediction}')\n",
" else:\n",
" print('\\nThere were no misclassified sequences.')"
" if verbose:\n",
" if incorrect:\n",
" print('\\nThe following sequences were misclassified:')\n",
" for sequence, truth, prediction in incorrect:\n",
" print(f'{sequence} -> {truth} was labelled {prediction}')\n",
" else:\n",
" print('\\nThere were no misclassified sequences.')"
]
},
{
Expand Down