vi3k6i5 / GuidedLDA

semi supervised guided topic model with custom guidedLDA
Mozilla Public License 2.0
497 stars 109 forks source link

i trained a TF-IDF model,i want to use it as a input,how can i do ? #7

Closed 2507779542 closed 5 years ago

vi3k6i5 commented 6 years ago

This model runs on document term matrix. Not sure if it will work with TFIDF. Can you share a few rows and columns, so I can check if it can be made to work.

sunnyc89 commented 6 years ago

Let's say the data is like below in pandas dataframe df: doc_id, text id_for_document_1, text_for_document_1 id_for_document_2, text_for_document_2

n_features = 1000 tf_vectorizer = TfidfVectorizer( stop_words='english', max_df=0.9, min_df=0.1, max_features=n_features) tf = tf_vectorizer.fit_transform(list(df['text']))

model = guidedlda.GuidedLDA(n_topics=5, n_iter=100, random_state=7, refresh=20) model.fit(tf) # This will fail as it doesn't support tf-idf

JeevaGanesan commented 5 years ago

I have the same scenario. Pandas df with id and text in columns. Not sure how to have it as a DTM. Can you please help?

sonamgupta1105 commented 3 years ago

@JeevaGanesan @sunnyc89 Has anyone figured out if we can use tfidf in guidedLDA?

sonamgupta1105 commented 3 years ago

This model runs on document term matrix. Not sure if it will work with TFIDF. Can you share a few rows and columns, so I can check if it can be made to work.

@vi3k6i5 Were you able to find a way if we can use tfidf as input to model.fit() ?