Skip to content

Lab 6 - #6

Open
tutoringjedi wants to merge 6 commits into
mainfrom
lab_6
Open

Lab 6#6
tutoringjedi wants to merge 6 commits into
mainfrom
lab_6

Conversation

@tutoringjedi

Copy link
Copy Markdown
Owner

PULL REQUEST TITLE: UofT-DSI | Deep Learning - Lab 6
What changes are you trying to make?
Completing the two open exercises in lab_6.ipynb (the text classification notebook):

Filled in the "evaluate the model" exercise — computes test loss/accuracy for the simple CBOW model, gets predictions on the test set, identifies a misclassified document, and prints its true label, predicted label, and text
Filled in the "build a more complex model" exercise — replaced the empty Sequential([# Your code here]) placeholder with an Embedding → Conv1D(128, kernel_size=5) → GlobalMaxPooling1D → Dense(128, relu) → Dropout(0.5) → Dense(5, softmax) architecture

What did you learn from the changes you have made?
Chose a Conv1D-based architecture over an LSTM for the "more complex model" exercise, since with 1000-token sequences and only ~1780 training documents, an LSTM would be noticeably slower to train on CPU with little accuracy benefit — a small 1D convolutional network captures local n-gram-like patterns efficiently and trains fast. Also reinforced the notebook's core lesson: for small/medium text classification datasets, simple methods (CountVectorizer + LogisticRegression, ~95% test accuracy) are hard to beat with deep learning trained from scratch, so neither Keras model was expected to significantly outperform the baseline.
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
Considered an LSTM-based model instead, as suggested in the exercise prompt, and also considered stacking two Conv1D + MaxPooling1D blocks before pooling. Went with a single Conv1D + GlobalMaxPooling1D block for simplicity and faster training, given the small dataset size.
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
No bugs to debug this time — the notebook was already structurally sound aside from the two open exercises. The main constraint was validating the code without full execution: my working environment doesn't have network access to download the BBC dataset or GloVe embeddings, nor a local TensorFlow install, so I verified correctness by syntax-checking every cell and tracing variable dependencies (e.g., confirming to_categorical(target_test, num_classes=N_CLASSES) matches N_CLASSES used to build the model) rather than running it end-to-end.
How were these changes tested?
Ran a syntax check (ast.parse) across all 63 cells to confirm no errors. Traced the notebook's variable flow to confirm the new cells use variables (model, x_test, target_test, target_names, texts_test, N_CLASSES, MAX_NB_WORDS, EMBEDDING_DIM) consistently with how they were defined earlier in the notebook. Full execution (dataset download, training, accuracy results) still needs to be run locally in your ML1/deep-learning-env environment to confirm actual runtime behavior.
A reference to a related issue in your repository (if applicable)
(add issue link here if you have one)
Checklist

[X] I can confirm that my changes are working as intended for lab_6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant