Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Damian Schwyrz Damian89

🎯
Focusing
Block or report user

Report or block Damian89

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View example_tfidf.py
print()
print("TF-IDF + IncrementalPCA")
tfidf_vect = feature_extraction.text.TfidfVectorizer(stop_words=stoplist)
tfidf_vect.fit(docs)
features = tfidf_vect.get_feature_names()
tfidf = tfidf_vect.transform(docs)
tfidf_lsi = decomposition.IncrementalPCA(n_components=2)
tfidf_lsi.fit(tfidf.toarray())
View example_tfidf.py
print()
print("TF-IDF + FastICA")
tfidf_vect = feature_extraction.text.TfidfVectorizer(stop_words=stoplist)
tfidf_vect.fit(docs)
features = tfidf_vect.get_feature_names()
tfidf = tfidf_vect.transform(docs)
tfidf_lsi = decomposition.FastICA(n_components=2)
tfidf_lsi.fit(tfidf.toarray())
View example_tfidf.py
print()
print("TF-IDF + NMF")
tfidf_vect = feature_extraction.text.TfidfVectorizer(stop_words=stoplist)
tfidf_vect.fit(docs)
features = tfidf_vect.get_feature_names()
tfidf = tfidf_vect.transform(docs)
tfidf_lsi = decomposition.NMF(n_components=2)
tfidf_lsi.fit(tfidf)
View example_tfidf.py
print("TF-IDF + LDA")
tfidf_vect = feature_extraction.text.TfidfVectorizer(stop_words=stoplist)
tfidf_vect.fit(docs)
features = tfidf_vect.get_feature_names()
tfidf = tfidf_vect.transform(docs)
tfidf_lsi = decomposition.LatentDirichletAllocation(n_components=2)
tfidf_lsi.fit(tfidf)
View simple-tfidf-count-lsi-example.py
#!/usr/bin/env python
# coding: utf8
from sklearn import feature_extraction, decomposition
stoplist = []
docs = [
"Maschinelles lernen ist eine Disziplien die irgendwas mit Künstlicher Intelligenz zu tun hat",
"Künstliche Intelligenz ist ein interessantes Themengebiet",
You can’t perform that action at this time.