Questions tagged [tfidf]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
101 views

Why does using a standard scalar on my tf idf matrix make it perform better?

I have a TF-IDF matrix transformed on a list of tweets from a data set I am using. I have a pipeline where I initiate a StandardScalar and then next have my SVM with a linear kernel and auto gamma as ...
1
vote
1answer
31 views

tf-idf for sentence level features

Many papers mention comparing sentences using the tf-idf metric, e.g. Paper. They state: The first one is based on tf-idf where the value of the the corresponding dimension in the vector ...
1
vote
1answer
23 views

How to match a corpus with a string of words using a TF-IDF matrix?

I am trying to match strings of words with a website that has bulletpoints whose text is most similar to it. The way I thought of doing it is to get all of the documents from each bulletpoint into one ...
1
vote
0answers
25 views

Hashing trick for dimensionality reduction

I am building a model that uses TF-IDF NLP features in Spark Mllib. The TF-IDF HashingTF function in Mllib uses the 'hashing trick' to efficiently allocate terms to features. My question is: does the ...
1
vote
1answer
3k views

How to Combine tfidf with LSTM in keras?

I am classifying emails as spam or ham using LSTM and some of its modified form(by adding constitutional layer at the end). For converting documents into vectors I am using ...
3
votes
1answer
258 views

TF-IDF vs TF for classification

Let's suppose that I have a dataset of 1000 documents. Each document is a restaurant review (so relatively short text) and it has labels {Negative, Indifferent, Positive}. Let's suppose that the ...
0
votes
0answers
13 views

How does L1 normalisation work in Binary Classification?

I was working on a project where I was using TF*IDF algorithm. After applying grid search, I got the tfidf_norm=l1. Can someone explain how L1 normalisation form works in binary classification?(I have ...
0
votes
1answer
60 views

Is it good practice to remove the numeric values from the text data during preprocessing?

Im doing preprocessing on a text dataset. I have certain numerics in it like: date(1st July) year(2019) tentative values (3-5 years/ 10+ advantages). unique values (room no 31/ user rank 45) ...
1
vote
1answer
35 views

Given two large corpora of text from different sources, is there an accepted way to get differences in vocabulary (n-grams) between them?

Given two large corpora of text from different sources, is there an accepted way to get differences in vocabulary (n-grams) between them? That is, to get results which say that, for example, the ...
1
vote
3answers
44 views

Vectorize One line text data

How to vectorize one-line text data? I have used tf-idf including bigrams and trigrams but I am not able to get good results. I have purchase order descriptions which are one-liners and I need to ...
0
votes
2answers
65 views

Is this a good approach to classify tickets which contains description and logs?

I want to classify a dataset of support tickets which mostly contain text in the description field and sometimes server logs in a separate field. The log field is not always there but when it's ...
1
vote
3answers
780 views

How do I use TF*IDF scores for my machine learning model?

I have applied TF*IDF on the 'Ad-topic line' column of my dataset. For every ad-topic line, I get the same output: Firstly, I am unable to make sense of the output. The TF*IDF values are mentioned to ...
1
vote
1answer
1k views

How to combine nlp and numeric data for a linear regression problem

I'm very new to data science (this is my hello world project), and I have a data set made up of a combination of review text and numerical data such as number of tables. There is also a column for ...
3
votes
1answer
59 views

How to apply TFIDF in structured dataset in Python?

I know that TFIDF is an NLP method for feature extraction. and I know that there are libraries that calculate TFIDF directly from the text. This is not what I want though In my case, my text dataset ...
1
vote
0answers
27 views
3
votes
1answer
25 views

Text vectorizer that capture feature offset in the text?

I'm using sklearn Tfifdfvectorizer to extract feature from text towards text classification. I believe the information I need tends to be in the beginning of the document, so I would like to somehow ...
1
vote
1answer
220 views

Assigning a new document to a cluster based on keywords extracted and tf-idf

I have about 40 clusters of documents defined by a combination of k-means clustering algorithm and hand curation. For example, some of the clusters given by k-means are too noisy so they have been ...
1
vote
1answer
38 views

Classification using texts as features

I want to build a classification model to match customers and products. I have a description of each product, and a description of each customer, and the label : ...
13
votes
3answers
15k views

Using TF-IDF with other features in scikit-learn

What is the best/correct way to combine text analysis with other features? For example, I have a dataset with some text but also other features/categories. scikit-learn's TF-IDF vectorizer transforms ...
0
votes
0answers
24 views

Cosine Similarity: Works with TF-IDF Vectors OR with Probability Vectors?

Using Cosine Similarity is a common method to calculate Semantic Textual Similarity. And it is particularly useful when comparing Sentence Embeddings provided by the Universal Sentence Encoder. ...
1
vote
3answers
441 views

How to implement HashingVectorizer in multinomial naive bayes algorithim

I had used TfidfVectorizer and passed it through MultinomialNB for document classification, It was working fine. But now I need to pass a huge set of documents for ex above 1 Lakh and when I am ...
1
vote
3answers
368 views

How to create a big data frame in Python

I have a sparse matrix, $X$, created by TfidfVectorizer and its size is $(500000, 200000)$. I want to convert $X$ to a data frame but I'm always getting a memory error. I tried ...
1
vote
2answers
58 views

How to decide to go with BOW or TFIDF

I know that there are methods that help in selecting features such as Matual Info, and Info Gain, etc. But for datasets with thousands of records and thousands of features it is time consuming to ...
1
vote
0answers
18 views

Matching documents from different sets with tfidf and cosine distance

I have two different set of documents S1, S2, with 30 text documents each. Using some text representation method, such as tfidf ...
0
votes
1answer
31 views

Solution for TF-IDF Vectorization in Angular project?

While making an Angular project to use my text-classification model on unseen data, i struggle in finding a way how to transform text to TFIDF features. Anyone faced same issue? Maybe a solution on ...
1
vote
1answer
35 views

How come same cluster category be separated?

I have these 200 vectors which were clustered using K-means clustering based on keywords weight similarity that was given by TF-IDF (Term Frequency - Inverse Document Frequency). The vectors were ...
0
votes
1answer
136 views

KDE on TF-IDF - sensitive bandwidth

I'm clustering texts based on TF-IDF features and DBSCAN (density based), and trying to rank points based on their 'belonging' to the cluster. Since my clustering is density based and my points can ...
0
votes
1answer
19 views

How to decide which method to use TFIDF, or BOW

In a huge dataset for NLP it is taking very long time to classify my dataset therefore, trying each feature extraction method separetly is time consuming and not effecient. Is there a way that can ...
1
vote
1answer
23 views

Integer encoding and weighing when one feature consists of more names [closed]

Hello I am trying to make a content based movie recommendation system and one feature is genre of the movie. I will give an integer number to each genre randomly. However, some movies are of more than ...
1
vote
1answer
28 views

How best to embed large and noisy documents

I have a large corpus of documents (web pages) collected from various sites of around 10k-30k chars each, I am processing them to extract relevant text as much as possible, but they are never perfect. ...
2
votes
1answer
21 views

When does it make sense to add numbers with different units?

Given two vectors containing numbers that have different natures / units, (example length in Meters and weight in Kilograms), does it make sense to calculate euclidean distance between these two ...
0
votes
0answers
4 views

Vector dimensionality seems to be implemented incorrectly

I'm trying to implement a fuzzy topic modeling approach in Python based on a paper, which is accommodated with an R implementation from GitHub. In one of the first steps a document term matrix is ...
0
votes
2answers
81 views

Why is the idf important in tf-idf when it seems to just re-scale your features?

I am trying to understand why tf-idf is useful. As I understand the formula to work out the tf-idf is: Can someone explain what is wrong with the reasoning below: Imagine I have 100 documents that ...
1
vote
1answer
675 views

Using TF-IDF for feature extraction in Sentiment Analysis

I am working on sentiment analysis for twitter data, for which I have used Vader to get an approximation of sentiment for a tweet. Along with, I have used TF-IDF for feature extraction. These feature ...
2
votes
1answer
251 views

TF-IDF not a strong measure in this senario?

I am dealing with a data where I have only two documents and there are some words which are present in both. Now Term Frequencies (tf) of these words are very high for respective single document than ...
1
vote
3answers
1k views

Idf values of English words

I'm working on keyword/phrase extraction from a single document. I started by doing term frequency analysis, but this returns words like "new" which aren't very helpful. So I want to penalize the ...
0
votes
0answers
18 views

Which would be an ideal model to get a specific sub string from a bigger string?

I have a corpus of documents whose some lines have information like this: wt 210 1b 14.4 oz (98 kg) or ...
0
votes
0answers
12 views

Can a term weighting function used in text retrieval be compared to one used in text classification?

I came up with a modified version of TF-IDF function for text retrieval task. I want to do retrieval experiments using Vector Space Model and compare my function to some of those proposed in the ...
0
votes
0answers
53 views

Is normalizing term weight necessary when cosine similarity is used in retrieval?

When using cosine similarity in information retrieval, document vector length and query vector length are used for normalization. So if TF-IDF is used as a weighting function, then using raw frequency ...
0
votes
0answers
20 views

The TF-IDF is not matching with the bags of words

I am creating the information gains of all the words present in the vocabulary. However, when I check for feature names of the vectorizer it is different. For bag of words I am using: ...
0
votes
0answers
20 views

Building simple documents search engine

I'm having my first steps in the NLP and at the moment I'm looking forward to building my own documents search engine. I've already got to know with TFIDF in practical way and I've also read about ...
1
vote
1answer
44 views

Comparing TFIDF vectors of different shapes

I'm working on a project using TF-IDF vectors and agglomerative clustering -- the idea is that the corpus of documents increases over time, and when a new document is added, the mean cosine similarity ...
0
votes
1answer
207 views

Why I would use TF-IDF after Bag-of-Words (CountVectorizer)?

In my recent studies over Machine Learning NLP tasks I found this very nice tutorial teaching how to build your first text classifier: https://towardsdatascience.com/machine-learning-nlp-text-...
0
votes
0answers
17 views

SKLEARN SGDClassifier prediction accuracy hint?

There is a function predict but is it possible to also hint how much is the predicted category probable? Like prediction of category 1 with 90% confidence, or 2 with 30% confidence etc. Without this I ...
1
vote
0answers
24 views

Text Analysis : Recommendation to identify cause of loss from claim narrative documents

I am trying to analyze auto claims narrative documents which contain description about the accident usually free text written by claims executives. Is there a nlp technique I could use to identify ...
0
votes
1answer
82 views

Ordering of standardization, pca, and/or tfidf for neural network

I have 60k rows of text data. I have tokenized it into 55k columns. I am using a neural network to classify the data but have some questions about how to order my preprocessing steps. I have too much ...
1
vote
3answers
359 views

How to process the hyphenated english words for any nlp problem?

Im doing preprocessing on english text dataset. I encounter hyphenated words like 'well-known'. Will it be useful if I remove the hyphen as special character and treat it as a single word 'wellknown' ...
1
vote
1answer
397 views

TF-IDF for Topic Modeling

Can TF-IDF be used a sole method for Topic Modeling ? (I know there are better methods like LDA , LSA etc) I just want to understand if TF-IDF alone can help us in Topic modeling . If yes , can ...
0
votes
0answers
49 views

Manually tune tf-idf features in document classification

I am working on a multi-label document classification task with a very small data set (180 labeled documents) and a fairly large number of labels (20). I found that - ignoring label correlations and ...