-
-
Save amankharwal/8cf2699d7f2e611e243e23e443eae11d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colors = {0:"red", 1:"yellow", 2:"blue", 3:"green", 4:"pink"} | |
pca = PCA() | |
principal_components = pca.fit_transform(x) | |
x, y = principal_components[:,0], principal_components[:,1] | |
df = pd.DataFrame({"X": x, "Y": y, "Labels": labels}) | |
groups = df.groupby(labels) | |
fig, ax = plt.subplots(figsize=(15, 10)) | |
for i, j in groups: | |
ax.plot(j.X, j.Y, marker='o', linestyle='', ms=5, color=colors[i], mec='none') | |
ax.set_aspect('auto') | |
ax.tick_params(axis='x',which='both',bottom='off',top='off',labelbottom='off') | |
ax.tick_params(axis= 'y',which='both',left='off',top='off',labelleft='off') | |
ax.set_title("Credit Card Customer Segmentation") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment