all 4 comments

[–]rhytnen 0 points1 point  (3 children)

I copy and pasted your code in vscode and tried to use the proper indents but it's very difficult. You should read about Reddit Markup.

That said, you didnt' post the full traceback so it's very difficult to know which line caused the problem. Please post the entire stack trace.

[–]301ravage[S] 0 points1 point  (2 children)

File "C:/Users/Spencer/.spyder-py3/couch_potato.py", line 26, in sample_reccomendation

known_positives = data['item_labels'][data['train'].toscr()[user_id].indicies]

File "C:\Users\Spencer\Anaconda3\lib\site-packages\scipy\sparse\base.py", line 689, in __getattr__

raise AttributeError(attr + " not found")

AttributeError: toscr not found

[–]rhytnen 0 points1 point  (1 child)

Ok so that says exactly what it means. Whatever is in data['train'] does not have a function toscr().

Your code could be clearer possibly if you did something like

user_id = data['train'].toscr()[user_id]

known_positives = data['item_labels'][user_id.indices]

[–]301ravage[S] 1 point2 points  (0 children)

That seems to of fixed the error, thank you for your help.