iris데이터 scatter plot

이 예제에서는 Python 언어와 scikit-learn 라이브러리를 사용하여 홍채 데이터를 산점도로 시각화하는 방법을 설명합니다.

쉬운 목차

1. 필요한 라이브러리 설치 및 로드

!
pip install scikit-learn matplotlib import matplotlib.pyplot as plt from sklearn.datasets import load_iris

2. 데이터 불러오기

scikit-learn에서 제공하는 홍채 데이터를 로드합니다.

iris = load_iris()
X, y = iris.data, iris.target

3. 데이터 시각화

가져온 홍채 데이터를 산점도로 시각화합니다.

plt.scatter(X(:, 0), X(:, 1), c=y, cmap='viridis')
plt.xlabel(iris.feature_names(0))
plt.ylabel(iris.feature_names(1))
plt.show()