반응형
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 | 31 |
Tags
- 재귀함수
- bccard
- web 사진
- html
- java역사
- web 개발
- C언어
- mglearn
- cudnn
- paragraph
- broscoding
- KNeighborsClassifier
- 결합전문기관
- inorder
- Keras
- CES 2O21 참가
- 머신러닝
- classification
- postorder
- pycharm
- 자료구조
- discrete_scatter
- web
- vscode
- CES 2O21 참여
- tensorflow
- 대이터
- 웹 용어
- 데이터전문기관
- web 용어
Archives
- Today
- Total
bro's coding
sklearn.decomposition.PCA.picture.recover 본문
반응형
https://broscoding.tistory.com/175
sklearn.datasets.fetch_lfw_people
people=fetch_lfw_people(min_faces_per_person=20,resize=0.7) dir(people) people.target_names array(['Alejandro Toledo', 'Alvaro Uribe', 'Amelie Mauresmo', 'Andre Agassi', 'Angelina Jolie', 'Ariel Sha..
broscoding.tistory.com
from sklearn.decomposition import PCA
pca=PCA(100)
pca.fit(X_people)
X_pca=pca.transform(X_people)
pca_com=pca.components_[0]
plt.figure(figsize=[15,15])
for i in range(25):
pca_com=pca.components_[i]
plt.subplot(5,5,i+1)
plt.imshow(pca_com.reshape(87,-1),cmap='gray')

# 얼굴 재구성
X_recover=X_pca@pca.components_ # 변환한 값 @
X_recover
fig=plt.figure(figsize=[10,4])
for i in range(5):
plt.subplot(2,5,i+1)
plt.imshow(X_people[i].reshape(87,65),cmap='gray')
plt.axis('off')
plt.subplot(2,5,i+6)
plt.imshow(X_recover[i].reshape(87,-1),cmap='gray')
plt.axis('off')

반응형
'[AI] > python.sklearn' 카테고리의 다른 글
sklearn.manifold. TSNE (0) | 2020.04.23 |
---|---|
sklearn.neighbors.KNeighborsClassifier.mnist (0) | 2020.04.23 |
sklearn.PCA(2)를 이용한 digit data visualization (0) | 2020.04.23 |
sklearn.datasets.load_digits (0) | 2020.04.23 |
sklearn.datasets.fetch_lfw_people (0) | 2020.04.22 |
sklearn.naive_bayes.BernoulliNB (0) | 2020.04.21 |
sklearn.ensemble .GradientBoostingClassifier (0) | 2020.04.21 |
sklearn.decomposition.PCA.dimension(30->2) (0) | 2020.04.21 |
Comments