This is the code get from github, where is about a credit card fraud detection using auto encoder. However, when I try to run it give me an error message about TypeError: must be real number, not str
def tsne_plot(x1, y1, name="graph.png"):
tsne = TSNE(n_components=2, random_state=0)
X_t = tsne.fit_transform(x1)
plt.figure(figsize=(12, 8))
plt.scatter(X_t[np.where(y1 == 0), 0], X_t[np.where(y1 == 0), 1], marker='o', color='g', linewidth='1', alpha=0.8, label='Non Fraud')
plt.scatter(X_t[np.where(y1 == 1), 0], X_t[np.where(y1 == 1), 1], marker='o', color='r', linewidth='1', alpha=0.8, label='Fraud')
plt.legend(loc='best');
plt.savefig(name);
plt.show();
tsne_plot(X, Y, "original.png")
I was expecting to get a plotting of fraud and non fraud. The error message is as below :
~\AppData\Local\Temp\ipykernel_7256\3319091206.py in <module>
11 plt.show();
12
---> 13 tsne_plot(X, Y, "original.png")
~\AppData\Local\Temp\ipykernel_7256\3319091206.py in tsne_plot(x1, y1, name)
8
9 plt.legend(loc='best');
---> 10 plt.savefig(name);
11 plt.show();