Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
About
People
Publications
Teaching
Resources
Research Blog
Wiki Functions
Recent changes
Help
Licensing
Project page
Discussion
Edit
View history
Editing
CommunityData:CDSC Reddit
(section)
From CommunityData
Jump to:
navigation
,
search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Methods === [https://en.wikipedia.org/wiki/Tf%E2%80%93idf TF-IDF] is common and simple information retrieval technique that we can use to quantify the topic of a subreddit. The goal of TF-IDF is to build a vector for each subreddit that scores every term (or phrase) according to how characteristic it is of the overall lexicon used in that subreddit. For example, the most characteristic terms in the subreddit /r/christianity in the current version of the TF-IDF model are: {| !align="center"| Term !align="center"| tf_idf |- |align="center"| christians |align="center"| 0.581 |- |align="center"| christianity |align="center"| 0.569 |- |align="center"| kjv |align="center"| 0.568 |- |align="center"| bible |align="center"| 0.557 |- |align="center"| scripture |align="center"| 0.55 |} TF-IDF stands for “term frequency - inverse document frequency” because it is the product of two terms “term frequency” and “inverse document frequency.” Term frequency quantifies the amount that a term appears in a subreddit (document). Inverse document frequency quantifies how much that term appears in other subreddits (documents). As you can see on the Wikipedia page, there are many possible ways of constructing and combining these terms. <math display="inline">x + y = z_{1,d}</math> I chose to normalize term frequency by the maximum (raw) term frequency for each subreddit: <math display="inline">\mathrm{tf}_{t,d} = \frac{f_{t,d}}{\sum_{t^{'} \in d}{f_{t^{'},d}}}</math> I use the log inverse document frequency: <math display="inline">\mathrm{idf}_{t} = log\frac{N}{| {d \in D : t \in d} |}</math> I then combine them using some smoothing to get: <math display="inline">\mathrm{tfidf}_{t,d} = (0.5 + 0.5 \cdot \mathrm{tf}_{t,d}) \cdot \mathrm{idf}_{t}</math>
Summary:
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see
CommunityData:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:
Cancel
Editing help
(opens in new window)
Tools
What links here
Related changes
Special pages
Page information