0

I'm using surprise to calculat the 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)

and I get this error:

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'
mimi acrs
  • 1
  • 2
  • The best would be if you provided full reproducible example. Minimum is providing `import`s - because now we need to guess which SVD you are using. – dankal444 Sep 07 '21 at 12:39
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 07 '21 at 12:40

1 Answers1

0

As per the docs the input to the fit method must be a Trainset.

Thus, in your case just do:

algo.fit(trainset)

More info on this problem here

marsolmos
  • 748
  • 9
  • 24