本文整理匯總了Python中sklearn.feature_extraction.text.TfidfVectorizer.append方法的典型用法代碼示例。如果您正苦於以下問題:Python TfidfVectorizer.append方法的具體用法?Python TfidfVectorizer.append怎麽用?Python TfidfVectorizer.append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sklearn.feature_extraction.text.TfidfVectorizer
的用法示例。
在下文中一共展示了TfidfVectorizer.append方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: str
# 需要導入模塊: from sklearn.feature_extraction.text import TfidfVectorizer [as 別名]
# 或者: from sklearn.feature_extraction.text.TfidfVectorizer import append [as 別名]
colors.append(c)
movieName = movieName.decode('unicode-escape')
genre = genre.decode('unicode-escape')
labels.append(movieName + "\n" + genre)
# get feature vector
feats = g.readline()
elems = feats.split(';')
v = []
for elem in elems:
e = elem.strip().strip("{}")
#print e
#print str(len(vectors)) + " " + str(len(v)) + " string is " + e
v.append(float(e))
vectors.append(v)
# Now use these vectors for tSNE
if int(numTopics) < 50 :
X_reduced = vectors
else:
X_reduced = TruncatedSVD(n_components=50, random_state=0).fit_transform(vectors)
X_embedded = TSNE(n_components=2, perplexity=30, verbose=2).fit_transform(X_reduced)
fig = figure(figsize=(10, 10))
ax = axes(frameon=False)
setp(ax, xticks=(), yticks=())
subplots_adjust(left=0.0, bottom=0.0, right=1.0, top=0.9,
wspace=0.0, hspace=0.0)