반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- 자료구조
- vscode
- web 개발
- inorder
- KNeighborsClassifier
- java역사
- pycharm
- 웹 용어
- paragraph
- CES 2O21 참가
- html
- 머신러닝
- classification
- web 용어
- 결합전문기관
- Keras
- broscoding
- 대이터
- web 사진
- mglearn
- postorder
- cudnn
- tensorflow
- bccard
- discrete_scatter
- 재귀함수
- web
- CES 2O21 참여
- C언어
- 데이터전문기관
Archives
- Today
- Total
bro's coding
sklearn.feature_extraction.text.TfidfTransformer.LogisticRegression적용 본문
[AI]/python.sklearn
sklearn.feature_extraction.text.TfidfTransformer.LogisticRegression적용
givemebro 2020. 4. 28. 12:54반응형
from sklearn.feature_extraction.text import TfidfVectorizer
vect=TfidfVectorizer(min_df=5)
vect.fit(text_train)
X_train=vect.transform(text_train)
from sklearn.linear_model import LogisticRegression
model=LogisticRegression()
model.fit(X_train,y_train)
X_test=vect.transform(text_test)
display(model.score(X_test,y_test),model.coef_)
w=model.coef_[0]
index_small=np.argsort(w)[:20]
index_big=np.argsort(w)[-20:]
index_merge=np.r_[index_small,index_big]
fn=np.array(vect.get_feature_names())
merge_name=fn[index_merge]
plt.figure(figsize=[10,10])
plt.bar(range(40),w[index_merge])
plt.xticks(range(40),merge_name,rotation=90)
pass
반응형
'[AI] > python.sklearn' 카테고리의 다른 글
sklearn.TfidfVectorizer(tokenizer=twitter_tag.morphs).LogisticRegression (0) | 2020.04.29 |
---|---|
sklearn.decomposition.LatentDirichletAllocation (0) | 2020.04.28 |
sklearn.feature_extraction.text.CountVectorizer.ngram.LogisticRegression.2단어들만 출력 (0) | 2020.04.28 |
sklearn.feature_extraction.text.CountVectorizer.ngram_range적용 (0) | 2020.04.28 |
sklearn.feature_extraction.text.TfidfTransformer (0) | 2020.04.28 |
sklearn.feature_extraction.text.CountVectorizer.stop_words적용 (0) | 2020.04.28 |
sklearn.feature_extraction.text.CountVectorizer.max_df변화 관찰 (0) | 2020.04.28 |
sklearn.feature_extraction.text.CountVectorizer.min_df변화 관찰 (0) | 2020.04.28 |
Comments