Skip to content

Commit 0cfcee8

Browse files
author
Mohamed Sarwat
committed
Update README.md
1 parent f15dd64 commit 0cfcee8

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

README.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,18 @@ perl clean.pl [db_name] [server_host]
7575
### Loading Data
7676
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.
7777

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.
8081

8182
```
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
8487
USING ItemCosCF
85-
WHERE R.userid = 1
86-
ORDER BY R.ratingval
87-
LIMIT 10
8888
```
8989

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-
9290
Currently, the available recommendation algorithms that could be passed to the USING clause are the following:
9391

9492
```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
10199

102100
```SVD``` Simon Funk Singular Value Decomposition.
103101

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.
108102

109-
```
110-
CREATE RECOMMENDER MovieRec ON MovieRatings
111-
USERS FROM userid
112-
ITEMS FROM itemid
113-
EVENTS FROM ratingval
114-
USING ItemCosCF
115-
```
116103
Similarly, materialized recommenders can be removed with the following command:
117104

118105
```
@@ -121,6 +108,26 @@ DROP RECOMMENDER MovieRec
121108

122109
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.
123110

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+
124131
### More Complex Queries
125132
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.
126133
For example, the following query recommends the top 10 Comedy movies to user 1.

0 commit comments

Comments
 (0)