From b192f231e5c397dbec95e6c8562b4b3d12003d76 Mon Sep 17 00:00:00 2001 From: Lateefah Bello <2019cinnamon@gmail.com> Date: Sat, 7 May 2022 22:46:03 +0100 Subject: [PATCH] Lesson 13 --- etc/quiz-src/questions-en.txt | 26 +++++++++++++++++++ .../12-Segmentation/README.md | 1 - lessons/5-NLP/13-TextRep/README.md | 7 +++++ .../TextRepresentationPyTorch.ipynb | 5 ---- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/etc/quiz-src/questions-en.txt b/etc/quiz-src/questions-en.txt index 114fd548..3c21994f 100644 --- a/etc/quiz-src/questions-en.txt +++ b/etc/quiz-src/questions-en.txt @@ -266,6 +266,32 @@ Lesson 12E Segmentation: Post Quiz - height normalization - weight normalization +Lesson 13B Text Representation: Pre Quiz +* Each word in a Bag of Words is linked to a vector index ++ true +- false +* Text can be represented using _____ approaches +- 1 ++ 2 +- 3 +* Character level representation represents each _____ as a number ++ letter +- word +- symbol + +Lesson 13E Text Representation: Post Quiz +* Word level representation represents _____ as a number +- letter ++ word +- symbol +* N-Grams refers to _____ +- combination of n number of words and symbols +- combination of n number of letters ++ combination of n number of Words +* The main drawback of N-gram is that the vocabulary size grows fast ++ true +- false + Lesson 23B Multi-Agent Modeling: Pre Quiz * By modeling the behavior of simple agents, we can understand more complex behaviors of a system. + true diff --git a/lessons/4-ComputerVision/12-Segmentation/README.md b/lessons/4-ComputerVision/12-Segmentation/README.md index e2250b67..23f4f07e 100644 --- a/lessons/4-ComputerVision/12-Segmentation/README.md +++ b/lessons/4-ComputerVision/12-Segmentation/README.md @@ -64,4 +64,3 @@ This [wikipedia article](https://wikipedia.org/wiki/Image_segmentation) offers a ## [Assignment](lab/README.md) In this lab, try **human body segmentation** using [Segmentation Full Body MADS Dataset](https://www.kaggle.com/datasets/tapakah68/segmentation-full-body-mads-dataset) from Kaggle. - diff --git a/lessons/5-NLP/13-TextRep/README.md b/lessons/5-NLP/13-TextRep/README.md index fa5311ad..670e1d3a 100644 --- a/lessons/5-NLP/13-TextRep/README.md +++ b/lessons/5-NLP/13-TextRep/README.md @@ -1,5 +1,7 @@ # Representing Text as Tensors +## [Pre-lecture quiz](https://black-ground-0cc93280f.1.azurestaticapps.net/quiz/113) + ## Text Classification Throughout the first part of this course, we will focus on **text classification** task. We will use [AG News](https://www.kaggle.com/amananandrai/ag-news-classification-dataset) Dataset, which contains news articles like the following: @@ -21,6 +23,7 @@ If we want to solve Natural Language Processing (NLP) tasks with neural networks We understand what each letter **represents**, and how all characters come together to form the words of a sentence. However, computers by themselves do not have such an understanding, and neural network has to learn the meaning during training. Therefore, we can use different approaches when representing text: + * **Character-level representation**, when we represent text by treating each character as a number. Given that we have *C* different characters in our text corpus, the word *Hello* would be represented by 5x*C* tensor. Each letter would correspond to a tensor column in one-hot encoding. * **Word-level representation**, in which we create a **vocabulary** of all words in our text, and then represent words using one-hot encoding. This approach is somehow better, because each letter by itself does not have much meaning, and thus by using higher-level semantic concepts - words - we simplify the task for the neural network. However, given large dictionary size, we need to deal with high-dimensional sparse tensors. @@ -50,3 +53,7 @@ However, none of those approaches can fully take into account the semantics of t * [Text Representation with PyTorch](TextRepresentationPyTorch.ipynb) * [Text Representation with TensorFlow](TextRepresentationTF.ipynb) + +## [Post-lecture quiz](https://black-ground-0cc93280f.1.azurestaticapps.net/quiz/213) + +> ✅ Todo: conclusion, assignment, challenge, review. diff --git a/lessons/5-NLP/13-TextRep/TextRepresentationPyTorch.ipynb b/lessons/5-NLP/13-TextRep/TextRepresentationPyTorch.ipynb index 4cb34c33..15e0b4ab 100644 --- a/lessons/5-NLP/13-TextRep/TextRepresentationPyTorch.ipynb +++ b/lessons/5-NLP/13-TextRep/TextRepresentationPyTorch.ipynb @@ -542,11 +542,6 @@ "\n", "However even though TF-IDF representations provide frequency weight to different words they are unable to represent meaning or order. As the famous linguist J. R. Firth said in 1935, “The complete meaning of a word is always contextual, and no study of meaning apart from context can be taken seriously.”. We will learn later in the course how to capture contextual information from text using language modeling.\n" ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [] } ], "metadata": {