fastFM: A Library for Factorization Machines

Overview

Citing fastFM

The library fastFM is an academic project. The time and resources spent developing fastFM are therefore justified by the number of citations of the software. If you publish scientific articles using fastFM, please cite the following article (bibtex entry citation.bib).

Bayer, I. "fastFM: A Library for Factorization Machines" Journal of Machine Learning Research 17, pp. 1-5 (2016)

fastFM: A Library for Factorization Machines

https://travis-ci.org/ibayer/fastFM.svg?branch=master

This repository allows you to use Factorization Machines in Python (2.7 & 3.x) with the well known scikit-learn API. All performance critical code has been written in C and wrapped with Cython. fastFM provides stochastic gradient descent (SGD) and coordinate descent (CD) optimization routines as well as Markov Chain Monte Carlo (MCMC) for Bayesian inference. The solvers can be used for regression, classification and ranking problems. Detailed usage instructions can be found in the online documentation and on arXiv.

Supported Operating Systems

fastFM has a continuous integration / testing servers (Travis) for Linux (Ubuntu 14.04 LTS) and OS X Mavericks. Other OSs are not actively supported.

Usage

from fastFM import als
fm = als.FMRegression(n_iter=1000, init_stdev=0.1, rank=2, l2_reg_w=0.1, l2_reg_V=0.5)
fm.fit(X_train, y_train)
y_pred = fm.predict(X_test)

Tutorials and other information are available here. The C code is available as subrepository and provides a stand alone command line interface. If you still have questions after reading the documentation please open an issue at GitHub.

Task Solver Loss
Regression als, mcmc, sgd Square Loss
Classification als, mcmc, sgd Probit(Map), Probit, Sigmoid
Ranking sgd BPR

Supported solvers and tasks

Installation

binary install (64bit only)

pip install fastFM

source install

Please make sure, that Python and OS bit version agree, e.g. 32bit Python on 64bit OS won't work.

# Install cblas and python-dev header (Linux only).
# - cblas can be installed with libatlas-base-dev or libopenblas-dev (Ubuntu)
$ sudo apt-get install python-dev libopenblas-dev

# Clone the repo including submodules (or clone + `git submodule update --init --recursive`)
$ git clone --recursive https://github.com/ibayer/fastFM.git

# Enter the root directory
$ cd fastFM

# Install Python dependencies (Cython>=0.22, numpy, pandas, scipy, scikit-learn)
$ pip install -r ./requirements.txt

# Compile the C extension.
$ make                      # build with default python version (python)
$ PYTHON=python3 make       # build with custom python version (python3)

# Install fastFM
$ pip install .

Tests

The Python tests (pip install nose) can be run with: nosetests fastFM/fastFM/tests

Please refer to the fastFM-core README for instruction on how to run the C tests at fastFM/fastFM-core/src/tests.

Contribution

  • Star this repository: keeps contributors motivated
  • Open an issue: report bugs or suggest improvements
  • Fix errors in the documentation: small changes matter
  • Contribute code

Contributions are very welcome! Since this project lives on GitHub we recommend to open a pull request (PR) for code contributions as early as possible. This is the fastest way to get feedback and allows Travis CI to run checks on your changes.

Most information you need to setup your development environment can be learned by adapting the great instructions on https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md . Please ensure that your contribution conforms to the PEP8 Coding Style and includes unit tests where appropriate. More valuable guidelines that apply to fastFM can be found at http://scikit-learn.org/stable/developers/contributing.html#coding-guidelines .

Contributors

License: BSD

Comments
  • Easy installation on mac

    Easy installation on mac

    Hello,

    I was wondering if there was an easy way to install FastFM on mac, because I have followed all the instructions of the updated readme but only the last command fails :

    In my terminal, when I exectue in the FastFM folder 'sudo pip install -e .' , I get :

    fastFM/ffm.c:7789:32: warning: unused function '__pyx_f_5numpy_get_array_base' [-Wunused-function] static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { ^ 21 warnings generated. gcc -bundle -undefined dynamic_lookup -L/Users/edmondjacoupeau/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/fastFM/ffm.o -LfastFM/ -LfastFM-core/bin/ -LfastFM-core/externals/CXSparse/Lib/ -L/usr/lib/ -L/usr/lib/atlas-base/ -L/Users/edmondjacoupeau/anaconda/lib -lm -lfastfm -lcxsparse -lgsl -lgslcblas -lglib-2.0 -o /Users/edmondjacoupeau/fastFM/ffm.so ld: warning: directory not found for option '-LfastFM-core/bin/' ld: warning: directory not found for option '-L/usr/lib/atlas-base/' ld: library not found for -lfastfm clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'gcc' failed with exit status 1


    Command "/Users/edmondjacoupeau/anaconda/bin/python -c "import setuptools, tokenize; file='/Users/edmondjacoupeau/fastFM/setup.py'; exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" develop --no-deps" failed with error code 1 in /Users/edmondjacoupeau/fastFM

    Do I have forgotten something ?

    opened by edmondja 23
  • Error Installing on CentOS and RHEL platforms

    Error Installing on CentOS and RHEL platforms

    I followed all the install directions. Running make for the C parts seemed to finish without error but running python setup.py install creates the following error. I am on 64 bit Linux (mint). Any ideas?

    python setup.py install running install running build running build_py running build_ext skipping 'fastFM/ffm.c' Cython extension (up-to-date) building 'ffm' extension gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -IfastFM/ -IfastFM-core/include/ -IfastFM-core/externals/CXSparse/Include/ -I/usr/include/ -I/home/anaconda/lib/python2.7/site-packages/numpy/core/include -I/home/anaconda/include/python2.7 -c fastFM/ffm.c -o build/temp.linux-x86_64-2.7/fastFM/ffm.o In file included from /home/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1781:0, from /home/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18, from /home/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, from fastFM/ffm.c:252: /home/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] #warning "Using deprecated NumPy API, disable it by "
    ^ In file included from /home/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:27:0, from /home/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, from fastFM/ffm.c:252: /home/anaconda/lib/python2.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1634:1: warning: ‘_import_array’ defined but not used [-Wunused-function] _import_array(void) ^ gcc -pthread -shared -L/home/anaconda/lib -Wl,-rpath=/home/anaconda/lib,--no-as-needed build/temp.linux-x86_64-2.7/fastFM/ffm.o -LfastFM/ -LfastFM-core/bin/ -LfastFM-core/externals/CXSparse/Lib/ -L/usr/lib/ -L/usr/lib/atlas-base/ -L/home/anaconda/lib -lm -lfastfm -lcxsparse -lcblas -lpython2.7 -o build/lib.linux-x86_64-2.7/ffm.so /usr/bin/ld: cannot find -lfastfm collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1

    opened by BrianMiner 21
  • Understanding MCMC and n_more_iter

    Understanding MCMC and n_more_iter

    MCMC seems to be sensitive to the number of iterations between fit_predict calls. Setting n_more_iter=1 has an optimal RMSE of 0.884 at step 27. With n_more_iter=10, RMSE is at 0.860 and still improving at 10 iterations (equivalent to 100 with a step of 1). The documentation mentions "We can warm_start every fastFM model which allows us to calculate custom statistics during the model fitting process efficiently", which seems to suggest this sensitivity shouldn't be present.

    Code excerpts and results below:

    fm = mcmc.FMRegression(n_iter=0, rank=10)
    fm.fit_predict(X_train, y_train, X_test)
    for i in range(100):
        y_pred = fm.fit_predict(X_train, y_train, X_test, n_more_iter=1)
        y_pred[y_pred > 5] = 5
        y_pred[y_pred < 1] = 1
        print(i, np.sqrt(mean_squared_error(y_pred, y_test)))
    
    0 1.04720819915
    1 0.97778708587
    2 0.948017085861
    3 0.93420488937
    4 0.927061672571
    5 0.922935100294
    6 0.920257539721
    7 0.918207455438
    8 0.916209819939
    9 0.913894249208
    10 0.911193471613
    11 0.908216022258
    12 0.905165877765
    13 0.902210412052
    14 0.899446393313
    15 0.896925703595
    16 0.894664102177
    17 0.892659400427
    18 0.890901483694
    19 0.889378630713
    20 0.888077107425
    21 0.886984550257
    22 0.886090970488
    23 0.88538765354
    24 0.884863438543
    25 0.884506506975
    26 0.884306239634
    27 0.884247226983
    28 0.884317448473
    29 0.884505712397
    30 0.884800603791
    31 0.885189631326
    32 0.885661840403
    33 0.886204648292
    34 0.886803484806
    35 0.8874511923
    36 0.888143165709
    37 0.888869261405
    38 0.889633023158
    39 0.890425723873
    40 0.891229955936
    41 0.892040331705
    42 0.892863900969
    43 0.893707463792
    44 0.894571302645
    45 0.895459171301
    46 0.896382680339
    47 0.897345726293
    48 0.8983542138
    49 0.899390885256
    50 0.900449139443
    51 0.90153494656
    52 0.902640912205
    53 0.903777024948
    54 0.904930834814
    55 0.906096794935
    56 0.907275765877
    57 0.9084718919
    58 0.909667324754
    59 0.910873466425
    60 0.912084967428
    61 0.913287204773
    62 0.914474364239
    63 0.915653122817
    64 0.916826161945
    65 0.917994888944
    66 0.919162248375
    67 0.920329277189
    68 0.92149676688
    69 0.922659246729
    70 0.923810308867
    71 0.924949669371
    72 0.926074311282
    73 0.927179794147
    74 0.928264040074
    75 0.929326802974
    76 0.930376434434
    77 0.9314191654
    78 0.932455845704
    79 0.933482129994
    80 0.93449735718
    81 0.935486636427
    82 0.936467682892
    83 0.937443712518
    84 0.938410321158
    85 0.939356840954
    86 0.94027321806
    87 0.941148746045
    88 0.942005000857
    89 0.9428498981
    90 0.943684777878
    91 0.944508612458
    92 0.945317518167
    93 0.946115254746
    94 0.946898829726
    95 0.947669244301
    96 0.948434140619
    97 0.949193065287
    98 0.949947628213
    99 0.950688137695
    
    fm = mcmc.FMRegression(n_iter=0, rank=10)
    fm.fit_predict(X_train, y_train, X_test)
    for i in range(10):
        y_pred = fm.fit_predict(X_train, y_train, X_test, n_more_iter=10)
        y_pred[y_pred > 5] = 5
        y_pred[y_pred < 1] = 1
        print(i, np.sqrt(mean_squared_error(y_pred, y_test)))
    
    0 0.911849673248
    1 0.902846141012
    2 0.89065879739
    3 0.880330818455
    4 0.874373355886
    5 0.870324418211
    6 0.866544031989
    7 0.863735153323
    8 0.861829622252
    9 0.860483981533
    
    opened by merrellb 15
  • nosetest failed

    nosetest failed

    ubgpu@ubgpu:~/github$ sudo pip install -e fastFM/ Obtaining file:///home/ubgpu/github/fastFM Installing collected packages: fastFM Running setup.py develop for fastFM Successfully installed fastFM ubgpu@ubgpu:~/github$

    ubgpu@ubgpu:~/github/fastFM/fastFM/tests$ sudo pip install nose Requirement already satisfied (use --upgrade to upgrade): nose in /usr/lib/python3/dist-packages ubgpu@ubgpu:~/github/fastFM/fastFM/tests$ ubgpu@ubgpu:~/github/fastFM/fastFM/tests$ ubgpu@ubgpu:~/github/fastFM/fastFM/tests$ sudo pip2 install nose You are using pip version 7.0.3, however version 7.1.0 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Requirement already satisfied (use --upgrade to upgrade): nose in /usr/lib/python2.7/dist-packages ubgpu@ubgpu:~/github/fastFM/fastFM/tests$ ubgpu@ubgpu:~/github/fastFM/fastFM/tests$ ubgpu@ubgpu:~/github/fastFM/fastFM/tests$ ubgpu@ubgpu:~/github/fastFM/fastFM/tests$ nosetests

    EEEEEEEEE

    ERROR: Failure: ImportError (No module named fastFM)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_als.py", line 7, in from fastFM import als ImportError: No module named fastFM

    ERROR: Failure: ImportError (No module named fastFM)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_base.py", line 7, in from fastFM import als ImportError: No module named fastFM

    ERROR: Failure: ImportError (No module named fastFM.datasets)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_datasets.py", line 4, in from fastFM.datasets import make_user_item_regression ImportError: No module named fastFM.datasets

    ERROR: Failure: ImportError (No module named ffm)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_ffm.py", line 8, in import ffm ImportError: No module named ffm

    ERROR: Failure: ImportError (No module named fastFM)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_mcmc.py", line 7, in from fastFM import mcmc ImportError: No module named fastFM

    ERROR: Failure: ImportError (No module named fastFM)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_ranking.py", line 6, in from fastFM import bpr ImportError: No module named fastFM

    ERROR: Failure: ImportError (No module named fastFM)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_sgd.py", line 7, in from fastFM import sgd ImportError: No module named fastFM

    ERROR: Failure: ImportError (No module named fastFM.bpr)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_transform.py", line 10, in from fastFM.bpr import FMRecommender ImportError: No module named fastFM.bpr

    ERROR: Failure: ImportError (No module named fastFM.utils)

    Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName addr.filename, addr.module) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/home/ubgpu/github/fastFM/fastFM/tests/test_utils.py", line 5, in from fastFM.utils import kendall_tau ImportError: No module named fastFM.utils


    Ran 9 tests in 0.305s

    FAILED (errors=9) ubgpu@ubgpu:~/github/fastFM/fastFM/tests$

    invalid 
    opened by andyyuan78 15
  • ubuntu 16.04: installation by pip - problem with cython

    ubuntu 16.04: installation by pip - problem with cython

    I've tried to install fastFM by pip, but I've got error from Cython:

     sudo -H pip install fastFM
    Collecting fastFM
      Using cached fastFM-0.2.6.tar.gz
    Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from fastFM)
    Requirement already satisfied: scikit-learn in /usr/local/lib/python2.7/dist-packages (from fastFM)
    Requirement already satisfied: scipy in /usr/local/lib/python2.7/dist-packages (from fastFM)
    Building wheels for collected packages: fastFM
      Running setup.py bdist_wheel for fastFM ... error
      Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bekvHl/fastFM/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 /tmp/tmpzTr2wHpip-wheel- --python-tag cp27:
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-2.7
      creating build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/datasets.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/utils.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/sgd.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/bpr.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/__init__.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/als.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/base.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/mcmc.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/validation.py -> build/lib.linux-x86_64-2.7/fastFM
      copying fastFM/transform_.py -> build/lib.linux-x86_64-2.7/fastFM
      running build_ext
      cythoning fastFM/ffm.pyx to fastFM/ffm.c
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      # Author: Immanuel Bayer
      # License: BSD 3 clause
      
      cimport cffm
             ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:4:8: 'cffm.pxd' not found
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      # Author: Immanuel Bayer
      # License: BSD 3 clause
      
      cimport cffm
      from cffm cimport cs_di, ffm_param
      ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:5:0: 'cffm/cs_di.pxd' not found
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      # Author: Immanuel Bayer
      # License: BSD 3 clause
      
      cimport cffm
      from cffm cimport cs_di, ffm_param
      ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:5:0: 'cffm/ffm_param.pxd' not found
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          free(<void *> pt)
      
      
      # Create a CsMatrix object and return as a capsule
      def CsMatrix(X not None):
          cdef cffm.cs_di *p
              ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:23:9: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      # Create a FFMParam object and return as a capsule
      def FFMParam(fm):
          map_flags = {'classification': 10,
                       'regression': 20,
                       'ranking': 30}
          cdef cffm.ffm_param *p
              ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:57:9: 'ffm_param' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      import numpy as np
      
      
      # Destructor for cleaning up CsMatrix objects
      cdef del_CsMatrix(object obj):
          pt = <cffm.cs_di *> PyCapsule_GetPointer(obj, "CsMatrix")
               ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:17:10: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
      
      # Create a CsMatrix object and return as a capsule
      def CsMatrix(X not None):
          cdef cffm.cs_di *p
          p = <cffm.cs_di *> malloc(sizeof(cffm.cs_di))
              ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:24:9: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          # Put the scipy data into the CSparse struct. This is just copying some
          # pointers.
          p.nzmax = X.data.shape[0]
          p.m = X.shape[0]
          p.n = X.shape[1]
          p.p = &indptr[0]
               ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:38:10: Cannot convert 'int *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          # pointers.
          p.nzmax = X.data.shape[0]
          p.m = X.shape[0]
          p.n = X.shape[1]
          p.p = &indptr[0]
          p.i = &indices[0]
               ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:39:10: Cannot convert 'int *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          p.nzmax = X.data.shape[0]
          p.m = X.shape[0]
          p.n = X.shape[1]
          p.p = &indptr[0]
          p.i = &indices[0]
          p.x = &data[0]
               ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:40:10: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                               <PyCapsule_Destructor>del_CsMatrix)
      
      
      # Destructor for cleaning up FFMParam objects
      cdef del_FFMParam(object obj):
          pt = <cffm.ffm_param *> PyCapsule_GetPointer(obj, "FFMParam")
               ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:48:10: 'ffm_param' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      def FFMParam(fm):
          map_flags = {'classification': 10,
                       'regression': 20,
                       'ranking': 30}
          cdef cffm.ffm_param *p
          p = <cffm.ffm_param *> malloc(sizeof(cffm.ffm_param))
              ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:58:9: 'ffm_param' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      np.ndarray[np.float64_t, ndim = 2] V, X):
          assert X.shape[1] == len(w)
          assert X.shape[1] == V.shape[1]
          X_ = CsMatrix(X)
          k = V.shape[0]
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
                 ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:84:12: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          X_ = CsMatrix(X)
          k = V.shape[0]
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] y =\
               np.zeros(X.shape[0], dtype=np.float64)
          cffm.ffm_predict(&w_0, &w[0], <double *> V.data, pt_X, &y[0], k)
                          ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:87:21: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          X_ = CsMatrix(X)
          k = V.shape[0]
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] y =\
               np.zeros(X.shape[0], dtype=np.float64)
          cffm.ffm_predict(&w_0, &w[0], <double *> V.data, pt_X, &y[0], k)
                                ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:87:27: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          X_ = CsMatrix(X)
          k = V.shape[0]
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] y =\
               np.zeros(X.shape[0], dtype=np.float64)
          cffm.ffm_predict(&w_0, &w[0], <double *> V.data, pt_X, &y[0], k)
                                       ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:87:34: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          X_ = CsMatrix(X)
          k = V.shape[0]
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] y =\
               np.zeros(X.shape[0], dtype=np.float64)
          cffm.ffm_predict(&w_0, &w[0], <double *> V.data, pt_X, &y[0], k)
                                                                ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:87:59: Cannot convert 'float64_t *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          assert X.shape[0] == len(y) # test shapes
          n_features = X.shape[1]
          X_ = CsMatrix(X)
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
          param = FFMParam(fm)
          pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
                     ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:97:16: 'ffm_param' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
      def ffm_als_fit(fm, X, double[:] y):
          assert X.shape[0] == len(y) # test shapes
          n_features = X.shape[1]
          X_ = CsMatrix(X)
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
                 ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:95:12: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          else:
              w_0 = 0
              w = np.zeros(n_features, dtype=np.float64)
              V = np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_als_fit(&w_0, <double *> w.data, <double *> V.data,
                          ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:112:21: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          else:
              w_0 = 0
              w = np.zeros(n_features, dtype=np.float64)
              V = np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_als_fit(&w_0, <double *> w.data, <double *> V.data,
                                ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:112:27: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          else:
              w_0 = 0
              w = np.zeros(n_features, dtype=np.float64)
              V = np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_als_fit(&w_0, <double *> w.data, <double *> V.data,
                                                   ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:112:46: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              w_0 = 0
              w = np.zeros(n_features, dtype=np.float64)
              V = np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_als_fit(&w_0, <double *> w.data, <double *> V.data,
                           pt_X, &y[0], pt_param)
                                ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:113:27: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          assert X.shape[1] == len(y) # test shapes
          n_features = X.shape[0]
          X_ = CsMatrix(X)
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
          param = FFMParam(fm)
          pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
                     ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:128:16: 'ffm_param' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          sample access.
          """
          assert X.shape[1] == len(y) # test shapes
          n_features = X.shape[0]
          X_ = CsMatrix(X)
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
                 ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:126:12: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
               np.zeros(n_features, dtype=np.float64)
          cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
               np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_sgd_fit(&w_0, <double *> w.data, <double *> V.data,
                          ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:137:21: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
               np.zeros(n_features, dtype=np.float64)
          cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
               np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_sgd_fit(&w_0, <double *> w.data, <double *> V.data,
                                ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:137:27: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
               np.zeros(n_features, dtype=np.float64)
          cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
               np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_sgd_fit(&w_0, <double *> w.data, <double *> V.data,
                                                   ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:137:46: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
               np.zeros(n_features, dtype=np.float64)
          cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
               np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_sgd_fit(&w_0, <double *> w.data, <double *> V.data,
                           pt_X, &y[0], pt_param)
                                ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:138:27: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      def ffm_fit_sgd_bpr(fm, X, np.ndarray[np.float64_t, ndim=2, mode='c'] pairs):
          n_features = X.shape[0]
          X_ = CsMatrix(X)
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
          param = FFMParam(fm)
          pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
                     ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:147:16: 'ffm_param' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      
      
      def ffm_fit_sgd_bpr(fm, X, np.ndarray[np.float64_t, ndim=2, mode='c'] pairs):
          n_features = X.shape[0]
          X_ = CsMatrix(X)
          pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
                 ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:145:12: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
               np.zeros(n_features, dtype=np.float64)
          cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
               np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_sgd_bpr_fit(&w_0, <double *> w.data, <double *> V.data,
                              ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:156:25: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
               np.zeros(n_features, dtype=np.float64)
          cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
               np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_sgd_bpr_fit(&w_0, <double *> w.data, <double *> V.data,
                                    ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:156:31: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
               np.zeros(n_features, dtype=np.float64)
          cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
               np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_sgd_bpr_fit(&w_0, <double *> w.data, <double *> V.data,
                                                       ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:156:50: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
               np.zeros(n_features, dtype=np.float64)
          cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
               np.zeros((fm.rank, n_features), dtype=np.float64)
      
          cffm.ffm_sgd_bpr_fit(&w_0, <double *> w.data, <double *> V.data,
                               pt_X, <double *> pairs.data, pairs.shape[0], pt_param)
                                    ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:157:31: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          assert X_train.shape[1] == X_test.shape[1]
          n_features = X_train.shape[1]
          param = FFMParam(fm)
          pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
          X_train_ = CsMatrix(X_train)
          pt_X_train = <cffm.cs_di *> PyCapsule_GetPointer(X_train_, "CsMatrix")
                       ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:168:18: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          param = FFMParam(fm)
          pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
          X_train_ = CsMatrix(X_train)
          pt_X_train = <cffm.cs_di *> PyCapsule_GetPointer(X_train_, "CsMatrix")
          X_test_ = CsMatrix(X_test)
          pt_X_test = <cffm.cs_di *> PyCapsule_GetPointer(X_test_, "CsMatrix")
                      ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:170:17: 'cs_di' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      def ffm_mcmc_fit_predict(fm, X_train, X_test, double[:] y):
          assert X_train.shape[0] == len(y)
          assert X_train.shape[1] == X_test.shape[1]
          n_features = X_train.shape[1]
          param = FFMParam(fm)
          pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
                     ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:166:16: 'ffm_param' is not a type identifier
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          if fm.warm_start:
              hyper_param = fm.hyper_param_
          else:
              hyper_param = np.zeros(n_hyper_param, dtype=np.float64)
          pt_param.n_hyper_param = n_hyper_param
          pt_param.hyper_param = <double *> hyper_param.data
                                ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:204:27: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          else:
              hyper_param = np.zeros(n_hyper_param, dtype=np.float64)
          pt_param.n_hyper_param = n_hyper_param
          pt_param.hyper_param = <double *> hyper_param.data
      
          cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                   ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:206:30: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          else:
              hyper_param = np.zeros(n_hyper_param, dtype=np.float64)
          pt_param.n_hyper_param = n_hyper_param
          pt_param.hyper_param = <double *> hyper_param.data
      
          cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                         ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:206:36: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          else:
              hyper_param = np.zeros(n_hyper_param, dtype=np.float64)
          pt_param.n_hyper_param = n_hyper_param
          pt_param.hyper_param = <double *> hyper_param.data
      
          cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                                            ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:206:55: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          pt_param.n_hyper_param = n_hyper_param
          pt_param.hyper_param = <double *> hyper_param.data
      
          cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                    pt_X_train, pt_X_test,
                                    &y[0], <double *> y_pred.data,
                                   ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:208:30: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          pt_param.n_hyper_param = n_hyper_param
          pt_param.hyper_param = <double *> hyper_param.data
      
          cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                    pt_X_train, pt_X_test,
                                    &y[0], <double *> y_pred.data,
                                          ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:208:37: Cannot convert 'double *' to Python object
      
      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          return (w_0, w, V), y_pred
      
      
      def cs_norm(X):
          X = CsMatrix(X)
          pt = <cffm.cs_di *> PyCapsule_GetPointer(X, "CsMatrix")
               ^
      ------------------------------------------------------------
      
      fastFM/ffm.pyx:216:10: 'cs_di' is not a type identifier
      building 'ffm' extension
      creating build/temp.linux-x86_64-2.7
      creating build/temp.linux-x86_64-2.7/fastFM
      x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -IfastFM/ -IfastFM-core/include/ -IfastFM-core/externals/CXSparse/Include/ -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c fastFM/ffm.c -o build/temp.linux-x86_64-2.7/fastFM/ffm.o
      fastFM/ffm.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
       #error Do not use this file, it is the result of a failed Cython compilation.
        ^
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
      
      ----------------------------------------
      Failed building wheel for fastFM
      Running setup.py clean for fastFM
    Failed to build fastFM
    Installing collected packages: fastFM
      Running setup.py install for fastFM ... error
        Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bekvHl/fastFM/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-_kRa9a-record/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build/lib.linux-x86_64-2.7
        creating build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/datasets.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/utils.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/sgd.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/bpr.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/__init__.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/als.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/base.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/mcmc.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/validation.py -> build/lib.linux-x86_64-2.7/fastFM
        copying fastFM/transform_.py -> build/lib.linux-x86_64-2.7/fastFM
        running build_ext
        cythoning fastFM/ffm.pyx to fastFM/ffm.c
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        # Author: Immanuel Bayer
        # License: BSD 3 clause
        
        cimport cffm
               ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:4:8: 'cffm.pxd' not found
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        # Author: Immanuel Bayer
        # License: BSD 3 clause
        
        cimport cffm
        from cffm cimport cs_di, ffm_param
        ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:5:0: 'cffm/cs_di.pxd' not found
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        # Author: Immanuel Bayer
        # License: BSD 3 clause
        
        cimport cffm
        from cffm cimport cs_di, ffm_param
        ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:5:0: 'cffm/ffm_param.pxd' not found
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            free(<void *> pt)
        
        
        # Create a CsMatrix object and return as a capsule
        def CsMatrix(X not None):
            cdef cffm.cs_di *p
                ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:23:9: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        # Create a FFMParam object and return as a capsule
        def FFMParam(fm):
            map_flags = {'classification': 10,
                         'regression': 20,
                         'ranking': 30}
            cdef cffm.ffm_param *p
                ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:57:9: 'ffm_param' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        import numpy as np
        
        
        # Destructor for cleaning up CsMatrix objects
        cdef del_CsMatrix(object obj):
            pt = <cffm.cs_di *> PyCapsule_GetPointer(obj, "CsMatrix")
                 ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:17:10: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        
        
        # Create a CsMatrix object and return as a capsule
        def CsMatrix(X not None):
            cdef cffm.cs_di *p
            p = <cffm.cs_di *> malloc(sizeof(cffm.cs_di))
                ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:24:9: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            # Put the scipy data into the CSparse struct. This is just copying some
            # pointers.
            p.nzmax = X.data.shape[0]
            p.m = X.shape[0]
            p.n = X.shape[1]
            p.p = &indptr[0]
                 ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:38:10: Cannot convert 'int *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            # pointers.
            p.nzmax = X.data.shape[0]
            p.m = X.shape[0]
            p.n = X.shape[1]
            p.p = &indptr[0]
            p.i = &indices[0]
                 ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:39:10: Cannot convert 'int *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            p.nzmax = X.data.shape[0]
            p.m = X.shape[0]
            p.n = X.shape[1]
            p.p = &indptr[0]
            p.i = &indices[0]
            p.x = &data[0]
                 ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:40:10: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
                                 <PyCapsule_Destructor>del_CsMatrix)
        
        
        # Destructor for cleaning up FFMParam objects
        cdef del_FFMParam(object obj):
            pt = <cffm.ffm_param *> PyCapsule_GetPointer(obj, "FFMParam")
                 ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:48:10: 'ffm_param' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        def FFMParam(fm):
            map_flags = {'classification': 10,
                         'regression': 20,
                         'ranking': 30}
            cdef cffm.ffm_param *p
            p = <cffm.ffm_param *> malloc(sizeof(cffm.ffm_param))
                ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:58:9: 'ffm_param' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
                        np.ndarray[np.float64_t, ndim = 2] V, X):
            assert X.shape[1] == len(w)
            assert X.shape[1] == V.shape[1]
            X_ = CsMatrix(X)
            k = V.shape[0]
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
                   ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:84:12: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            X_ = CsMatrix(X)
            k = V.shape[0]
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] y =\
                 np.zeros(X.shape[0], dtype=np.float64)
            cffm.ffm_predict(&w_0, &w[0], <double *> V.data, pt_X, &y[0], k)
                            ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:87:21: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            X_ = CsMatrix(X)
            k = V.shape[0]
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] y =\
                 np.zeros(X.shape[0], dtype=np.float64)
            cffm.ffm_predict(&w_0, &w[0], <double *> V.data, pt_X, &y[0], k)
                                  ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:87:27: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            X_ = CsMatrix(X)
            k = V.shape[0]
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] y =\
                 np.zeros(X.shape[0], dtype=np.float64)
            cffm.ffm_predict(&w_0, &w[0], <double *> V.data, pt_X, &y[0], k)
                                         ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:87:34: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            X_ = CsMatrix(X)
            k = V.shape[0]
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] y =\
                 np.zeros(X.shape[0], dtype=np.float64)
            cffm.ffm_predict(&w_0, &w[0], <double *> V.data, pt_X, &y[0], k)
                                                                  ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:87:59: Cannot convert 'float64_t *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            assert X.shape[0] == len(y) # test shapes
            n_features = X.shape[1]
            X_ = CsMatrix(X)
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
            param = FFMParam(fm)
            pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
                       ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:97:16: 'ffm_param' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        
        def ffm_als_fit(fm, X, double[:] y):
            assert X.shape[0] == len(y) # test shapes
            n_features = X.shape[1]
            X_ = CsMatrix(X)
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
                   ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:95:12: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            else:
                w_0 = 0
                w = np.zeros(n_features, dtype=np.float64)
                V = np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_als_fit(&w_0, <double *> w.data, <double *> V.data,
                            ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:112:21: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            else:
                w_0 = 0
                w = np.zeros(n_features, dtype=np.float64)
                V = np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_als_fit(&w_0, <double *> w.data, <double *> V.data,
                                  ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:112:27: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            else:
                w_0 = 0
                w = np.zeros(n_features, dtype=np.float64)
                V = np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_als_fit(&w_0, <double *> w.data, <double *> V.data,
                                                     ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:112:46: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
                w_0 = 0
                w = np.zeros(n_features, dtype=np.float64)
                V = np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_als_fit(&w_0, <double *> w.data, <double *> V.data,
                             pt_X, &y[0], pt_param)
                                  ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:113:27: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            sample access.
            """
            assert X.shape[1] == len(y) # test shapes
            n_features = X.shape[0]
            X_ = CsMatrix(X)
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
                   ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:126:12: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            assert X.shape[1] == len(y) # test shapes
            n_features = X.shape[0]
            X_ = CsMatrix(X)
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
            param = FFMParam(fm)
            pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
                       ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:128:16: 'ffm_param' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
                 np.zeros(n_features, dtype=np.float64)
            cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
                 np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_sgd_fit(&w_0, <double *> w.data, <double *> V.data,
                            ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:137:21: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
                 np.zeros(n_features, dtype=np.float64)
            cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
                 np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_sgd_fit(&w_0, <double *> w.data, <double *> V.data,
                                  ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:137:27: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
                 np.zeros(n_features, dtype=np.float64)
            cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
                 np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_sgd_fit(&w_0, <double *> w.data, <double *> V.data,
                                                     ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:137:46: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
                 np.zeros(n_features, dtype=np.float64)
            cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
                 np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_sgd_fit(&w_0, <double *> w.data, <double *> V.data,
                             pt_X, &y[0], pt_param)
                                  ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:138:27: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        def ffm_fit_sgd_bpr(fm, X, np.ndarray[np.float64_t, ndim=2, mode='c'] pairs):
            n_features = X.shape[0]
            X_ = CsMatrix(X)
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
            param = FFMParam(fm)
            pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
                       ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:147:16: 'ffm_param' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        
        
        def ffm_fit_sgd_bpr(fm, X, np.ndarray[np.float64_t, ndim=2, mode='c'] pairs):
            n_features = X.shape[0]
            X_ = CsMatrix(X)
            pt_X = <cffm.cs_di *> PyCapsule_GetPointer(X_, "CsMatrix")
                   ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:145:12: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
                 np.zeros(n_features, dtype=np.float64)
            cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
                 np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_sgd_bpr_fit(&w_0, <double *> w.data, <double *> V.data,
                                ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:156:25: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
                 np.zeros(n_features, dtype=np.float64)
            cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
                 np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_sgd_bpr_fit(&w_0, <double *> w.data, <double *> V.data,
                                      ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:156:31: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            cdef np.ndarray[np.float64_t, ndim=1, mode='c'] w =\
                 np.zeros(n_features, dtype=np.float64)
            cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
                 np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_sgd_bpr_fit(&w_0, <double *> w.data, <double *> V.data,
                                                         ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:156:50: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
                 np.zeros(n_features, dtype=np.float64)
            cdef np.ndarray[np.float64_t, ndim=2, mode='c'] V =\
                 np.zeros((fm.rank, n_features), dtype=np.float64)
        
            cffm.ffm_sgd_bpr_fit(&w_0, <double *> w.data, <double *> V.data,
                                 pt_X, <double *> pairs.data, pairs.shape[0], pt_param)
                                      ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:157:31: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            assert X_train.shape[1] == X_test.shape[1]
            n_features = X_train.shape[1]
            param = FFMParam(fm)
            pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
            X_train_ = CsMatrix(X_train)
            pt_X_train = <cffm.cs_di *> PyCapsule_GetPointer(X_train_, "CsMatrix")
                         ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:168:18: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            param = FFMParam(fm)
            pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
            X_train_ = CsMatrix(X_train)
            pt_X_train = <cffm.cs_di *> PyCapsule_GetPointer(X_train_, "CsMatrix")
            X_test_ = CsMatrix(X_test)
            pt_X_test = <cffm.cs_di *> PyCapsule_GetPointer(X_test_, "CsMatrix")
                        ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:170:17: 'cs_di' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
        def ffm_mcmc_fit_predict(fm, X_train, X_test, double[:] y):
            assert X_train.shape[0] == len(y)
            assert X_train.shape[1] == X_test.shape[1]
            n_features = X_train.shape[1]
            param = FFMParam(fm)
            pt_param = <cffm.ffm_param *> PyCapsule_GetPointer(param, "FFMParam")
                       ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:166:16: 'ffm_param' is not a type identifier
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            if fm.warm_start:
                hyper_param = fm.hyper_param_
            else:
                hyper_param = np.zeros(n_hyper_param, dtype=np.float64)
            pt_param.n_hyper_param = n_hyper_param
            pt_param.hyper_param = <double *> hyper_param.data
                                  ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:204:27: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            else:
                hyper_param = np.zeros(n_hyper_param, dtype=np.float64)
            pt_param.n_hyper_param = n_hyper_param
            pt_param.hyper_param = <double *> hyper_param.data
        
            cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                     ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:206:30: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            else:
                hyper_param = np.zeros(n_hyper_param, dtype=np.float64)
            pt_param.n_hyper_param = n_hyper_param
            pt_param.hyper_param = <double *> hyper_param.data
        
            cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                           ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:206:36: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            else:
                hyper_param = np.zeros(n_hyper_param, dtype=np.float64)
            pt_param.n_hyper_param = n_hyper_param
            pt_param.hyper_param = <double *> hyper_param.data
        
            cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                                              ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:206:55: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            pt_param.n_hyper_param = n_hyper_param
            pt_param.hyper_param = <double *> hyper_param.data
        
            cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                      pt_X_train, pt_X_test,
                                      &y[0], <double *> y_pred.data,
                                     ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:208:30: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            pt_param.n_hyper_param = n_hyper_param
            pt_param.hyper_param = <double *> hyper_param.data
        
            cffm.ffm_mcmc_fit_predict(&w_0, <double *> w.data, <double *> V.data,
                                      pt_X_train, pt_X_test,
                                      &y[0], <double *> y_pred.data,
                                            ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:208:37: Cannot convert 'double *' to Python object
        
        Error compiling Cython file:
        ------------------------------------------------------------
        ...
            return (w_0, w, V), y_pred
        
        
        def cs_norm(X):
            X = CsMatrix(X)
            pt = <cffm.cs_di *> PyCapsule_GetPointer(X, "CsMatrix")
                 ^
        ------------------------------------------------------------
        
        fastFM/ffm.pyx:216:10: 'cs_di' is not a type identifier
        building 'ffm' extension
        creating build/temp.linux-x86_64-2.7
        creating build/temp.linux-x86_64-2.7/fastFM
        x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -IfastFM/ -IfastFM-core/include/ -IfastFM-core/externals/CXSparse/Include/ -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c fastFM/ffm.c -o build/temp.linux-x86_64-2.7/fastFM/ffm.o
        fastFM/ffm.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
         #error Do not use this file, it is the result of a failed Cython compilation.
          ^
        error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
        
        ----------------------------------------
    Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-bekvHl/fastFM/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-_kRa9a-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-bekvHl/fastFM/
    
    
    bug help wanted 
    opened by mglowacki100 12
  • Pip install: Problems on OSX (Symbol not found: _cs_di_norm)

    Pip install: Problems on OSX (Symbol not found: _cs_di_norm)

    Installed from PyPI ("pip install fastfm") and I get the following error:

    Python 3.5.1 (default, Dec  9 2015, 00:25:02) 
    [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ffm
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: dlopen(/Users/merrellb/.virtualenv/python3/lib/python3.5/site-packages/ffm.cpython-35m-darwin.so, 2): Symbol not found: _cs_di_norm
      Referenced from: /Users/merrellb/.virtualenv/python3/lib/python3.5/site-packages/ffm.cpython-35m-darwin.so
      Expected in: flat namespace
     in /Users/merrellb/.virtualenv/python3/lib/python3.5/site-packages/ffm.cpython-35m-darwin.so
    >>> 
    
    opened by merrellb 12
  • Cython wrapper build fix

    Cython wrapper build fix

    Hello. Seems user keys works only for private root repos, so I managed to make it work with user credentials encrypted via travis. Is it possible to make the dedicated user for that purpose?

    And the second question, why shouldn't we use Hunter? Maybe we can add eigen via ExternalProject_Add in cmake or smth similar specially for travis build, but does it worth it? Or you just want to cut out Hunter away?

    opened by AlexJoz 10
  • [Request] submit wheel for (many)Linux to PyPI

    [Request] submit wheel for (many)Linux to PyPI

    Please submit wheel for not only macos, but also linux to PyPI

    because installing fastFM on Docker fails, (installing on Ubuntu and Debian works fine)

    root@6ab076dfe97f:/# pip install fastFM
    Collecting fastFM
      Downloading fastFM-0.2.10.tar.gz (1.6MB)
        100% |████████████████████████████████| 1.6MB 784kB/s
    Requirement already satisfied: numpy in /usr/local/lib/python3.6/site-packages (from fastFM)
    Collecting scikit-learn (from fastFM)
      Downloading scikit_learn-0.19.1-cp36-cp36m-manylinux1_x86_64.whl (12.4MB)
        100% |████████████████████████████████| 12.4MB 125kB/s
    Requirement already satisfied: scipy in /usr/local/lib/python3.6/site-packages (from fastFM)
    Requirement already satisfied: cython in /usr/local/lib/python3.6/site-packages (from fastFM)
    Building wheels for collected packages: fastFM
      Running setup.py bdist_wheel for fastFM ... error
      Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ahqg4ru8/fastFM/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 /tmp/tmpwpss_4uhpip-wheel- --python-tag cp36:
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.6
      creating build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/sgd.py -> build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/datasets.py -> build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/als.py -> build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/validation.py -> build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/utils.py -> build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/base.py -> build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/__init__.py -> build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/bpr.py -> build/lib.linux-x86_64-3.6/fastFM
      copying fastFM/mcmc.py -> build/lib.linux-x86_64-3.6/fastFM
      running build_ext
      skipping 'fastFM/ffm.c' Cython extension (up-to-date)
      building 'ffm' extension
      creating build/temp.linux-x86_64-3.6
      creating build/temp.linux-x86_64-3.6/fastFM
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -IfastFM/ -IfastFM-core/include/ -IfastFM-core/externals/CXSparse/Include/ -I/usr/local/lib/python3.6/site-packages/numpy/core/include -I/usr/local/include/python3.6m -c fastFM/ffm.c -o build/temp.linux-x86_64-3.6/fastFM/ffm.o
      In file included from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0,
                       from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                       from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from fastFM/ffm.c:528:
      /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
       #warning "Using deprecated NumPy API, disable it by " \
        ^
      gcc -pthread -shared build/temp.linux-x86_64-3.6/fastFM/ffm.o -LfastFM/ -LfastFM-core/bin/ -L/usr/local/lib -lm -lfastfm -lpython3.6m -o build/lib.linux-x86_64-3.6/ffm.cpython-36m-x86_64-linux-gnu.so
      /usr/bin/ld: fastFM-core/bin//libfastfm.a(ffm_utils.o): unrecognized relocation (0x2a) in section `.text'
      /usr/bin/ld: final link failed: Bad value
      collect2: error: ld returned 1 exit status
      error: command 'gcc' failed with exit status 1
    
      ----------------------------------------
      Failed building wheel for fastFM
      Running setup.py clean for fastFM
    Failed to build fastFM
    Installing collected packages: scikit-learn, fastFM
      Running setup.py install for fastFM ... error
        Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ahqg4ru8/fastFM/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ej8i3sar-record/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build/lib.linux-x86_64-3.6
        creating build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/sgd.py -> build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/datasets.py -> build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/als.py -> build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/validation.py -> build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/utils.py -> build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/base.py -> build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/__init__.py -> build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/bpr.py -> build/lib.linux-x86_64-3.6/fastFM
        copying fastFM/mcmc.py -> build/lib.linux-x86_64-3.6/fastFM
        running build_ext
        skipping 'fastFM/ffm.c' Cython extension (up-to-date)
        building 'ffm' extension
        creating build/temp.linux-x86_64-3.6
        creating build/temp.linux-x86_64-3.6/fastFM
        gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -IfastFM/ -IfastFM-core/include/ -IfastFM-core/externals/CXSparse/Include/ -I/usr/local/lib/python3.6/site-packages/numpy/core/include -I/usr/local/include/python3.6m -c fastFM/ffm.c -o build/temp.linux-x86_64-3.6/fastFM/ffm.o
        In file included from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0,
                         from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                         from /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                         from fastFM/ffm.c:528:
        /usr/local/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
         #warning "Using deprecated NumPy API, disable it by " \
          ^
        gcc -pthread -shared build/temp.linux-x86_64-3.6/fastFM/ffm.o -LfastFM/ -LfastFM-core/bin/ -L/usr/local/lib -lm -lfastfm -lpython3.6m -o build/lib.linux-x86_64-3.6/ffm.cpython-36m-x86_64-linux-gnu.so
        /usr/bin/ld: fastFM-core/bin//libfastfm.a(ffm_utils.o): unrecognized relocation (0x2a) in section `.text'
        /usr/bin/ld: final link failed: Bad value
        collect2: error: ld returned 1 exit status
        error: command 'gcc' failed with exit status 1
    
        ----------------------------------------
    Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ahqg4ru8/fastFM/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ej8i3sar-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ahqg4ru8/fastFM/
    
    help wanted 
    opened by henry0312 9
  • I get an error when I try to import it

    I get an error when I try to import it

    "dlopen(/Users/tanle/Desktop/recommender/lib/python2.7/site-packages/ffm.so, 2): Symbol not found: _cs_di_norm Referenced from: /Users/tanle/Desktop/recommender/lib/python2.7/site-packages/ffm.so Expected in: flat namespace in /Users/tanle/Desktop/recommender/lib/python2.7/site-packages/ffm.so"

    opened by tanql 8
  • sgd.FMRegression always predicts NaN values

    sgd.FMRegression always predicts NaN values

    I trained a SGD FM regression model, and when I made predictions with the model, all the predicted values are NaN. Upon a quick look on the model's learned coefficients (i.e., w0_, w_, and V_), most of them are NaNs.

    from __future__ import division
    from fastFM import sgd
    
    model = sgd.FMRegression()
    model.fit(Xtrain, ytrain)
    model.predict(Xvalid)  # all predicted values are NaNs.
    
    # Both Xtrain and Xvalid are CSC sparse matrices.
    

    MCMC and ALS work fine and actually produce reasonably good predictions for my particular task. Any thought on possible problems with SGD?

    OS: Ubuntu 16.04 Python version: 2.7.12 fastFM version: 0.2.5

    opened by chialikuo 8
  • Add manylinux1 build on travis

    Add manylinux1 build on travis

    This PR adds building manlinux1 wheels on travis-ci.

    This work mostly depends on @chittti 's work https://gist.github.com/chittti/c95de0bd1bab8340c34b59d1be21bb26 https://gist.github.com/chittti/bfa4f4fdc2d8ab9e8be01ce2dd087cce

    close https://github.com/ibayer/fastFM/issues/122

    opened by chezou 7
  • docs: Fix a few typos

    docs: Fix a few typos

    There are small typos in:

    • doc/index.rst
    • doc/tutorial.rst
    • examples/warm_start_als.py
    • examples/warm_start_mcmc.py
    • fastFM/bpr.py
    • fastFM/sgd.py
    • fastFM/tests/test_als.py
    • fastFM/validation.py

    Fixes:

    • Should read tuning rather than tunning.
    • Should read initialize rather than initalize.
    • Should read representation rather than reprensentation.
    • Should read refer rather than refere.
    • Should read continuous rather than continous.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 0
  • Update travis.yml for latest python releases.

    Update travis.yml for latest python releases.

    This PR will update the travis build process for new python versions ( i.e python 3.7, python 3.8, python 3.9 and python 3.10 ) and stop supporting the python 2 versions who went deprecated.

    opened by Carloscerq 0
  • will it work for third order categorical features interaction ?

    will it work for third order categorical features interaction ?

    Great code, thanks !

    Plese help to understand 1 will it work for third order categorical features interaction ? 2 will it run on Windows computer ?

    3 will it work for sparse data ?

    opened by Sandy4321 0
  • Source file type in PyPi

    Source file type in PyPi

    I trying to use the fastFM library. In Pypi https://pypi.org/project/fastFM/#files, I could see the download file is available only in .whl format. Is it possible to upload the source file type as well to pypi. It would be of great help if you can do that.

    Thanks

    opened by fcherat 0
Releases(0.2.11)
NVIDIA Merlin is an open source library designed to accelerate recommender systems on NVIDIA’s GPUs.

NVIDIA Merlin is an open source library providing end-to-end GPU-accelerated recommender systems, from feature engineering and preprocessing to training deep learning models and running inference in production.

null 420 Jan 4, 2023
Plex-recommender - Get movie recommendations based on your current PleX library

plex-recommender Description: Get movie/tv recommendations based on your current

null 5 Jul 19, 2022
fastFM: A Library for Factorization Machines

Citing fastFM The library fastFM is an academic project. The time and resources spent developing fastFM are therefore justified by the number of citat

null 1k Dec 24, 2022
High performance, easy-to-use, and scalable machine learning (ML) package, including linear model (LR), factorization machines (FM), and field-aware factorization machines (FFM) for Python and CLI interface.

What is xLearn? xLearn is a high performance, easy-to-use, and scalable machine learning package that contains linear model (LR), factorization machin

Chao Ma 3k Jan 3, 2023
High performance, easy-to-use, and scalable machine learning (ML) package, including linear model (LR), factorization machines (FM), and field-aware factorization machines (FFM) for Python and CLI interface.

What is xLearn? xLearn is a high performance, easy-to-use, and scalable machine learning package that contains linear model (LR), factorization machin

Chao Ma 2.8k Feb 12, 2021
High performance, easy-to-use, and scalable machine learning (ML) package, including linear model (LR), factorization machines (FM), and field-aware factorization machines (FFM) for Python and CLI interface.

What is xLearn? xLearn is a high performance, easy-to-use, and scalable machine learning package that contains linear model (LR), factorization machin

Chao Ma 3k Jan 8, 2023
A Library for Field-aware Factorization Machines

Table of Contents ================= - What is LIBFFM - Overfitting and Early Stopping - Installation - Data Format - Command Line Usage - Examples -

null 1.6k Dec 5, 2022
Factorization machines in python

Factorization Machines in Python This is a python implementation of Factorization Machines [1]. This uses stochastic gradient descent with adaptive re

Corey Lynch 892 Jan 3, 2023
Sparse Beta-Divergence Tensor Factorization Library

NTFLib Sparse Beta-Divergence Tensor Factorization Library Based off of this beta-NTF project this library is specially-built to handle tensors where

Stitch Fix Technology 46 Jan 8, 2022
A Python library for simulating finite automata, pushdown automata, and Turing machines

Automata Copyright 2016-2021 Caleb Evans Released under the MIT license Automata is a Python 3 library which implements the structures and algorithms

Caleb Evans 219 Dec 12, 2022
TensorFlow implementation of an arbitrary order Factorization Machine

This is a TensorFlow implementation of an arbitrary order (>=2) Factorization Machine based on paper Factorization Machines with libFM. It supports: d

Mikhail Trofimov 785 Dec 21, 2022
Neural Factorization of Shape and Reflectance Under An Unknown Illumination

NeRFactor [Paper] [Video] [Project] This is the authors' code release for: NeRFactor: Neural Factorization of Shape and Reflectance Under an Unknown I

Google 283 Jan 4, 2023
TuckER: Tensor Factorization for Knowledge Graph Completion

TuckER: Tensor Factorization for Knowledge Graph Completion This codebase contains PyTorch implementation of the paper: TuckER: Tensor Factorization f

Ivana Balazevic 296 Dec 6, 2022
A PyTorch implementation of a Factorization Machine module in cython.

fmpytorch A library for factorization machines in pytorch. A factorization machine is like a linear model, except multiplicative interaction terms bet

Jack Hessel 167 Jul 6, 2022
Transform-Invariant Non-Negative Matrix Factorization

Transform-Invariant Non-Negative Matrix Factorization A comprehensive Python package for Non-Negative Matrix Factorization (NMF) with a focus on learn

EMD Group 6 Jul 1, 2022
This is REST-API for Indonesian Text Summarization using Non-Negative Matrix Factorization for the algorithm to summarize documents and FastAPI for the framework.

Indonesian Text Summarization Using FastAPI This is REST-API for Indonesian Text Summarization using Non-Negative Matrix Factorization for the algorit

Viqi Nurhaqiqi 2 Nov 3, 2022
Implementation of SSMF: Shifting Seasonal Matrix Factorization

SSMF Implementation of SSMF: Shifting Seasonal Matrix Factorization, Koki Kawabata, Siddharth Bhatia, Rui Liu, Mohit Wadhwa, Bryan Hooi. NeurIPS, 2021

Koki Kawabata 9 Jun 10, 2022
PyTorch framework, for reproducing experiments from the paper Implicit Regularization in Hierarchical Tensor Factorization and Deep Convolutional Neural Networks

Implicit Regularization in Hierarchical Tensor Factorization and Deep Convolutional Neural Networks. Code, based on the PyTorch framework, for reprodu

Asaf 3 Dec 27, 2022
Restricted Boltzmann Machines in Python.

How to Use First, initialize an RBM with the desired number of visible and hidden units. rbm = RBM(num_visible = 6, num_hidden = 2) Next, train the m

Edwin Chen 928 Dec 30, 2022
Exploit Discord's cache system to remote upload payloads on Discord users machines

Exploit Discord's cache system to hide payloads PoC Remote upload embedded payload from image using EOF to Discord users machines through cache. Depen

cs 169 Dec 20, 2022