plot에 관한 noobie 질문이 있습니다. .소수.plt.scatter (X [: 50,0], X [: 50, 1], color = 'red', 표시 자 = 'o', 레이블 = 'setosa')
저는 두 개의 꽃잎이있는 꽃잎 길이를 분석하는 기계 학습 자습서를 작성하고 있습니다.
df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data', header = None)
print(df.tail())
y = df.iloc[0:100,4].values #This is going to print out the 5th column of the dataset.
y = np.where(y == 'Iris-setosa', -1, 1) #Where y has 'Iris-setosa' in there, it is going to yield a -1. Else it is going to yield a 1.
X = df.iloc[0:100, [0,2]].values #1st and 3rd column of the Iris dataset online
#printout the 1st and 3rd
plt.scatter(X[:50,0], X[:50, 1], color = 'red', marker = 'o', label = 'setosa')
plt.scatter(X[50:100, 0], X[50:100, 1], color = 'blue', marker = 'x', label = 'versicolor')
plt.scatter 라인의 각각에 대해 두 개의 X가 왜 확실히하지 않습니다 [: 50,0]와 X의 [이 : 50, 1]. 그 목적은 무엇입니까 ?? 나는 plt.scatter가 산점도를 할 때 한 종류의 아이템을 보여 주려한다고 생각했다. 마치 내가 좋아할 것 같아서. 여기에 대한 입력 ... 등등과 사전에
감사합니다 ..
: [50,0] 당신은 행 0 50, 당신이 그렇게 그 단지 X의 어떤 꽃 PLT 분산 원하는 것을 알고있다
안녕하세요. 나는 그것이 데이터에 달려 있다고 생각한다. 먼저 데이터를 알아야합니다. 분산 형 그래프는 두 변수 사이의 * 관계를 시각화하는 데 사용될 수 있습니다. 이 경우 두 측정 값은 'X'의 첫째 열 및 두 번째 열의 값입니다. 희망이 도움이됩니다. – Arief
예. 나는 내가 헷갈 른 이유가 X [: 50,0], X [50,1], color = 'red'....와 같은 이유가 무엇인지를 추측한다. plt scatter는 코드 라인에서 빨간색으로 칠할 색상을 어떻게 알 수 있습니까? – ghostinashell
코드를 실행 했습니까? 그 결과는 무엇입니까? – Arief