We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from future import (absolute_import, division, print_function, unicode_literals)
import pandas as pd
from surprise import SVD from surprise import dataset from surprise import Reader
reader = Reader() model = SVD() ratings_dict=ratings.to_dict('records') ratings_dict
Example output: [{'userId': 1, 'movieId': 31, 'rating': 2.5, 'timestamp': 1260759144}, {'userId': 1, 'movieId': 1029, 'rating': 3.0, 'timestamp': 1260759179}, {'userId': 1, 'movieId': 1061, 'rating': 3.0, 'timestamp': 1260759182}, {'userId': 1, 'movieId': 1129, 'rating': 2.0, 'timestamp': 1260759185},
df = pd.DataFrame.from_dict(ratings_dict)
reader = Reader(line_format='user item rating', rating_scale=(1, 5))
class MyDataset(dataset.DatasetAutoFolds):
def __init__(self, df, reader): self.raw_ratings = [(uid, iid, r, None) for (uid, iid, r) in zip(df['userId'], df['movieId'], df['rating'])] self.reader=reader
data = MyDataset(df, reader)
cross_validate(model,data,measures=['userId', 'movieId', 'rating'],cv=3)
Error Message: AttributeError: module 'surprise.accuracy' has no attribute 'userid' 1 cross_validate(model,data,measures=['userId', 'movieId', 'rating'],cv=3)
Before running the above code:
ratings=pd.read_csv('ratings_small.csv') ratings.head()
!pip install scikit-surprise from surprise import Reader, Dataset, SVD from surprise.model_selection import cross_validate
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
from future import (absolute_import, division, print_function,
unicode_literals)
import pandas as pd
from surprise import SVD
from surprise import dataset
from surprise import Reader
reader = Reader()
model = SVD()
ratings_dict=ratings.to_dict('records')
ratings_dict
Example output: [{'userId': 1, 'movieId': 31, 'rating': 2.5, 'timestamp': 1260759144},
{'userId': 1, 'movieId': 1029, 'rating': 3.0, 'timestamp': 1260759179},
{'userId': 1, 'movieId': 1061, 'rating': 3.0, 'timestamp': 1260759182},
{'userId': 1, 'movieId': 1129, 'rating': 2.0, 'timestamp': 1260759185},
df = pd.DataFrame.from_dict(ratings_dict)
You'll need to create a dummy reader
reader = Reader(line_format='user item rating', rating_scale=(1, 5))
Also, a dummy Dataset class
class MyDataset(dataset.DatasetAutoFolds):
data = MyDataset(df, reader)
cross_validate(model,data,measures=['userId', 'movieId', 'rating'],cv=3)
Error Message: AttributeError: module 'surprise.accuracy' has no attribute 'userid'
1 cross_validate(model,data,measures=['userId', 'movieId', 'rating'],cv=3)
Steps/Code to Reproduce
Before running the above code:
ratings=pd.read_csv('ratings_small.csv')
ratings.head()
!pip install scikit-surprise
from surprise import Reader, Dataset, SVD
from surprise.model_selection import cross_validate
Expected Results
Actual Results
Versions
The text was updated successfully, but these errors were encountered: