def plotInputData(X, Y, title, data_len):
time_start = time.time()
X = TSNE(n_components=2, verbose=1, perplexity=40, n_iter=300).fit_transform(X)
print("After Reduction Data Shape : {0}".format(X.shape))
print 't-SNE done! Time elapsed: {} seconds'.format(time.time()-time_start)
# Main scatter plot and plot annotation
f, ax = plt.subplots(figsize=(7, 7))
ax.scatter(X[:data_len / 2, 0] * 10, X[:data_len / 2, 1] * 10, marker = 'o', color = 'green', s=30, alpha=0.5)
ax.scatter(X[data_len / 2:, 0] * 10, X[data_len / 2:, 1] * 10, marker = '^', color = 'blue', s=30, alpha=0.5)
plt.legend(["Melanoma", "Benign"], loc='upper right')
plt.title(title)
plt.ylabel('Y')
plt.xlabel('X')
# plt.scatter(X[:, 0], X[:, 1], c=Y, cmap=plt.cm.Paired)
# plt.xlabel('X')
# plt.ylabel('Y')
# plt.title('SVC Data Plot')
plt.show()
评论列表
文章目录