Skip to content

Instantly share code, notes, and snippets.

@3liud
Created March 21, 2022 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3liud/b6ba98fb30ee2bce2a3fbc270820c070 to your computer and use it in GitHub Desktop.
Save 3liud/b6ba98fb30ee2bce2a3fbc270820c070 to your computer and use it in GitHub Desktop.
week_#7_in_machine learning17
fig = plt.figure(figsize=(20,15))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(df2['Age'][df2['Label']==0], df2['Annual Income (k$)'][df2['Label']==0],
df2['Spending Score (1-100)'][df2['Label']==0], c='green', s=50)
ax.scatter(df2['Age'][df2['Label']==1], df2['Annual Income (k$)'][df2['Label']==1],
df2['Spending Score (1-100)'][df2['Label']==1], c='blue', s=50)
ax.scatter(df2['Age'][df2['Label']==2], df2['Annual Income (k$)'][df2['Label']==2],
df2['Spending Score (1-100)'][df2['Label']==2], c='black', s=50)
ax.scatter(df2['Age'][df2['Label']==3], df2['Annual Income (k$)'][df2['Label']==3],
df2['Spending Score (1-100)'][df2['Label']==3], c='red', s=50)
ax.scatter(df2['Age'][df2['Label']==4], df2['Annual Income (k$)'][df2['Label']==4],
df2['Spending Score (1-100)'][df2['Label']==4], c='purple', s=50)
ax.view_init(30, 190)
ax.set_xlabel('Age')
ax.set_ylabel('Annual Income')
ax.set_zlabel('Spending Score')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment