向量化多层感知器的标签

时间:2019-02-13 07:29:54

标签: machine-learning

我正在尝试构建MLP模型来解决具有9个类和一些文本数据的.csv数据。这些是标签及其计数。

7:953,
4:686,
1:568,
2:452,
6:275,
5:242,
3:89,
9:37,
8:19.

对于MLP,我知道我们需要向量化类标签。是这样吗? 当我运行以下代码来执行此操作时,我遇到了以下错误:

y_tr = keras.utils.to_categorical(y_tr, num_classes = 9) # y_tr is numpy array with class labels

y_te = keras.utils.to_categorical(y_te, num_classes = 9) # y_te also a numpy array


**IndexError:** index 9 is out of bounds for axis 1 with size 9

帮我解决这个问题。谢谢!

样本数据:

ID  Gene    Variation   Class   Text

1    1      CBL W802*     2    tumorigenesis
2    2      CBL Q249E     2    tumorigenesis
3    3      CBL N454D     3    attractive
4    4      CBL L399V     4    cancer
5    5      CBL V391I     4    cancer
6    6      CBL V430M     5    cancer
7    7      CBL Deletion  1    56
8    8      CBL Y371H     4    cancer
9    9      CBL C384R     4    mutations
10   10     CBL P395A     4    cancer

0 个答案:

没有答案