티스토리 뷰
파이썬 Pairplot에서 대각성분(kdeplot)만 보기
Insight Miner 2021. 5. 24. 09:45from sklearn.datasets import load_iris
import seaborn as sns
# iris 데이터 불러오기 & 데이터 프레임 만들기
iris = load_iris()
iris_df = pd.DataFrame(data= np.c_[iris['data'], iris['target']], columns= iris['feature_names'] + ['target'])
iris_df['target'] = iris_df['target'].map({0: "setosa", 1: "versicolor", 2: "virginica"})
#pairplot 그리기
sns.pairplot(iris_df, hue='target')
[pairplot 결과]

# pairplot에서 대각성분(kdeplot)만 뽑아서 다시 그리기
df = pd.melt(iris_df, iris_df.columns[-1], iris_df.columns[:-1]) # FacetGrid를 이용하기 위해 데이터 형식 변환. 마지막 컬럼이 target이어야 함
g = sns.FacetGrid(df, col="variable", hue="target", col_wrap=4)
g.map(sns.kdeplot, "value", shade=True).add_legend()
[kdeplot만 새로 그리기 결과]

#파이썬 #python #pairplot #kdeplot #facetgrid #iris #othogonal #대각성분
'Work > Data Science|Machine;Deep Learning' 카테고리의 다른 글
ocrpy: Unified interface to google vision, aws textract, azure, tesseract and other OCR tools (0) | 2022.08.24 |
---|---|
[책] Applied Machine Learning Explainability Techniques (0) | 2022.08.23 |
What Did My AI Learn? How Data Scientists Make Sense of ModelBehavior (0) | 2022.08.22 |
A Benchmarking Toolkit for Time Series Anomaly Detection Algorithms (0) | 2022.08.22 |
다른 도메인에 대한 Transfer learning 적용 (0) | 2022.07.21 |
- Total
- Today
- Yesterday
- anomaly
- machine
- dowhy
- vision
- Bbox
- 맛집
- AI
- learning
- tutorial
- Semantic
- error
- explainability
- Domain
- 제조
- 서현
- github
- export
- 파이썬
- import
- causality
- TimeSeries
- ML
- XAI
- segmentation
- rcnn
- detection
- Python
- bashrc
- mask
- transformer
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |