Fast Python Collaborative Filtering for Implicit Feedback Datasets

Overview

Implicit

Build Status

Fast Python Collaborative Filtering for Implicit Datasets.

This project provides fast Python implementations of several different popular recommendation algorithms for implicit feedback datasets:

All models have multi-threaded training routines, using Cython and OpenMP to fit the models in parallel among all available CPU cores. In addition, the ALS and BPR models both have custom CUDA kernels - enabling fitting on compatible GPU's. Approximate nearest neighbours libraries such as Annoy, NMSLIB and Faiss can also be used by Implicit to speed up making recommendations.

Installation

There are binary packages on conda-forge for Linux, Windows and OSX. These can be installed with:

conda install -c conda-forge implicit

There are also GPU enabled packages on conda-forge for x86_64 Linux systems using either CUDA 9.2, 10.0, 10.1 or 10.2. The GPU packages can be installed with:

conda install -c conda-forge implicit implicit-proc=*=gpu

There is also an sdist package on PyPi. This package can be installed with:

pip install implicit

Note that installing with pip requires a C++ compiler to be installed on your system, since this method will build implicit from source.

Basic Usage

import implicit

# initialize a model
model = implicit.als.AlternatingLeastSquares(factors=50)

# train the model on a sparse matrix of item/user/confidence weights
model.fit(item_user_data)

# recommend items for a user
user_items = item_user_data.T.tocsr()
recommendations = model.recommend(userid, user_items)

# find related items
related = model.similar_items(itemid)

The examples folder has a program showing how to use this to compute similar artists on the last.fm dataset.

For more information see the documentation.

Articles about Implicit

These blog posts describe the algorithms that power this library:

There are also several other blog posts about using Implicit to build recommendation systems:

Requirements

This library requires SciPy version 0.16 or later. Running on OSX requires an OpenMP compiler, which can be installed with homebrew: brew install gcc. Running on Windows requires Python 3.5+.

GPU Support requires at least version 9 of the NVidia CUDA Toolkit. The build will use the nvcc compiler that is found on the path, but this can be overriden by setting the CUDAHOME enviroment variable to point to your cuda installation.

This library has been tested with Python 2.7, 3.5, 3.6 and 3.7 on Ubuntu and OSX, and tested with Python 3.5 and 3.6 on Windows.

Benchmarks

Simple benchmarks comparing the ALS fitting time versus Spark and QMF can be found here.

Optimal Configuration

I'd recommend configuring SciPy to use Intel's MKL matrix libraries. One easy way of doing this is by installing the Anaconda Python distribution.

For systems using OpenBLAS, I highly recommend setting 'export OPENBLAS_NUM_THREADS=1'. This disables its internal multithreading ability, which leads to substantial speedups for this package. Likewise for Intel MKL, setting 'export MKL_NUM_THREADS=1' should also be set.

Released under the MIT License

Comments
  • error: Microsoft Visual C++ 14.0 is required. Get it with

    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    Hello, I tried pip installing implicit and I get the error below. Is there any work around? running install running build running build_py creating build creating build\lib.win-amd64-3.6 creating build\lib.win-amd64-3.6\implicit copying implicit\als.py -> build\lib.win-amd64-3.6\implicit copying implicit\approximate_als.py -> build\lib.win-amd64-3.6\implicit copying implicit\nearest_neighbours.py -> build\lib.win-amd64-3.6\implicit copying implicit\recommender_base.py -> build\lib.win-amd64-3.6\implicit copying implicit\utils.py -> build\lib.win-amd64-3.6\implicit copying implicit_init_.py -> build\lib.win-amd64-3.6\implicit running build_ext building 'implicit._als' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    opened by opokualbert 99
  • Feature/add_bias_terms_to_als

    Feature/add_bias_terms_to_als

    Added optional user and item bias terms to als.py as suggested by ita9naiwa in issue #176 and already implemented in LMF. Set use_bias=True to train with bias terms (not implemented for GPU yet).

    opened by howtodowtle 21
  • Adding user biases and item biases for implicit matrix factorization

    Adding user biases and item biases for implicit matrix factorization

    Hi @benfred ,

    I was wondering whether adding user and item biases would improve the model and recommendations. codecogseqn Did you consider this at some point or experiment with it? Would you expect better performance?

    Intuitively, I fear that without biases very popular items will dominate the recommendations more strongly than I want.

    Literature:

    • The original paper only talks about biases in the context of item-based neighbourhood models (section 3.1 in http://yifanhu.net/PUB/cf.pdf) but not in the context of the objective function.
    • There is this (somewhat obscure) article which claims that performance is better with biases: http://activisiongamescience.github.io/2016/01/11/Implicit-Recommender-Systems-Biased-Matrix-Factorization/
    • Well, most implementations of implicit matrix factorization (e.g. Spark) don't use biases.

    Would love to hear your take on it! Best Simon

    opened by SimonCW 15
  • Difficulty with bm25_weight in Linux install

    Difficulty with bm25_weight in Linux install

    On Ubuntu 16.04, when I try to import the bm25_weight function I get the following error:

    import implicit File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/implicit/init.py", line 3, in from . import nearest_neighbours File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/implicit/nearest_neighbours.py", line 7, in from ._nearest_neighbours import all_pairs_knn ImportError: /home/ubuntu/anaconda3/lib/python3.6/site-packages/implicit/_nearest_neighbours.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZdlPvm

    opened by angusturner 15
  • issues while installing pyaudio

    issues while installing pyaudio

    when i type command : pip install pyaudio

    i have tried several times and installed VS Build tools,but no use....

    it shows the error like-

    (c) 2019 Microsoft Corporation. All rights reserved.

    (venv) C:\Users\Administrator\untitled2>pip install pyaudio Collecting pyaudio Using cached PyAudio-0.2.11.tar.gz (37 kB) Using legacy setup.py install for pyaudio, since package 'wheel' is not installed. Installing collected packages: pyaudio Running setup.py install for pyaudio ... error ERROR: Command errored out with exit status 1: command: 'c:\users\administrator\untitled2\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ADMINI~1\AppData\ Local\Temp\pip-install-ikm8s3da\pyaudio\setup.py'"'"'; file='"'"'C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-ikm8s3da\pyaudio\setup.py'"'"';f= getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' inst all --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-ds3k0l5c\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\user s\administrator\untitled2\venv\include\site\python3.7\pyaudio' cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-ikm8s3da\pyaudio
    Complete output (9 lines): running install running build running build_py creating build creating build\lib.win-amd64-3.7 copying src\pyaudio.py -> build\lib.win-amd64-3.7 running build_ext building '_portaudio' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\users\administrator\untitled2\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '" '"'C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-ikm8s3da\pyaudio\setup.py'"'"'; file='"'"'C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-ik m8s3da\pyaudio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-ds3k0l5c\install-record.txt' --single-version-externally-managed --c ompile --install-headers 'c:\users\administrator\untitled2\venv\include\site\python3.7\pyaudio' Check the logs for full command output.

    opened by Saishankar2001 14
  • Error in similarity score?

    Error in similarity score?

    I think there is an error in the calculation of the similarity score. I first noticed the problem because I was getting scores larger than 1 and even a score different from 1 for the similarity of an item with itself. I believe I have found the source of the error.

    In recommender_base.py the similarity score is defined by the following function:

    def _get_similarity_score(self, factor, factors, norms, N):
        scores = factors.dot(factor) / norms
        best = np.argpartition(scores, -N)[-N:]
        return sorted(zip(best, scores[best]), key=lambda x: -x[1]
    

    The error here is that the dot product is being divided by only one of the norms. I think the following definition is correct:

    def _get_similarity_score(self, factor, factors, norms, N):
        scores = factors.dot(factor) / (np.linalg.norm(factor)*norms)
        best = np.argpartition(scores, -N)[-N:]
    
        return sorted(zip(best, scores[best]), key=lambda x: -x[1]
    

    I have tested it locally and it works.

    opened by dwolfeu 13
  • UnboundLocalError: local variable 'vali_user_items' referenced before assignment

    UnboundLocalError: local variable 'vali_user_items' referenced before assignment

    `factors=10 regularization=0.01 iterations=15

    model = implicit.als.AlternatingLeastSquares(factors=factors,regularization=regularization,iterations=iterations) model.fit(items_users) ` Gives an error

    /usr/local/lib/python3.6/dist-packages/implicit/als.py in fit(self, item_users, show_progress) 175 176 if self.use_gpu: --> 177 return self._fit_gpu(Ciu, Cui, vali_user_items, show_progress) 178 179 solver = self.solver

    UnboundLocalError: local variable 'vali_user_items' referenced before assignment

    bug 
    opened by filion 12
  • Can not install on google colaboratory

    Can not install on google colaboratory

    Hi, I am working on google colaboratory. After new updating, the package can not be installed. It seems it has a problem in bdist_wheel. Running setup.py bdist_wheel for implicit ... error Failed building wheel for implicit

    opened by leilanorouzi 12
  • error: Microsoft Visual C++ 14.0 is required. Get it with

    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    I am using "Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32"

    I tried to install "wordcloud" using pip install wordcloud

    I faced that error!!!! Any one here to help me how to get rid of it. ////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

    C:\Windows\system32>pip install wordcloud Collecting wordcloud Using cached wordcloud-1.4.1.tar.gz Requirement already satisfied: matplotlib in c:\program files\python36\lib\site-packages (from wordcloud) Requirement already satisfied: numpy>=1.6.1 in c:\program files\python36\lib\site-packages (from wordcloud) Requirement already satisfied: pillow in c:\program files\python36\lib\site-packages (from wordcloud) Requirement already satisfied: six>=1.10 in c:\program files\python36\lib\site-packages (from matplotlib->wordcloud) Requirement already satisfied: python-dateutil>=2.1 in c:\program files\python36\lib\site-packages (from matplotlib->wordcloud) Requirement already satisfied: pytz in c:\program files\python36\lib\site-packages (from matplotlib->wordcloud) Requirement already satisfied: cycler>=0.10 in c:\program files\python36\lib\site-packages (from matplotlib->wordcloud) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\program files\python36\lib\site-packages (from matplotlib->wordcloud) Requirement already satisfied: kiwisolver>=1.0.1 in c:\program files\python36\lib\site-packages (from matplotlib->wordcloud) Requirement already satisfied: setuptools in c:\program files\python36\lib\site-packages (from kiwisolver>=1.0.1->matplotlib->wordcloud) Installing collected packages: wordcloud Running setup.py install for wordcloud ... error Complete output from command "c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\DILSHAD\AppData\Local\Temp\pip-build-s0v4o0v_\wordcloud\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\DILSHAD\AppData\Local\Temp\pip-0ki_078y-record\install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build\lib.win-amd64-3.6 creating build\lib.win-amd64-3.6\wordcloud copying wordcloud\color_from_image.py -> build\lib.win-amd64-3.6\wordcloud copying wordcloud\tokenization.py -> build\lib.win-amd64-3.6\wordcloud copying wordcloud\wordcloud.py -> build\lib.win-amd64-3.6\wordcloud copying wordcloud\wordcloud_cli.py -> build\lib.win-amd64-3.6\wordcloud copying wordcloud_init_.py -> build\lib.win-amd64-3.6\wordcloud copying wordcloud\stopwords -> build\lib.win-amd64-3.6\wordcloud copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-3.6\wordcloud running build_ext building 'wordcloud.query_integral_image' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
    

    Command ""c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\DILSHAD\AppData\Local\Temp\pip-build-s0v4o0v_\wordcloud\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\DILSHAD\AppData\Local\Temp\pip-0ki_078y-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\DILSHAD\AppData\Local\Temp\pip-build-s0v4o0v_\wordcloud\

    opened by Dilshad737 12
  • Install problem: Cannot compile on platform 'posix' with 'nvidia' compiler

    Install problem: Cannot compile on platform 'posix' with 'nvidia' compiler

    I am installing implicit through pip install git+https://github.com/benfred/implicit.git@f33d2e7d753f3ab4da0901485bd68e47dba7b9eb

    And I got this error during installation

    error: don't know how to compile C/C++ code on platform 'posix' with 'nvidia' compiler
    ----------------------------------------
    ERROR: Failed building wheel for implicit
    Failed to build implicit
    ERROR: Could not build wheels for implicit, which is required to install pyproject.toml-based projects
    

    I am using tensorflow/tensorflow:2.3.0-gpu as my docker base image, image digest: 9a52554e85ae666767c28f9af70e56caa7e6d75325951ab021fbd4bb1447a340

    This error never happened before, I am not sure what happened to the compiler or which compiler should be used?

    Please help me, any help or advise are welcomed.

    opened by andyfcx 11
  • Can't install implicit

    Can't install implicit

    I am trying to install the implicit package on windows 10 with Python 2.7.15 using

    pip install implicit
    

    There seems to be an error with implicit/bpr.cpp if I am not mistaken. I have no idea what to do.

    implicit\bpr.cpp(1277) : fatal error C1003: error count exceeds 100; stopping compilation

    This is the full log I am getting:

    C:\WINDOWS\system32>pip install implicit
    Collecting implicit
      Using cached https://files.pythonhosted.org/packages/d9/0c/7f9f065cceab3c27b7207bbbc3127ff698f1dbaabc2e5f5ef92cb3a39a43/implicit-0.3.6.tar.gz
    Requirement already satisfied: numpy in c:\python27\lib\site-packages (from implicit) (1.11.2+mkl)
    Requirement already satisfied: scipy>=0.16 in c:\python27\lib\site-packages (from implicit) (0.18.1)
    Requirement already satisfied: h5py in c:\python27\lib\site-packages (from implicit) (2.8.0)
    Requirement already satisfied: tqdm in c:\python27\lib\site-packages (from implicit) (4.24.0)
    Requirement already satisfied: six in c:\python27\lib\site-packages (from h5py->implicit) (1.10.0)
    Building wheels for collected packages: implicit
      Running setup.py bdist_wheel for implicit ... error
      Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\shiro\\appdata\\local\\temp\\pip-install-civoat\\implicit\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d c:\users\shiro\appdata\local\temp\pip-wheel-iv5suw --python-tag cp27:
      WARNING:root:The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME to enable CUDA extensions
      Failed to find CUDA toolkit. Building without GPU acceleration.
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-2.7
      creating build\lib.win-amd64-2.7\implicit
      copying implicit\als.py -> build\lib.win-amd64-2.7\implicit
      copying implicit\approximate_als.py -> build\lib.win-amd64-2.7\implicit
      copying implicit\nearest_neighbours.py -> build\lib.win-amd64-2.7\implicit
      copying implicit\recommender_base.py -> build\lib.win-amd64-2.7\implicit
      copying implicit\utils.py -> build\lib.win-amd64-2.7\implicit
      copying implicit\__init__.py -> build\lib.win-amd64-2.7\implicit
      creating build\lib.win-amd64-2.7\implicit\cuda
      copying implicit\cuda\__init__.py -> build\lib.win-amd64-2.7\implicit\cuda
      creating build\lib.win-amd64-2.7\implicit\datasets
      copying implicit\datasets\lastfm.py -> build\lib.win-amd64-2.7\implicit\datasets
      copying implicit\datasets\million_song_dataset.py -> build\lib.win-amd64-2.7\implicit\datasets
      copying implicit\datasets\movielens.py -> build\lib.win-amd64-2.7\implicit\datasets
      copying implicit\datasets\sketchfab.py -> build\lib.win-amd64-2.7\implicit\datasets
      copying implicit\datasets\_download.py -> build\lib.win-amd64-2.7\implicit\datasets
      copying implicit\datasets\__init__.py -> build\lib.win-amd64-2.7\implicit\datasets
      running build_ext
      building 'implicit._als' extension
      creating build\temp.win-amd64-2.7
      creating build\temp.win-amd64-2.7\Release
      creating build\temp.win-amd64-2.7\Release\implicit
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\include -Ic:\python27\PC /Tpimplicit\_als.cpp /Fobuild\temp.win-amd64-2.7\Release\implicit\_als.obj /O2 /openmp
      _als.cpp
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
      implicit\_als.cpp(3637) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
      implicit\_als.cpp(3919) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
      implicit\_als.cpp(4404) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(4405) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(4850) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(5568) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(5569) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(6732) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(6733) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(7178) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(7896) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(7897) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(9060) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(9061) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(9506) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(10224) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(10225) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(11678) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
      implicit\_als.cpp(11960) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
      implicit\_als.cpp(12468) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(12469) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(12854) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(12999) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(13040) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(13526) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(13527) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(14584) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(14585) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(14970) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(15115) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(15156) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(15642) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(15643) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(16700) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(16701) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(17086) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(17231) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(17272) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(17758) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(17759) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(19070) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
      implicit\_als.cpp(19352) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
      implicit\_als.cpp(19842) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(19843) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(19844) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(20148) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(20652) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(20653) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(20654) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(21462) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(21463) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(21464) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(21768) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(22272) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(22273) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(22274) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(23082) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(23083) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(23084) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(23388) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
      implicit\_als.cpp(23892) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(23893) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      implicit\_als.cpp(23894) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\python27\libs /LIBPATH:c:\python27\PCbuild\amd64 /LIBPATH:c:\python27\PC\VS9.0\amd64 /EXPORT:init_als build\temp.win-amd64-2.7\Release\implicit\_als.obj /OUT:build\lib.win-amd64-2.7\implicit\_als.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\implicit\_als.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\implicit\_als.pyd.manifest
      _als.obj : warning LNK4197: export 'init_als' specified multiple times; using first specification
    	 Creating library build\temp.win-amd64-2.7\Release\implicit\_als.lib and object build\temp.win-amd64-2.7\Release\implicit\_als.exp
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.7\Release\implicit\_als.pyd.manifest -outputresource:build\lib.win-amd64-2.7\implicit\_als.pyd;2
      building 'implicit._nearest_neighbours' extension
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Iimplicit -Ic:\python27\include -Ic:\python27\PC /Tpimplicit\_nearest_neighbours.cpp /Fobuild\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.obj /O2 /openmp
      _nearest_neighbours.cpp
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
      implicit\_nearest_neighbours.cpp(2867) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
      implicit\_nearest_neighbours.cpp(3187) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
      implicit\_nearest_neighbours.cpp(3604) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
      implicit\_nearest_neighbours.cpp(4027) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
      implicit\_nearest_neighbours.cpp(4444) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\python27\libs /LIBPATH:c:\python27\PCbuild\amd64 /LIBPATH:c:\python27\PC\VS9.0\amd64 /EXPORT:init_nearest_neighbours build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.obj /OUT:build\lib.win-amd64-2.7\implicit\_nearest_neighbours.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.pyd.manifest
      _nearest_neighbours.obj : warning LNK4197: export 'init_nearest_neighbours' specified multiple times; using first specification
    	 Creating library build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.lib and object build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.exp
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.pyd.manifest -outputresource:build\lib.win-amd64-2.7\implicit\_nearest_neighbours.pyd;2
      building 'implicit.bpr' extension
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Iimplicit -Ic:\python27\include -Ic:\python27\PC /Tpimplicit\bpr.cpp /Fobuild\temp.win-amd64-2.7\Release\implicit\bpr.obj /O2 /openmp
      bpr.cpp
      C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
      implicit\bpr.cpp(954) : error C2039: 'mt19937' : is not a member of 'std'
      implicit\bpr.cpp(954) : error C2065: 'mt19937' : undeclared identifier
      implicit\bpr.cpp(955) : error C2039: 'uniform_int_distribution' : is not a member of 'std'
      implicit\bpr.cpp(955) : error C2065: 'uniform_int_distribution' : undeclared identifier
      implicit\bpr.cpp(955) : error C2062: type 'long' unexpected
      implicit\bpr.cpp(956) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(966) : error C2143: syntax error : missing ';' before '{'
      implicit\bpr.cpp(981) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(991) : error C2143: syntax error : missing ';' before '{'
      implicit\bpr.cpp(994) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(1004) : error C2143: syntax error : missing ';' before '{'
      implicit\bpr.cpp(1017) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(1027) : error C2143: syntax error : missing ';' before '{'
      implicit\bpr.cpp(1032) : error C2059: syntax error : ')'
      implicit\bpr.cpp(1033) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(1045) : error C2143: syntax error : missing ';' before '{'
      implicit\bpr.cpp(1047) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(1060) : error C2143: syntax error : missing ';' before '{'
      implicit\bpr.cpp(1062) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(1074) : error C2143: syntax error : missing ';' before '{'
      implicit\bpr.cpp(1075) : error C2059: syntax error : ')'
      implicit\bpr.cpp(1076) : error C2059: syntax error : ')'
      implicit\bpr.cpp(1077) : error C2059: syntax error : ','
      implicit\bpr.cpp(1077) : error C2059: syntax error : ')'
      implicit\bpr.cpp(1078) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1079) : error C2059: syntax error : ','
      implicit\bpr.cpp(1079) : error C2059: syntax error : ')'
      implicit\bpr.cpp(1080) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1081) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1082) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(1094) : error C2143: syntax error : missing ';' before '{'
      implicit\bpr.cpp(1096) : error C2143: syntax error : missing ';' before '}'
      implicit\bpr.cpp(1165) : error C2065: 'attr_name' : undeclared identifier
      implicit\bpr.cpp(1165) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1165) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1178) : error C2065: 'kw_name' : undeclared identifier
      implicit\bpr.cpp(1178) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1178) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1181) : error C2065: 'argnames' : undeclared identifier
      implicit\bpr.cpp(1181) : error C2059: syntax error : ']'
      implicit\bpr.cpp(1182) : error C2065: 'kwds2' : undeclared identifier
      implicit\bpr.cpp(1182) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1182) : error C2146: syntax error : missing ',' before identifier 'values'
      implicit\bpr.cpp(1182) : error C2065: 'values' : undeclared identifier
      implicit\bpr.cpp(1182) : error C2059: syntax error : ']'
      implicit\bpr.cpp(1183) : error C2146: syntax error : missing ',' before identifier 'function_name'
      implicit\bpr.cpp(1183) : error C2065: 'function_name' : undeclared identifier
      implicit\bpr.cpp(1183) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1190) : error C2065: 'arg' : undeclared identifier
      implicit\bpr.cpp(1190) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1190) : error C2146: syntax error : missing ',' before identifier 'kw'
      implicit\bpr.cpp(1190) : error C2065: 'kw' : undeclared identifier
      implicit\bpr.cpp(1190) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1213) : error C2065: 'type' : undeclared identifier
      implicit\bpr.cpp(1213) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1213) : error C2146: syntax error : missing ',' before identifier 'value'
      implicit\bpr.cpp(1213) : error C2065: 'value' : undeclared identifier
      implicit\bpr.cpp(1213) : error C2146: syntax error : missing ',' before identifier 'tb'
      implicit\bpr.cpp(1213) : error C2065: 'tb' : undeclared identifier
      implicit\bpr.cpp(1213) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1214) : error C2065: 'type' : undeclared identifier
      implicit\bpr.cpp(1214) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1214) : error C2146: syntax error : missing ',' before identifier 'value'
      implicit\bpr.cpp(1214) : error C2065: 'value' : undeclared identifier
      implicit\bpr.cpp(1214) : error C2146: syntax error : missing ',' before identifier 'tb'
      implicit\bpr.cpp(1214) : error C2065: 'tb' : undeclared identifier
      implicit\bpr.cpp(1214) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1232) : error C2065: 'value' : undeclared identifier
      implicit\bpr.cpp(1232) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1232) : error C2146: syntax error : missing ',' before identifier 'tb'
      implicit\bpr.cpp(1232) : error C2065: 'tb' : undeclared identifier
      implicit\bpr.cpp(1232) : error C2146: syntax error : missing ',' before identifier 'cause'
      implicit\bpr.cpp(1232) : error C2065: 'cause' : undeclared identifier
      implicit\bpr.cpp(1232) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1246) : error C2065: 'args' : undeclared identifier
      implicit\bpr.cpp(1246) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1246) : error C2146: syntax error : missing ',' before identifier 'nargs'
      implicit\bpr.cpp(1246) : error C2065: 'nargs' : undeclared identifier
      implicit\bpr.cpp(1246) : error C2146: syntax error : missing ',' before identifier 'kwargs'
      implicit\bpr.cpp(1246) : error C2065: 'kwargs' : undeclared identifier
      implicit\bpr.cpp(1246) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1254) : error C2065: 'arg' : undeclared identifier
      implicit\bpr.cpp(1254) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1254) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1258) : error C2065: 'arg' : undeclared identifier
      implicit\bpr.cpp(1258) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1258) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1269) : error C2065: 'op2' : undeclared identifier
      implicit\bpr.cpp(1269) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1269) : error C2146: syntax error : missing ',' before identifier 'intval'
      implicit\bpr.cpp(1269) : error C2065: 'intval' : undeclared identifier
      implicit\bpr.cpp(1269) : error C2146: syntax error : missing ',' before identifier 'inplace'
      implicit\bpr.cpp(1269) : error C2065: 'inplace' : undeclared identifier
      implicit\bpr.cpp(1269) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1277) : error C2065: 'op2' : undeclared identifier
      implicit\bpr.cpp(1277) : error C2275: 'PyObject' : illegal use of this type as an expression
    		  c:\python27\include\object.h(108) : see declaration of 'PyObject'
      implicit\bpr.cpp(1277) : error C2146: syntax error : missing ',' before identifier 'intval'
      implicit\bpr.cpp(1277) : error C2065: 'intval' : undeclared identifier
      implicit\bpr.cpp(1277) : error C2146: syntax error : missing ',' before identifier 'inplace'
      implicit\bpr.cpp(1277) : error C2065: 'inplace' : undeclared identifier
      implicit\bpr.cpp(1277) : error C2143: syntax error : missing ',' before ')'
      implicit\bpr.cpp(1277) : fatal error C1003: error count exceeds 100; stopping compilation
      error: command 'C:\\Users\\shiro\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
    
      ----------------------------------------
      Failed building wheel for implicit
      Running setup.py clean for implicit
    Failed to build implicit
    Installing collected packages: implicit
      Running setup.py install for implicit ... error
    	Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\shiro\\appdata\\local\\temp\\pip-install-civoat\\implicit\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\shiro\appdata\local\temp\pip-record-bhxxuv\install-record.txt --single-version-externally-managed --compile:
    	WARNING:root:The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME to enable CUDA extensions
    	Failed to find CUDA toolkit. Building without GPU acceleration.
    	running install
    	running build
    	running build_py
    	creating build
    	creating build\lib.win-amd64-2.7
    	creating build\lib.win-amd64-2.7\implicit
    	copying implicit\als.py -> build\lib.win-amd64-2.7\implicit
    	copying implicit\approximate_als.py -> build\lib.win-amd64-2.7\implicit
    	copying implicit\nearest_neighbours.py -> build\lib.win-amd64-2.7\implicit
    	copying implicit\recommender_base.py -> build\lib.win-amd64-2.7\implicit
    	copying implicit\utils.py -> build\lib.win-amd64-2.7\implicit
    	copying implicit\__init__.py -> build\lib.win-amd64-2.7\implicit
    	creating build\lib.win-amd64-2.7\implicit\cuda
    	copying implicit\cuda\__init__.py -> build\lib.win-amd64-2.7\implicit\cuda
    	creating build\lib.win-amd64-2.7\implicit\datasets
    	copying implicit\datasets\lastfm.py -> build\lib.win-amd64-2.7\implicit\datasets
    	copying implicit\datasets\million_song_dataset.py -> build\lib.win-amd64-2.7\implicit\datasets
    	copying implicit\datasets\movielens.py -> build\lib.win-amd64-2.7\implicit\datasets
    	copying implicit\datasets\sketchfab.py -> build\lib.win-amd64-2.7\implicit\datasets
    	copying implicit\datasets\_download.py -> build\lib.win-amd64-2.7\implicit\datasets
    	copying implicit\datasets\__init__.py -> build\lib.win-amd64-2.7\implicit\datasets
    	running build_ext
    	building 'implicit._als' extension
    	creating build\temp.win-amd64-2.7
    	creating build\temp.win-amd64-2.7\Release
    	creating build\temp.win-amd64-2.7\Release\implicit
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\include -Ic:\python27\PC /Tpimplicit\_als.cpp /Fobuild\temp.win-amd64-2.7\Release\implicit\_als.obj /O2 /openmp
    	_als.cpp
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    	implicit\_als.cpp(3637) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
    	implicit\_als.cpp(3919) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
    	implicit\_als.cpp(4404) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(4405) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(4850) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(5568) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(5569) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(6732) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(6733) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(7178) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(7896) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(7897) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(9060) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(9061) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(9506) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(10224) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(10225) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(11678) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
    	implicit\_als.cpp(11960) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
    	implicit\_als.cpp(12468) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(12469) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(12854) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(12999) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(13040) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(13526) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(13527) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(14584) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(14585) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(14970) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(15115) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(15156) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(15642) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(15643) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(16700) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(16701) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(17086) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(17231) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(17272) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(17758) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(17759) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(19070) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
    	implicit\_als.cpp(19352) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
    	implicit\_als.cpp(19842) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(19843) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(19844) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(20148) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(20652) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(20653) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(20654) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(21462) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(21463) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(21464) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(21768) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(22272) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(22273) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(22274) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(23082) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(23083) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(23084) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(23388) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
    	implicit\_als.cpp(23892) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(23893) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	implicit\_als.cpp(23894) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\python27\libs /LIBPATH:c:\python27\PCbuild\amd64 /LIBPATH:c:\python27\PC\VS9.0\amd64 /EXPORT:init_als build\temp.win-amd64-2.7\Release\implicit\_als.obj /OUT:build\lib.win-amd64-2.7\implicit\_als.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\implicit\_als.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\implicit\_als.pyd.manifest
    	_als.obj : warning LNK4197: export 'init_als' specified multiple times; using first specification
    	   Creating library build\temp.win-amd64-2.7\Release\implicit\_als.lib and object build\temp.win-amd64-2.7\Release\implicit\_als.exp
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.7\Release\implicit\_als.pyd.manifest -outputresource:build\lib.win-amd64-2.7\implicit\_als.pyd;2
    	building 'implicit._nearest_neighbours' extension
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Iimplicit -Ic:\python27\include -Ic:\python27\PC /Tpimplicit\_nearest_neighbours.cpp /Fobuild\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.obj /O2 /openmp
    	_nearest_neighbours.cpp
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    	implicit\_nearest_neighbours.cpp(2867) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
    	implicit\_nearest_neighbours.cpp(3187) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
    	implicit\_nearest_neighbours.cpp(3604) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
    	implicit\_nearest_neighbours.cpp(4027) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
    	implicit\_nearest_neighbours.cpp(4444) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\python27\libs /LIBPATH:c:\python27\PCbuild\amd64 /LIBPATH:c:\python27\PC\VS9.0\amd64 /EXPORT:init_nearest_neighbours build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.obj /OUT:build\lib.win-amd64-2.7\implicit\_nearest_neighbours.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.pyd.manifest
    	_nearest_neighbours.obj : warning LNK4197: export 'init_nearest_neighbours' specified multiple times; using first specification
    	   Creating library build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.lib and object build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.exp
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.7\Release\implicit\_nearest_neighbours.pyd.manifest -outputresource:build\lib.win-amd64-2.7\implicit\_nearest_neighbours.pyd;2
    	building 'implicit.bpr' extension
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Iimplicit -Ic:\python27\include -Ic:\python27\PC /Tpimplicit\bpr.cpp /Fobuild\temp.win-amd64-2.7\Release\implicit\bpr.obj /O2 /openmp
    	bpr.cpp
    	C:\Users\shiro\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    	implicit\bpr.cpp(954) : error C2039: 'mt19937' : is not a member of 'std'
    	implicit\bpr.cpp(954) : error C2065: 'mt19937' : undeclared identifier
    	implicit\bpr.cpp(955) : error C2039: 'uniform_int_distribution' : is not a member of 'std'
    	implicit\bpr.cpp(955) : error C2065: 'uniform_int_distribution' : undeclared identifier
    	implicit\bpr.cpp(955) : error C2062: type 'long' unexpected
    	implicit\bpr.cpp(956) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(966) : error C2143: syntax error : missing ';' before '{'
    	implicit\bpr.cpp(981) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(991) : error C2143: syntax error : missing ';' before '{'
    	implicit\bpr.cpp(994) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(1004) : error C2143: syntax error : missing ';' before '{'
    	implicit\bpr.cpp(1017) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(1027) : error C2143: syntax error : missing ';' before '{'
    	implicit\bpr.cpp(1032) : error C2059: syntax error : ')'
    	implicit\bpr.cpp(1033) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(1045) : error C2143: syntax error : missing ';' before '{'
    	implicit\bpr.cpp(1047) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(1060) : error C2143: syntax error : missing ';' before '{'
    	implicit\bpr.cpp(1062) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(1074) : error C2143: syntax error : missing ';' before '{'
    	implicit\bpr.cpp(1075) : error C2059: syntax error : ')'
    	implicit\bpr.cpp(1076) : error C2059: syntax error : ')'
    	implicit\bpr.cpp(1077) : error C2059: syntax error : ','
    	implicit\bpr.cpp(1077) : error C2059: syntax error : ')'
    	implicit\bpr.cpp(1078) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1079) : error C2059: syntax error : ','
    	implicit\bpr.cpp(1079) : error C2059: syntax error : ')'
    	implicit\bpr.cpp(1080) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1081) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1082) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(1094) : error C2143: syntax error : missing ';' before '{'
    	implicit\bpr.cpp(1096) : error C2143: syntax error : missing ';' before '}'
    	implicit\bpr.cpp(1165) : error C2065: 'attr_name' : undeclared identifier
    	implicit\bpr.cpp(1165) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1165) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1178) : error C2065: 'kw_name' : undeclared identifier
    	implicit\bpr.cpp(1178) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1178) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1181) : error C2065: 'argnames' : undeclared identifier
    	implicit\bpr.cpp(1181) : error C2059: syntax error : ']'
    	implicit\bpr.cpp(1182) : error C2065: 'kwds2' : undeclared identifier
    	implicit\bpr.cpp(1182) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1182) : error C2146: syntax error : missing ',' before identifier 'values'
    	implicit\bpr.cpp(1182) : error C2065: 'values' : undeclared identifier
    	implicit\bpr.cpp(1182) : error C2059: syntax error : ']'
    	implicit\bpr.cpp(1183) : error C2146: syntax error : missing ',' before identifier 'function_name'
    	implicit\bpr.cpp(1183) : error C2065: 'function_name' : undeclared identifier
    	implicit\bpr.cpp(1183) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1190) : error C2065: 'arg' : undeclared identifier
    	implicit\bpr.cpp(1190) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1190) : error C2146: syntax error : missing ',' before identifier 'kw'
    	implicit\bpr.cpp(1190) : error C2065: 'kw' : undeclared identifier
    	implicit\bpr.cpp(1190) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1213) : error C2065: 'type' : undeclared identifier
    	implicit\bpr.cpp(1213) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1213) : error C2146: syntax error : missing ',' before identifier 'value'
    	implicit\bpr.cpp(1213) : error C2065: 'value' : undeclared identifier
    	implicit\bpr.cpp(1213) : error C2146: syntax error : missing ',' before identifier 'tb'
    	implicit\bpr.cpp(1213) : error C2065: 'tb' : undeclared identifier
    	implicit\bpr.cpp(1213) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1214) : error C2065: 'type' : undeclared identifier
    	implicit\bpr.cpp(1214) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1214) : error C2146: syntax error : missing ',' before identifier 'value'
    	implicit\bpr.cpp(1214) : error C2065: 'value' : undeclared identifier
    	implicit\bpr.cpp(1214) : error C2146: syntax error : missing ',' before identifier 'tb'
    	implicit\bpr.cpp(1214) : error C2065: 'tb' : undeclared identifier
    	implicit\bpr.cpp(1214) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1232) : error C2065: 'value' : undeclared identifier
    	implicit\bpr.cpp(1232) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1232) : error C2146: syntax error : missing ',' before identifier 'tb'
    	implicit\bpr.cpp(1232) : error C2065: 'tb' : undeclared identifier
    	implicit\bpr.cpp(1232) : error C2146: syntax error : missing ',' before identifier 'cause'
    	implicit\bpr.cpp(1232) : error C2065: 'cause' : undeclared identifier
    	implicit\bpr.cpp(1232) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1246) : error C2065: 'args' : undeclared identifier
    	implicit\bpr.cpp(1246) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1246) : error C2146: syntax error : missing ',' before identifier 'nargs'
    	implicit\bpr.cpp(1246) : error C2065: 'nargs' : undeclared identifier
    	implicit\bpr.cpp(1246) : error C2146: syntax error : missing ',' before identifier 'kwargs'
    	implicit\bpr.cpp(1246) : error C2065: 'kwargs' : undeclared identifier
    	implicit\bpr.cpp(1246) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1254) : error C2065: 'arg' : undeclared identifier
    	implicit\bpr.cpp(1254) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1254) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1258) : error C2065: 'arg' : undeclared identifier
    	implicit\bpr.cpp(1258) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1258) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1269) : error C2065: 'op2' : undeclared identifier
    	implicit\bpr.cpp(1269) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1269) : error C2146: syntax error : missing ',' before identifier 'intval'
    	implicit\bpr.cpp(1269) : error C2065: 'intval' : undeclared identifier
    	implicit\bpr.cpp(1269) : error C2146: syntax error : missing ',' before identifier 'inplace'
    	implicit\bpr.cpp(1269) : error C2065: 'inplace' : undeclared identifier
    	implicit\bpr.cpp(1269) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1277) : error C2065: 'op2' : undeclared identifier
    	implicit\bpr.cpp(1277) : error C2275: 'PyObject' : illegal use of this type as an expression
    			c:\python27\include\object.h(108) : see declaration of 'PyObject'
    	implicit\bpr.cpp(1277) : error C2146: syntax error : missing ',' before identifier 'intval'
    	implicit\bpr.cpp(1277) : error C2065: 'intval' : undeclared identifier
    	implicit\bpr.cpp(1277) : error C2146: syntax error : missing ',' before identifier 'inplace'
    	implicit\bpr.cpp(1277) : error C2065: 'inplace' : undeclared identifier
    	implicit\bpr.cpp(1277) : error C2143: syntax error : missing ',' before ')'
    	implicit\bpr.cpp(1277) : fatal error C1003: error count exceeds 100; stopping compilation
    	error: command 'C:\\Users\\shiro\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
    
    	----------------------------------------
    Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\shiro\\appdata\\local\\temp\\pip-install-civoat\\implicit\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\shiro\appdata\local\temp\pip-record-bhxxuv\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\shiro\appdata\local\temp\pip-install-civoat\implicit\
    
    opened by dimitris93 11
  • Fix incorrect test set values in leave_k_out splits with sparse user rows

    Fix incorrect test set values in leave_k_out splits with sparse user rows

    Closes #639

    This PR fixes a bug in the evaluation of the leave_k_out_split in which the produced test matrix would contain values that were many multiples of their original value. Tests are also added on static (non-random) matrices that otherwise fail in the un-corrected implementation.

    This bug resulted from a calculation that required an input array with sequential values - the fact that non-sequential values were provided led to an error in processing.

    Specifically, the arr argument in _take_tails

    ----------
    arr: ndarray
        The input array. This should be an array of integers in the range 0->n, where
        the ordered unique set of integers in said array should produce an array of
        consecutive integers. Concretely, the array [1, 0, 1, 1, 0, 3] would be invalid,
        but the array [1, 0, 1, 1, 0, 2] would not be.
    

    was being provided as candidate_users, from which user indices falling below the threshold were removed, resulting in a list in which the ordered set of unique integers was not consecutive and therefore the provided array was invalid.

    opened by chrisjkuch 0
  • leave_k_out_split produces incorrect values in test set

    leave_k_out_split produces incorrect values in test set

    I noticed odd behavior in leave_k_out_split - specifically, under certain circumstances (many rows with one value?), the number returned for the withheld test set value is different from the actual value. This causes train + test to fail to reconstruct the original matrix.

    Script to reproduce:

    import implicit
    
    implicit.__version__
    #> '0.6.2'
    
    from implicit.evaluation import leave_k_out_split
    from scipy import sparse
    
    ratings = sparse.csr_matrix(
        [[3, 2, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 1, 1, 1]]
    )
    
    train, test = leave_k_out_split(ratings, K=1, random_state=42)
    
    diff = (train + test) - ratings
    
    diff.nnz
    #> 1
    
    train.todense()
    #> matrix([[3, 2, 0, 0],
    #>         [1, 0, 0, 0],
    #>         [0, 1, 0, 0],
    #>         [0, 0, 1, 0],
    #>         [0, 1, 0, 1]])
    
    test.todense()
    #> matrix([[0, 0, 4, 0],
    #>         [0, 0, 0, 0],
    #>         [0, 0, 0, 0],
    #>         [0, 0, 0, 0],
    #>         [0, 0, 1, 0]])
    
    diff.todense()
    #> matrix([[0, 0, 3, 0],
    #>         [0, 0, 0, 0],
    #>         [0, 0, 0, 0],
    #>         [0, 0, 0, 0],
    #>         [0, 0, 0, 0]])
    

    Created at 2022-12-23 13:59:28 CST by reprexlite v0.5.0

    I believe the issue is in _take_tails - the returned test_idx array has multiple copies of the first user index returned, so we end up with a test set value that is copied multiple times.

    (As an aside, the call to _take_tails when shuffled=True does not pass on the rng, so the random state cannot be maintained.)

    opened by chrisjkuch 1
  • Add ialspp optimizer in cpu.ALS

    Add ialspp optimizer in cpu.ALS

    This PR implements


    correctness verification

    I get ml-1m data and preprocessed as below

    counts = get_movielens(variant='1m')
    user_items = counts.T.tocsr()
    user_items.data[user_items.data <= 4.0] = 0
    user_items.eliminate_zeros()
    user_items.data[:] = 1.0
    

    and run ALS for both CG and ialspp approach using following hyperparameter set

    model = AlternatingLeastSquares(
        factors=512,
        regularization=2.0,
        alpha=5.0,
        use_native=True,
        use_cg=False,
        use_gpu=False,
        use_ialspp=True,
        iterations=10,
        calculate_training_loss=False,
        num_threads=12,
    )
    

    and ranking metrics give almost same results

    ranking_metrics_at_k(model, tr, te, K=50)
    > {'precision': 0.1126659490491568, 'map': 0.028802994722126836, 'ndcg': 0.07890071767410052, 'auc': 0.5602418716459558}
    > {'precision': 0.11149982059562254, 'map': 0.029011087049113284, 'ndcg': 0.07887135532015757, 'auc': 0.5603164551005837}
    

    Training Speed-Up

    i found that this approach's performance gain vary across implementation.

    In Buffalo, I observed performance gain from 256 dim, but in Implicit, training becomes fast from num factors of 512.

    Speedup along dimensions

      | 512 | 1024 | 2048 | 4096 -- | -- | -- | -- | -- ials++ | 62.49 | 64.57 | 78.8 | 87.42 cg | 70.62 | 107.11 | 124.4 | 610.32

    image image

    Average training time per iteration becomes 1.6-1.8 times faster in moderate dimensions [512, 2048], but extremely huge more than 4096 dimensions. However, I think it is not very realistic to use dimensions larger than 2048, though.

    opened by ita9naiwa 0
  • Method 'recommend' is broken

    Method 'recommend' is broken

    Hi,

    I see a problem with current implementation of "recommend" function.

    ==== Example of wrong behaviour ====

    For Last fm: current behaviour with default parameters: image

    most probably expected behaviour (however still not sure if output is correct): image

    ==== Problem ====

    There is some problem in recommend function logic for class MatrixFactorizationBase. I might be wrong, but you can't expect user_items.shape[0] != user_count and at the same time have current version of class method user = self._user_factor(....). I think the correct logic should be user_items.shape[0] > user_count where user_count = max(user_id)?

    Consider that by default user most probably will do on of this two calls:

    model.recommend(11, user_plays)- this won't work in current version, but worked in version 0.4.0 model.recommend(11, user_plays[11:12])- this will work in 0.6.1, but then it will get strange behaviour after calling: self._user_factor(userid, user_items, recalculate_user).

    ==== Code snippet with current implementation: ====

    def recommend(
         self,
         userid,
         user_items,
         N=10,
         filter_already_liked_items=True,
         filter_items=None,
         recalculate_user=False,
         items=None,
     ):
         if filter_already_liked_items or recalculate_user:
             if not isinstance(user_items, csr_matrix):
                 raise ValueError("user_items needs to be a CSR sparse matrix")
             user_count = 1 if np.isscalar(userid) else len(userid)
             if user_items.shape[0] != user_count:
                 raise ValueError("user_items must contain 1 row for every user in userids")
    
         user = self._user_factor(userid, user_items, recalculate_user)
    
    opened by IvanPetrovMck 3
  • NDCG computation

    NDCG computation

    Hello @benfred. I think there might be an issue with the computation of NDCG in ranking_metrics_at_k. I believe NDCG should be calculated by first sorting the recommended ids by the recommendation scores, so that the logarithmic discount is applied in the correct ranking of the recommendations. Right now, Implicit's recommend methods do not return the ids sorted by their descending scores, so the way NDCG is being calculated does not take into account the order of the ranking.

    I would appreciate your opinion, maybe I'm missing something and I'm wrong. Thanks in advance.

    If changes turn out to be necessary, I would suggest adding some lines on this part of ranking_metrics_at_k

    while start_idx < len(to_generate):
            batch = to_generate[start_idx: start_idx + batch_size]
            ids, scores = model.recommend(batch, train_user_items[batch], N=K)
            start_idx += batch_size
           
            # added
            sorted_scores = np.flip(np.argsort(scores, axis=1), axis=1)
            ids = ids[np.arange(ids.shape[0])[:, None], sorted_scores]
    
    opened by malonsocortes 2
  • .recommend return different output when different 'N' parameter is specified for bm25 recommender

    .recommend return different output when different 'N' parameter is specified for bm25 recommender

    I trained a bm25 nearest neighbor recommender. When I specify different 'N' parameter in the model.recommend() method, I get different scores and order for the recommendations. With ALS model, it returns the same recommendations for different N. Why would it return different rank and scores for different values of N for the bm25 nearest neighbor?

    opened by saranggupta 2
Releases(v0.6.2)
Owner
Ben Frederickson
Ben Frederickson
Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk

Annoy Annoy (Approximate Nearest Neighbors Oh Yeah) is a C++ library with Python bindings to search for points in space that are close to a given quer

Spotify 10.6k Jan 1, 2023
A Python implementation of LightFM, a hybrid recommendation algorithm.

LightFM Build status Linux OSX (OpenMP disabled) Windows (OpenMP disabled) LightFM is a Python implementation of a number of popular recommendation al

Lyst 4.2k Jan 2, 2023
A Python scikit for building and analyzing recommender systems

Overview Surprise is a Python scikit for building and analyzing recommender systems that deal with explicit rating data. Surprise was designed with th

Nicolas Hug 5.7k Jan 1, 2023
A TensorFlow recommendation algorithm and framework in Python.

TensorRec A TensorFlow recommendation algorithm and framework in Python. NOTE: TensorRec is not under active development TensorRec will not be receivi

James Kirk 1.2k Jan 4, 2023
EXEMPLO DE SISTEMA ESPECIALISTA PARA RECOMENDAR SERIADOS EM PYTHON

exemplo-de-sistema-especialista EXEMPLO DE SISTEMA ESPECIALISTA PARA RECOMENDAR SERIADOS EM PYTHON Resumo O objetivo de auxiliar o usuário na escolha

Josue Lopes 3 Aug 31, 2021
QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.

Yu 1.4k Dec 27, 2022
Books Recommendation With Python

Books-Recommendation Business Problem During the last few decades, with the rise

Çağrı Karadeniz 7 Mar 12, 2022
Feedback is important: response-aware feedback mechanism for background based conversation

RFM The code for the paper: "Feedback is important: response-aware feedback mechanism for background based conversation." Requirements python 3.7 pyto

Jiatao Chen 2 Sep 29, 2022
Python Implementation of algorithms in Graph Mining, e.g., Recommendation, Collaborative Filtering, Community Detection, Spectral Clustering, Modularity Maximization, co-authorship networks.

Graph Mining Author: Jiayi Chen Time: April 2021 Implemented Algorithms: Network: Scrabing Data, Network Construbtion and Network Measurement (e.g., P

Jiayi Chen 3 Mar 3, 2022
PyTorch implementations of Top-N recommendation, collaborative filtering recommenders.

PyTorch implementations of Top-N recommendation, collaborative filtering recommenders.

Yoonki Jeong 129 Dec 22, 2022
LT-OCF: Learnable-Time ODE-based Collaborative Filtering, CIKM'21

LT-OCF: Learnable-Time ODE-based Collaborative Filtering Our proposed LT-OCF Our proposed dual co-evolving ODE Setup Python environment for LT-OCF Ins

Jeongwhan Choi 15 Dec 28, 2022
The implement of papar "Enhanced Graph Learning for Collaborative Filtering via Mutual Information Maximization"

SIGIR2021-EGLN The implement of paper "Enhanced Graph Learning for Collaborative Filtering via Mutual Information Maximization" Neural graph based Col

null 15 Dec 27, 2022
This project consists of a collaborative filtering algorithm to predict movie reviews ratings from a dataset of Netflix ratings.

Collaborative Filtering - Netflix movie reviews Description This project consists of a collaborative filtering algorithm to predict movie reviews rati

Shashank Kumar 1 Dec 21, 2021
Book Item Based Collaborative Filtering

Book-Item-Based-Collaborative-Filtering Collaborative filtering methods are used

Şebnem 3 Jan 6, 2022
Filtering user-generated video content(SberZvukTechDays)Filtering user-generated video content(SberZvukTechDays)

Filtering user-generated video content(SberZvukTechDays) Table of contents General info Team members Technologies Setup Result General info This is a

Roman 6 Apr 6, 2022
Crab is a flexible, fast recommender engine for Python that integrates classic information filtering recommendation algorithms in the world of scientific Python packages (numpy, scipy, matplotlib).

Crab - A Recommendation Engine library for Python Crab is a flexible, fast recommender engine for Python that integrates classic information filtering r

python-recsys 1.2k Dec 21, 2022
Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering

Graph ConvNets in PyTorch October 15, 2017 Xavier Bresson http://www.ntu.edu.sg/home/xbresson https://github.com/xbresson https://twitter.com/xbresson

Xavier Bresson 287 Jan 4, 2023
A collection of Korean Text Datasets ready to use using Tensorflow-Datasets.

tfds-korean A collection of Korean Text Datasets ready to use using Tensorflow-Datasets. TensorFlow-Datasets를 이용한 한국어/한글 데이터셋 모음입니다. Dataset Catalog |

Jeong Ukjae 20 Jul 11, 2022