You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We provide the MovieLens data to build a "Hello-World" movie recommendation application using RecDB. You can load the data using the sql script called "initmovielens1mdatabase.sql" stored in "./PostgreSQL" directory. We provide the dataset at "./PostgreSQL/moviedata / MovieLens1M/" directory.
77
77
78
-
### Recommendation Query
79
-
In the recommendation query, the user needs to specify the ratings table and also specify where the user, item, and rating value columns are in that table. Moreover, the user has to designate the recommendation algorithm to be used to predict item ratings. For example, if MovieRatings(userid,itemid,ratingval) represents the ratings table in a movie recommendation application, then to recommend top-10 movies based on the rating predicted using Item-Item Collaborative filtering (applying cosine similarity measure) algorithm to user 1, the user writes the following SQL:
78
+
79
+
### Creating Recommenders
80
+
Users may create recommenders apriori so that when a recommendation query is issued may be answer with less latency. The user needs to specify the ratings table in the ON clause and also specify where the user, item, and rating value columns are in that table. Moreover, the user has to designate the recommendation algorithm to be used to predict item ratings in the USING clause.
80
81
81
82
```
82
-
SELECT * FROM MovieRatings R
83
-
RECOMMEND R.itemid TO R.userid ON R.ratingval
83
+
CREATE RECOMMENDER MovieRec ON MovieRatings
84
+
USERS FROM userid
85
+
ITEMS FROM itemid
86
+
EVENTS FROM ratingval
84
87
USING ItemCosCF
85
-
WHERE R.userid = 1
86
-
ORDER BY R.ratingval
87
-
LIMIT 10
88
88
```
89
89
90
-
When you issue a query such as this, the only interesting data will come from the three columns specified in the RECOMMEND clause. Any other columns that exist in the specified ratings tables will be set to 0.
91
-
92
90
Currently, the available recommendation algorithms that could be passed to the USING clause are the following:
93
91
94
92
```ItemCosCF``` Item-Item Collaborative Filtering using Cosine Similarity measure.
@@ -101,18 +99,7 @@ Currently, the available recommendation algorithms that could be passed to the U
101
99
102
100
```SVD``` Simon Funk Singular Value Decomposition.
103
101
104
-
Note that if you do not specify which user(s) you want recommendations for, it will generate recommendations for all users, which can take an extremely long time to finish.
105
-
106
-
### Materializing Recommenders
107
-
Users may create recommenders apriori so that when a recommendation query is issued may be answer with less latency.
108
102
109
-
```
110
-
CREATE RECOMMENDER MovieRec ON MovieRatings
111
-
USERS FROM userid
112
-
ITEMS FROM itemid
113
-
EVENTS FROM ratingval
114
-
USING ItemCosCF
115
-
```
116
103
Similarly, materialized recommenders can be removed with the following command:
117
104
118
105
```
@@ -121,6 +108,26 @@ DROP RECOMMENDER MovieRec
121
108
122
109
Note that if you query a materialized recommender, the three columns listed above will be the only ones returned, and attempting to reference any additional columns will result in an error.
123
110
111
+
112
+
113
+
### Recommendation Query
114
+
In the recommendation query, the user needs to specify the ratings table and also specify where the user, item, and rating value columns are in that table. Moreover, the user has to designate the recommendation algorithm to be used to predict item ratings. For example, if MovieRatings(userid,itemid,ratingval) represents the ratings table in a movie recommendation application, then to recommend top-10 movies based on the rating predicted using Item-Item Collaborative filtering (applying cosine similarity measure) algorithm to user 1, the user writes the following SQL:
115
+
116
+
```
117
+
SELECT * FROM MovieRatings R
118
+
RECOMMEND R.itemid TO R.userid ON R.ratingval
119
+
USING ItemCosCF
120
+
WHERE R.userid = 1
121
+
ORDER BY R.ratingval
122
+
LIMIT 10
123
+
```
124
+
125
+
When you issue a query such as this, the only interesting data will come from the three columns specified in the RECOMMEND clause. Any other columns that exist in the specified ratings tables will be set to 0.
126
+
127
+
128
+
Note that if you do not specify which user(s) you want recommendations for, it will generate recommendations for all users, which can take an extremely long time to finish.
129
+
130
+
124
131
### More Complex Queries
125
132
The main benefit of implementing the recommendation functionality inside a database enine (PostgreSQL) is to allow for integration with traditional database operations, e.g., selection, projection, join.
126
133
For example, the following query recommends the top 10 Comedy movies to user 1.
0 commit comments