我正在尝试编辑从Github中获取的项目文件。 我有两个python文件。从第一个python文件导入名为“ Dataset”的文件。当我在“数据集”上将函数“ data_load”的名称更改为“ yukle”时,spider无法识别它,并且先前的代码可以正常工作。 我该如何解决这个问题?
我重新启动了内核。根据我的偏好启用了Umr。此方法无效。
First_file.py:
import io
from surprise import KNNBaseline
from surprise import Dataset
from surprise import get_dataset_dir
data = Dataset.yukle('ml-100k')
Dataset.py:
'''类数据集:
def __init__(self, reader):
self.reader = reader
@classmethod
def yukle(cls, name='ml-100k', prompt=True):
try:
dataset = BUILTIN_DATASETS[name]
except KeyError:
raise ValueError('unknown dataset ' + name +
'. Accepted values are ' +
', '.join(BUILTIN_DATASETS.keys()) + '.')
if not os.path.isfile(dataset.path):
answered = not prompt
while not answered:
print('Dataset ' + name + ' could not be found. Do you want '
'to download it? [Y/n] ', end='')
choice = input().lower()
if choice in ['yes', 'y', '', 'omg this is so nice of you!!']:
answered = True
elif choice in ['no', 'n', 'hell no why would i want that?!']:
answered = True
print("Ok then, I'm out!")
sys.exit()
download_builtin_dataset(name)
reader = Reader(**dataset.reader_params)
return cls.load_from_file(file_path=dataset.path, reader=reader)
AttributeError: type object 'Dataset' has no attribute 'yukle'