数据部分是这样的:{60 1,248 1,279 1,316 1}
.当我使用 Python LIAC-ARFF 库时,我收到如下错误:ValueError: {60 1 value not in ('0', '1')
.
当我使用普通的 ARFF 文件时,它工作正常。
我正在使用来自木兰网站的著名的delicious.arff数据集。
我还需要使用其他方法吗?谁能帮忙?
您可以使用scikit-multilearn提供的函数来加载ARFF数据。
如何使用示例 - 第一个参数是 ARFF 文件,格式是 MULAN,因此标签位于末尾 ( label_location="end"
(。美味数据集中有 983 个标签,美味输入数据的特征是整数,输入数据已经是名义的,因为美味中的输入空间是一袋单词。请记住,您应该始终阅读相关论文中的数据集(数据集的源论文信息在木兰网站上提供(:
from skmultilearn.dataset import load_from_arff
X, y = load_from_arff("/home/user/data/delicious-train.arff",
# number of labels
labelcount=983,
# MULAN format, labels at the end of rows in arff data, using 'end' for label_location
# 'start' is also available for MEKA format
label_location='end',
# bag of words
input_feature_type='int', encode_nominal=False,
# sometimes the sparse ARFF loader is borked, like in delicious,
# scikit-multilearn converts the loaded data to sparse representations,
# so disabling the liac-arff sparse loader
# but you may set load_sparse to True if this fails
load_sparse=False,
# this decides whether to return attribute names or not, usually
# you don't need this
return_attribute_definitions=False)
退货是什么?
>>> print(X, y)
(<12920x500 sparse matrix of type '<type 'numpy.int64'>' with 6460000 stored elements in LInked List format>,
<12920x983 sparse matrix of type '<type 'numpy.int64'>' with 12700360 stored elements in LInked List format>)