Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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. :)

In reply to Re: Netflix (or on handling large amounts of data efficiently in perl) by matrixmadhan
in thread Netflix (or on handling large amounts of data efficiently in perl) by Garp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found