Rajesh6 commited on
Commit
ed78dd2
·
verified ·
1 Parent(s): 8538b58

Update pages/Introduction.py

Browse files
Files changed (1) hide show
  1. pages/Introduction.py +4 -23
pages/Introduction.py CHANGED
@@ -61,27 +61,8 @@ st.write("Vector for “I love NLP”: [1, 1, 1, 0, 0]")
61
 
62
 
63
  st.markdown('<p style="color:lightblue;"><b>b. Term Frequency-Inverse Document Frequency (TF-IDF)</b></p>', unsafe_allow_html=True)
64
- st.write("**TF-IDF** stands for Term Frequency Inverse Document Frequency of records. It can be defined as the calculation of how relevant a word in a series or corpus is to a text. The meaning increases proportionally to the number of times in the text a word appears but is compensated by the word frequency in the corpus (data-set).")
65
- st.write("**Term Frequency:** In document d, the frequency represents the number of instances of a given word t. Therefore, we can see that it becomes more relevant when a word appears in the text, which is rational. Since the ordering of terms is not significant, we can use a vector to describe the text in the bag of term models. For each specific term in the paper, there is an entry with the value being the term frequency.")
66
- st.write("The weight of a term that occurs in a document is simply proportional to the term frequency.\n tf(t,d) = count of t in d / number of words in d")
67
-
68
- st.write("**Document Frequency:** This tests the meaning of the text, which is very similar to TF, in the whole corpus collection. The only difference is that in document d, TF is the frequency counter for a term t, while df is the number of occurrences in the document set N of the term t. In other words, the number of papers in which the word is present is DF.")
69
-
70
-
71
- st.write("Inverse Document Frequency: Mainly, it tests how relevant the word is. The key aim of the search is to locate the appropriate records that fit the demand. Since tf considers all terms equally significant, it is therefore not only possible to use the term frequencies to measure the weight of the term in the paper. First, find the document frequency of a term t by counting the number of documents containing the term:\n df(t) = occurrence of t in documents")
72
-
73
- st.write("""
74
- df(t) = N(t)
75
- where:
76
- - df(t) = Document frequency of a term t
77
- - N(t) = Number of documents containing the term t
78
- """)
79
-
80
-
81
-
82
- st.write("Term frequency is the number of instances of a term in a single document only; although the frequency of the document is the number of separate documents in which the term appears, it depends on the entire corpus. Now let’s look at the definition of the frequency of the inverse paper. The IDF of the word is the number of documents in the corpus separated by the frequency of the text.\n idf(t) = N/ df(t) = N/N(t)")
83
- st.write("The more common word is supposed to be considered less significant, but the element (most definite integers) seems too harsh. We then take the logarithm (with base 2) of the inverse frequency of the paper. So the if of the term t becomes: \n idf(t) = log(N/ df(t))")
84
-
85
-
86
-
87
 
 
 
 
 
61
 
62
 
63
  st.markdown('<p style="color:lightblue;"><b>b. Term Frequency-Inverse Document Frequency (TF-IDF)</b></p>', unsafe_allow_html=True)
64
+ st.write("The **TF-IDF Vectorizer** is a popular technique in Natural Language Processing (NLP) used to convert text into numerical values that can be used by machine learning models. It stands for Term Frequency-Inverse Document Frequency and helps highlight the importance of words in a document relative to a collection of documents (called a corpus).")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
+ st.write("**Term Frequency (TF)** \n - Measures how often a word appears in a single document. \n - Formula: \n _ TF _ = Number of times the word appears in the document / Total number of words in the document" )
67
+ st.write("**Inverse Document Frequency (IDF)** \n Measures how unique or rare a word is across all documents in the corpus. \n - Formula: \n _ IDF _ = log(Total no.of documents / No of Documnets containing the word) \n Words that appear in many documents (like "the" or "and") will have a low IDF value, while unique words (like "NLP") will have a higher IDF.")
68
+ st.write("**TF - IDF Score: \n - Combines TF and IDF to calculate the importance of a word in a document. \n - Formula: \n TF - IDF = TF x IDF \n Words that are frequent in a document but rare in the overall corpus get a higher score.")