Nice problem
I have got some suggestions regarding the data representation optimization that I think is feasible to achieve with respect to this problem
movie_id, user_id and rating.
From your post it seems that the above 3 values are critical and without user_id ; <movie_id> and <rating> pairs from the users cannot be unique and its a repetitive pattern
For ex:
<movie_id><user_id><rating>
<1><U1><2>
<1><U2><3>
<1><U3><2>
<1><U4><3>
Here with the above sample data, movie_id and rating have got a repeating pattern so a map of 5 possible values for each and every movie can be used instead of storing movie_id and a rating each time.
<movie_id><rating>
<1><1> => a
<1><2> => b
<1><3> => c
<1><4> => d
<1><5> => e
and the new combination would be only user_id and the above map
ex:
<U1><b1>
<U2><c1>
though it adds to additional lookup and retrieval the actual storage of data is compressed in terms of mapping to new values.
The same logic can also be extended to secondary level of mapping to include "users with specific rating pattern"
<userid><rating>
<U1><1> => a1
<U1><2> => a2
and the above values can be used along with the movie id.
Going for the lookup implementation a simple berkely db would be easier to go with in terms of implementation and retrieval
Alternative that you might think of is appending attribute_values and storing them but its not going to do any good in terms of retrieval or storage.
Please feel free to say that am wrong if am really wrong. :)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.