Skip to content

Nearest Neighbours Recommendations - #14

Merged
benfred merged 2 commits into
masterfrom
nearest_neighbours
Feb 12, 2017
Merged

benfred merged 2 commits into
masterfrom
nearest_neighbours

Conversation

@benfred

@benfred benfred commented Dec 27, 2016 •

Copy link
Copy Markdown
Owner

This adds a fast and memory efficient of Item-Item KNN Recommendation models.

Calculating the Similarity matrix is based on the algorithm described in the
paper 'Sparse Matrix Multiplication Package (SMMP)'
(www.i2m.univ-amu.fr/~bradji/multp_sparse.pdf), but modified so that only the
top K rows are selected using a heap. This means that we can calculate
the similarity matrix even when the full similarity matrix wouldn't fit in
available memory. This calculation is also parallelized unlike the sparse matrix
multiply in scipy.

Also switch to using C++ instead of C for Cython, run flake8 on the Cython code,
add an isort check and cpplint check, and fix some issues with the ALS unittest
intermittently failing.

@benfred

benfred commented Dec 27, 2016 •

Copy link
Copy Markdown
Owner Author

still todo:

  • parallelize calculation
  • add scorer class
  • example usage
  • add save/load to scorer

This adds a fast and memory efficient of Item-Item KNN Recommendation models.

Calculating the Similarity matrix is based on the algorithm described in the
paper 'Sparse Matrix Multiplication Package (SMMP)'
(www.i2m.univ-amu.fr/~bradji/multp_sparse.pdf), but modified so that only the
top K rows are selected using a heap. This means that we can calculate
the similarity matrix even when the full similarity matrix wouldn't fit in
available memory. This calculation is also parallelized unlike the sparse matrix
multiply in scipy.

Also switch to using C++ instead of C for Cython, run flake8 on the Cython code,
add an isort check and cpplint check, and fix some issues with the ALS unittest
intermittently failing.
@benfred
benfred force-pushed the nearest_neighbours branch from 2230bc6 to bc548a0 Compare February 6, 2017 04:47
@benfred benfred changed the title first draft nearest neighbours code Nearest Neighbours Recommendations Feb 6, 2017
@benfred
benfred merged commit f5a3cdc into master Feb 12, 2017
@benfred
benfred deleted the nearest_neighbours branch February 12, 2017 17:51
@chapleau

Copy link
Copy Markdown

Thanks for providing this very neat package.
I was just wondering if, from a performance point of view, going to C++ from C for Cython makes a significant improvement ? Are the APIs/functions backward compatible ?
Thanks!

@benfred

benfred commented Feb 14, 2017 •

Copy link
Copy Markdown
Owner Author

Performance should be identical between C++ and C.

The API's and functions are also compatible from Python - I changed to C++ mainly to use the heap functions provided with the STL: https://github.com/benfred/implicit/blob/master/implicit/nearest_neighbours.h#L21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants