MySQL-specific implementation. Should be used in conjunction with a {@link MySQLJDBCDataModel}. This implementation stores item-item diffs in a MySQL database and encapsulates some other slope-one-specific operations that are needed on the preference data in the database. It assumes the database has a schema like:
item_id_a | item_id_b | average_diff | count |
---|---|---|---|
123 | 234 | 0.5 | 5 |
123 | 789 | -1.33 | 3 |
234 | 789 | 2.1 | 1 |
item_id_a
and item_id_b
should have types compatible with the long primitive type. average_diff
must be compatible with float
and count
must be compatible with int
.
The following command sets up a suitable table in MySQL:
CREATE TABLE taste_slopeone_diffs ( item_id_a BIGINT NOT NULL, item_id_b BIGINT NOT NULL, average_diff FLOAT NOT NULL, count INT NOT NULL, PRIMARY KEY (item_id_a, item_id_b), INDEX (item_id_a), INDEX (item_id_b) )
|
|