【问题标题】:'DataFrame' object has no attribute 'global_mean''DataFrame' 对象没有属性 'global_mean'
【发布时间】:2021-11-01 16:19:51
【问题描述】:

我正在使用惊喜来计算 RMSE

trainset= pd.read_csv('drive/MyDrive/trainrating.csv')
testset = pd.read_csv('drive/MyDrive/testrating.csv')
algo = SVD(n_factors=factors, n_epochs=epochs, lr_all=lr_value, reg_all=reg_value)
predictions = algo.fit(trainset).test(testset)
accuracy.rmse(predictions)

我得到这个错误:

5139             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5140                 return self[name]
-> 5141             return object.__getattribute__(self, name)
   5142 
   5143     def __setattr__(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'global_mean'

【问题讨论】:

  • 如果您提供完整的可重现示例,则最好。最低要求是提供imports - 因为现在我们需要猜测您使用的是哪个 SVD。
  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python prediction svd


【解决方案1】:

As per the docs fit 方法的输入必须是 Trainset。

因此,在您的情况下,只需:

algo.fit(trainset)

关于这个问题的更多信息here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-17
    • 2021-07-14
    • 2013-10-23
    • 2017-10-22
    • 2021-01-08
    • 2016-03-09
    • 2016-04-02
    相关资源
    最近更新 更多