Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 24 pages
Summary

Summary of the JBC090 Lab Sessions and Exercises 2021/2022

Document preview thumbnail
Preview 2 out of 24 pages

This summary contains all the theory from the lab sessions and exercises given in the JBC090 course. This is an addition to the summary of the theory given in this course. This will help you prepare for the interim exam as well as the final exam, good luck!

Content preview

Lieve Göbbels
Cognitive Science II (JBC090)
Semester 1, 2021-2022




Cognitive Science II (exercises)
Introduction 2
Distances 2
tf*idf 2
Collecting Data 3
RegEx 3
Minimum Edit Distance 5
Classi cation 6
n-Gram language modeling 6
Regression prediction 8
Fitting regression 8
Evaluating (linear) regression 8
Evaluating classi cation 8
K-Nearest Neighbors 9
Information gain (Decision Trees) 9
Naive Bayes 9
Smoothing across techniques 10
Representation 11
Positive Pointwise Mutual Information (PPMI) 11
Forward propagation in Neural Nets 11
Hidden Markov models (HMM) 14
Recurrent Neural Network Language Model (RNNLM) 18
Lab 1 22
Lab 2 22
Lab 3 23
Lab 4 23
Lab 5 24

, Introduction
In short:
• Distances
• tf*idf




Distances
n
( p i⃗ − q i⃗ )2

Euclidian Distance:
i=1


|A ∩ B|
Jaccard coe cient: J(A, B) =
|A ∪ B|

p⃗∙ q⃗ n
p i⃗ ⋅ q i⃗

Cosine Similarity: where ∙=
p⃗∙ p⃗⋅ q ⃗∙ q ⃗ i=1


Note: p ⃗ ∙ p ⃗ is the ℓ2 norm for vector p .⃗ If one ℓ2 normalizes the full space, the denominator
drops and the cosine similarity becomes: ∥ p ⃗∥2 ∙ ∥ q ⃗∥2




tf*idf
N
wt,d = log(tf(t, d ) + 1) ⋅ logb dft
where tf = term frequency
df = document frequency
N = number of documents
b = base; typically 10 (log = ln; log10 = lg)

The term frequency refers to how many times the term t occurs in a document d. The document
frequency refers to in how many documents the term t occurs. When making a term frequency
matrix, the unique words (the vocabulary; features) are listed in the columns and the documents (or
their numbers, e.g. doc1, doc2) are listed in the rows. The values in the matrix are the counts of each
word in a particular document.

the cat sat on mat my

doc1 (the cat sat on the mat) 2 1 1 1 1 0

doc2 (my cat sat on my cat) 0 2 1 1 0 2


Using the aforementioned formula (wt,d), one can convert this tf matrix to a tf * idf matrix. For
example, wthe,1 = ln(2 + 1) ⋅ lg( 21 ) = 0.331.

Connected book
 image
Dan Jurafsky, James H. Martin Speech and Language Processing
Publisher: 2008-04-29 ISBN: 9780135041963 Edition: 2

Document information

Study
Summarized whole book?
Yes
Uploaded on
April 7, 2022
Number of pages
24
Written in
2021/2022
Type
Summary
$6.22

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Lieve12
4.4
(17)
Sold
172
Followers
118
Items
28
Last sold
6 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions