将自定义数据集添加到fasttext分类深度学习中

时间:2017-11-28 10:00:31

标签: tensorflow deep-learning text-classification fasttext

基于这个guithub链接https://github.com/brightmart/text_classification,我想运行“ fasttext ”分类,但是有些文件我找不到它们我想添加我的将自定义数据集作为输入 ,然后运行它。 在github手册中没有添加我们自己的数据集作为输入的指令吗?

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您不需要拥有load_file代码,在this snippet他告诉您数据/批次是什么样的,我想为您翻译成英文:

print("testX.shape:", np.array(testX).shape)  # 2500 lists, with each list representing a sentence
# there are 2500 lists in testX each one standing for a sentence, 
# which means testX is a 2 dimensional list containing 2500 lists 
# and each list has several ids of words
print("testY.shape:", np.array(testY).shape)  # 2500 labels
# correspondingly there are 2500 labels in the testY which is a 
# one dimensional list
print("testX[0]:", testX[0])  # [17, 25, 10, 406, 26, 14, 56, 61, 62, 323, 4]
# this is what the first sentence in testX like (all ids)
print("testX[1]:", testX[1]);
print("testY[0]:", testY[0]) # 0 ;print("testY[1]:",testY[1]) #0 

您可以创建自己的testX和testY,它们都只是列表。