开发者

Efficiently updating cosine similarity scores

开发者 https://www.devze.com 2023-01-16 05:50 出处:网络
My iPhone application is using a SQLite database with the following schema: items(id, name, ...) -> this table contains 50 records

My iPhone application is using a SQLite database with the following schema:

  • items(id, name, ...) -> this table contains 50 records
  • tags(id, name) -> this table contains 50 records
  • item_tags(id, item_id, tag_id, user_id)
  • similarities(id, item1_id, item2_id, score)

The items, tags, item_tags and similarities tables are populated with pre-defined records, hence also the similarities between different items have already been calculated offline (using cosine similarity algorithm based on the items' tags).

Users are able to add additional tags to items and to remove their custom tags later on. Whenever this happens the similarity scores between the items should be updated locally, i.e. without contacting the server application.

My question now is the following: What is the most efficient way to do so? So far, on startup of the i开发者_如何学JAVAPhone application, I compute a term-document matrix for all the items and tags (which reflects the tag frequencies for each item) and keep this matrix in memory as long as the application is running. Whenever a tag is added or removed, I use this matrix to update the similarities in the database. However, this is rather inefficient. Do you have any suggestions?

Thanks!


This presentation might help you:

http://www.slideshare.net/jnvms/incremental-itembased-collaborative-filtering-4095306

0

精彩评论

暂无评论...
验证码 换一张
取 消