# load data data = xlrd.open_workbook('../WTMLDataSet_3.0alpha.xlsx') table = data.sheet_by_name('WTML') dataset = [] for i in range(table.nrows): line = table.row_values(i) dataset.append(line) dataset = np.array(dataset) xs = dataset[1:, 1:-1].astype(np.float64) ys = (dataset[1:, -1] == '是').astype(np.int32) SOMNet = SOM(xs.shape[1], map_shape=[8, 8]) SOMNet.learn(xs, steps=1000, batch_size=17) # plot data (before mapping) plt.figure() positive_xs = xs[ys == 1] negative_xs = xs[ys == 0] plt.scatter(positive_xs[:, 0], positive_xs[:, 1], marker='o', c='w', edgecolors='#00CED1', s=80, label='Great (positive)') plt.scatter(negative_xs[:, 0], negative_xs[:, 1], marker='s',