Giter Site home page Giter Site logo

david-cortes / cmfrec Goto Github PK

View Code? Open in Web Editor NEW
110.0 110.0 31.0 2.87 MB

(Python, R, C) Collective (multi-view/multi-way) matrix factorization, including cold-start functionality (recommender systems, imputation, dimensionality reduction)

Home Page: http://cmfrec.readthedocs.io

License: MIT License

Python 20.32% C 56.32% CMake 0.73% R 15.36% Cython 7.27%
cold-start collaborative-filtering collective-matrix-factorization

cmfrec's People

Contributors

david-cortes avatar nsonneborn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmfrec's Issues

Error when installing cmfrec

Hello,

When I try to install cmfrec via pip, I get the following error:

error: command 'gcc' failed: No such file or directory

Why might this be happening?

fail to run when I only have rating matrix

when I only use the rating matrix, the code will raise error as memory error, however, once I put user side information matrix in it, I can run it fluently.

all my matrix are in pandas dataframe form

my code (only rating matrix) is here

recommender = CMF(k=40, k_main=0, k_user=0, reg_param=0.1, w_main=1,
w_user=0, add_user_bias=False, add_item_bias=False, reindex=False)

recommender.fit(ratings=product_train.copy())

rec_item = list(recom.topN(user=altered_pair[i][0], n=300))

and my code that with user information is

recommender = CMF(k=40, k_main=0, k_user=0, reg_param=0.1, w_main=1,
w_user=0, add_user_bias=False, add_item_bias=False, reindex=False)

recommender.fit(ratings=product_train.copy(),
user_info=user_info.copy(), cols_bin_user=[cl for cl in user_info.columns if cl!='UserId'], cols_bin_item=None)

rec_item = list(recom.topN(user=altered_pair[i][0], n=300))

the error message is as follow:


MemoryError Traceback (most recent call last)
in ()
9 # recommender.fit(ratings=product_train.copy(),
10 # cols_bin_user=[cl for cl in user_info.columns if cl!='UserId'], cols_bin_item=None)
---> 11 recommender.fit(ratings=product_train.copy())
12
13 # recommender.fit(ratings=product_train.copy())

~/.local/lib/python3.6/site-packages/cmfrec/init.py in fit(self, ratings, user_info, item_info, cols_bin_user, cols_bin_item)
407 self._fit(self.w1, self.w2, self.w3, self.reg_param,
408 self.k, self.k_main, self.k_item, self.k_user,
--> 409 self.random_seed, self.maxiter)
410
411 self.is_fitted = True

~/.local/lib/python3.6/site-packages/cmfrec/init.py in _fit(self, w1, w2, w3, reg_param, k, k_main, k_item, k_user, random_seed, maxiter)
678 I_nonmissing:self._item_arr_notmissing, U_nonmissing:self._user_arr_notmissing,
679 I_nonmissing_bin:self._item_arr_notmissing_bin,
--> 680 U_nonmissing_bin:self._user_arr_notmissing_bin})
681 self.A = A.eval(session=sess)
682 self.B = B.eval(session=sess)

~/.local/lib/python3.6/site-packages/tensorflow/contrib/opt/python/training/external_optimizer.py in minimize(self, session, feed_dict, fetches, step_callback, loss_callback, **run_kwargs)
205 packed_bounds=self._packed_bounds,
206 step_callback=step_callback,
--> 207 optimizer_kwargs=self.optimizer_kwargs)
208 var_vals = [
209 packed_var_val[packing_slice] for packing_slice in self._packing_slices

~/.local/lib/python3.6/site-packages/tensorflow/contrib/opt/python/training/external_optimizer.py in _minimize(self, initial_val, loss_grad_func, equality_funcs, equality_grad_funcs, inequality_funcs, inequality_grad_funcs, packed_bounds, step_callback, optimizer_kwargs)
400
401 import scipy.optimize # pylint: disable=g-import-not-at-top
--> 402 result = scipy.optimize.minimize(*minimize_args, **minimize_kwargs)
403
404 message_lines = [

~/.local/lib/python3.6/site-packages/scipy/optimize/_minimize.py in minimize(fun, x0, args, method, jac, hess, hessp, bounds, constraints, tol, callback, options)
601 elif meth == 'l-bfgs-b':
602 return _minimize_lbfgsb(fun, x0, args, jac, bounds,
--> 603 callback=callback, **options)
604 elif meth == 'tnc':
605 return _minimize_tnc(fun, x0, args, jac, bounds, callback=callback,

~/.local/lib/python3.6/site-packages/scipy/optimize/lbfgsb.py in _minimize_lbfgsb(fun, x0, args, jac, bounds, disp, maxcor, ftol, gtol, eps, maxfun, maxiter, iprint, callback, maxls, **unknown_options)
309 x = array(x0, float64)
310 f = array(0.0, float64)
--> 311 g = zeros((n,), float64)
312 wa = zeros(2mn + 5n + 11mm + 8m, float64)
313 iwa = zeros(3*n, int32)

MemoryError:

ERROR: Invalid parameter combination, for fitting OMF

Hi,

I got the following error when I fit an OMF model OMF.fit(X=interaction_matrix, I=item_features):

File "cmfrec/wrapper_untyped.pxi", line 1685, in cmfrec.wrapper_double.call_fit_offsets_implicit_als
ValueError: Invalid parameter combination.

I can fit CMF model with the same input but it does not work for OMF

fit() got an unexpected keyword argument 'X'

I have been using cmfrec on my local machine (Python 3.10, Windows 10), specifically the CMF functions with adding implicit features argument. I am moving the code to a Docker image with Ubuntu 18.04 and installed using pip --no-cache-dir install --no-use-pep517 cmfrec (just pip install cmfrec failed to install on the image).

When trying to fit the model
m_collective = CMF(k=40, w_main=0.5, w_user=0.5, w_item=0.5, verbose=False).fit( X=ratings, U=user_side_info, I=item_side_info)

I get fit() got an unexpected keyword argument 'X'

Also when trying
m_collective = CMF(k=40, w_main=0.5, w_user=0.5, w_item=0.5, add_implicit_features=True, verbose=False).fit( X=ratings, U=user_side_info, I=item_side_info)
I get __init__() got an unexpected keyword argument 'add_implicit_features'

Does installing using --no-use-pep517 install an earlier version that didn't have the implicit features capability?

Different topN results using Dataframe vs COO

I am revising my inputs to use a COO matrix instead of a pandas Dataframe to enable compatibility with your recometrics library. I am using the CMF_implicit model. When fitting using only ratings I get identical topN results with very small differences in the scores. However, when I add in user and item side information my results differ between using the COO matrix as input vs Dataframe. The top 1-3 products recommended are usually identical but scores are quite different and further down the topN list there is a lot of variability. Is this expected behavior?

Ranking metric for measuring the performance of the model with side info

Hi, I wanted to express my appreciation for the "cmfrec_movielens_sideinfo.ipynb" notebook, as I found it incredibly helpful and interesting. I would like to ask if you have some recommended method to leverage ranking metrics such as nDCG, recall, precision, and others for evaluating the Top-N rank list. Thanks!

R API

Hi David,

I would love to use an R API for the cmfrec. Let me know if you would like contributions in that regard.

Regards,
Srikanth KS

Can't install. ERROR: Could not build wheels for cmfrec which use PEP 517 and cannot be installed directly

  File "/mnt/tmp/pip-install-jhlsso6h/cmfrec/setup.py", line 7, in <module>
creating build/temp.linux-x86_64-3.6/cmfrec
creating build/temp.linux-x86_64-3.6/src
compile options: '-D_FOR_PYTHON -DUSE_DOUBLE -DHAS_MKL -DNO_CBLAS_HEADER -I/home/hadoop/miniconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -Isrc -I/home/hadoop/miniconda3/envs/py36/lib/python3.6/site-packages/findblas/ -I/home/hadoop/miniconda3/envs/py36/include/python3.6m -c'
extra options: '-O3 -fopenmp -march=native -std=c99'
gcc: src/collective.c
gcc: cmfrec/cfuns_double.c
gcc: src/common.c
gcc: src/offsets.c
In file included from src/collective.c:57:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
     #include <omp.h>
              ^~~~~~~
compilation terminated.
In file included from src/offsets.c:188:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
     #include <omp.h>
              ^~~~~~~
compilation terminated.
gcc: src/helpers.c
gcc: src/lbfgs.c
In file included from src/common.c:58:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
     #include <omp.h>
              ^~~~~~~
compilation terminated.
gcc: src/cblas_wrappers.c
creating build/temp.linux-x86_64-3.6/cmfrec
creating build/temp.linux-x86_64-3.6/src
compile options: '-D_FOR_PYTHON -DUSE_DOUBLE -DHAS_MKL -DNO_CBLAS_HEADER -I/home/hadoop/miniconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -Isrc -I/home/hadoop/miniconda3/envs/py36/lib/python3.6/site-packages/findblas/ -I/home/hadoop/miniconda3/envs/py36/include/python3.6m -c'
extra options: '-O3 -fopenmp -march=native -std=c99'
gcc: src/collective.c
gcc: cmfrec/cfuns_double.c
gcc: src/common.c
gcc: src/offsets.c
In file included from src/collective.c:57:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
     #include <omp.h>

gcc: src/common.c
In file included from src/offsets.c:188:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
In file included from src/collective.c:57:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
In file included from src/common.c:58:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
gcc: src/helpers.c
compilation terminated.
gcc: src/lbfgs.c
gcc: src/cblas_wrappers.c
In file included from /mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
from /mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from cmfrec/cfuns_double.c:599:
/mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with "
^~~~~~~
In file included from src/helpers.c:57:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
In file included from src/cblas_wrappers.c:57:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
compilation terminated.
In file included from src/arithmetic_ansi.h:30:0,
from src/lbfgs.c:89:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
In file included from cmfrec/cfuns_double.c:601:0:
src/cmfrec.h:72:14: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
/mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/findblas/distutils.py:78: UserWarning: No CBLAS headers were found - function propotypes might be unreliable.
warnings.warn(warning_msg)
/mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /mnt/tmp/pip-install-zk41hzuo/cmfrec/cmfrec/cfuns_double.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
/mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /mnt/tmp/pip-install-zk41hzuo/cmfrec/cmfrec/cfuns_float.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
error: Command "gcc -pthread -B /home/hadoop/miniconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D_FOR_PYTHON -DUSE_DOUBLE -DHAS_MKL -DNO_CBLAS_HEADER -I/mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/numpy/core/include -Isrc -I/mnt/tmp/pip-build-env-f18wyvyi/overlay/lib/python3.6/site-packages/findblas/ -I/home/hadoop/miniconda3/envs/py36/include/python3.6m -c src/offsets.c -o build/temp.linux-x86_64-3.6/src/offsets.o -O3 -fopenmp -march=native -std=c99" failed with exit status 1

ERROR: Failed building wheel for cmfrec
Failed to build cmfrec
ERROR: Could not build wheels for cmfrec which use PEP 517 and cannot be installed directly

factors for cold start items

Hi,

I have the following questions:

  1. I want to use CMF_implicit for item cold start problems. But I don't know which built-in function can be used to generate factors for cold-start/new items.
    Assume that I have three matrices:
  • X: user-item interactions of shape 100*50 with 100 users and 50 old items
  • I: item-attribute of shape 50*30 with 50 old items and 30 item side information/features
  • I_new: new item attribute of shape 10*30 with 10 new items and 30 item side information/features

I first trained the model by calling model.fit(X=X, I=I). This gave me factors matrices A,B,D where X ~ AB^T and I ~ BD^T.
How can I get the new item factors B_new where I_new ~ B_new*D^T? I feel like factors_multiple is the most possible function but it requires the matrix X so I am not sure.

  1. Did you or other users experience longer training time after 7/17? I observed way longer (16x longer) model fitting time after 7/17. I noticed that cython dependency has released new version 3.0.0 on 7/17.
    https://pypi.org/project/Cython/#history
    But when I rolled back to the old version, the fitting time is still very slow.

Thanks in advance.

IndexError: Out of bounds on buffer access (axis 0)

Hi,
I am using cmfrec CMF_implicit. I call the topN_cold function as follow:

model.topN_cold(n = n, U_col = list_1, U_val = list_2, include = include)
where list_1 and list_2 are with the same length and nonempty.

Then I got the following error:

File "/home/hadoop/miniconda3/envs/py36/lib/python3.6/site-packages/cmfrec/init.py", line 4234, in topN_cold
a_vec = self.factors_cold(U, U_col, U_val)
File "/home/hadoop/miniconda3/envs/py36/lib/python3.6/site-packages/cmfrec/init.py", line 4182, in factors_cold
return self._factors_cold(U=U, U_bin=None, U_col=U_col, U_val=U_val)
File "/home/hadoop/miniconda3/envs/py36/lib/python3.6/site-packages/cmfrec/init.py", line 1366, in _factors_cold
self.nonneg
File "cmfrec/wrapper_untyped.pxi", line 2103, in cmfrec.wrapper_double.call_factors_collective_implicit_single
IndexError: Out of bounds on buffer access (axis 0)

It used to work before (few months ago), but it is not working now.
Do you know any possible reasons? Thanks.

Best,
Riley

R Session aborted

In R Studio I receive the notification "R Session Aborted" when runnung ContentBased()
Additionally it shows:

Error in .ContentBased(inputs$processed_X, inputs$processed_U, inputs$processed_I, :
BLAS/LAPACK routine 'DLASCLS' gave error code -4

dim(X): 6043 2416
dim(U): 6038 4
dim(I): 2416 13

m_offset_model.predict_new

Hi David,

Thanks for developing such a wonderful package.

I am using your offset model to predict ratings for a new item using item side info , but I just cannot get the OMF_explicit.predict_new function to work.

I have created the train test dataset based on your notebook. For ratings_test1, my

m_offset_model.predict(ratings_test1.UserId, ratings_test1.ItemId)

function works, and i got decent RMSE and R squared : 0.939. But when i did

 m_offset_model.predict_new(ratings_test2.UserId, item_attr_test.loc[ratings_test2.ItemId])

I got an error:

ValueError                                Traceback (most recent call last)
<ipython-input-14-7a852e669d0c> in <module>
      2 ### offset model
      3 pred_offset = m_offset_model.predict_new(ratings_test2.UserId,
----> 4                                        item_attr_test.loc[ratings_test2.ItemId])
      5 print("RMSE type 2 offset model: %.3f [rho: %.3f]" %
      6       (mean_squared_error(ratings_test2.Rating,

~/opt/anaconda3/envs/recommender/lib/python3.7/site-packages/cmfrec/__init__.py in predict_new(self, user, I)
   3699             Predicted ratings for the requested user-item combinations.
   3700         """
-> 3701         B = self._factors_cold_multiple(U=I, is_I=True)
   3702         return self._predict_new(user, B)
   3703 

~/opt/anaconda3/envs/recommender/lib/python3.7/site-packages/cmfrec/__init__.py in _factors_cold_multiple(self, U, is_I)
   3624         if Mat.shape[0] == 0:
   3625             msg  = "Can only use this method when fitting the model to %s side info."
-> 3626             raise ValueError(msg % infoname)
   3627         if (U is not None) and (len(U.shape) != 2):
   3628             raise ValueError("'%s' must be 2-dimensional." % letter)

ValueError: Can only use this method when fitting the model to item side info.

The same ratings_test2 dataset have worked fine on CMF_explicit models predict_new function with various combination of w_main and w_weight. I am wondering does OMF_explicit predict_new require a different type of data structure? Any ideas how to fix this?
Thank you so so much!

Jane

CMF_implicit AssertionError

cmf_model = CMF_implicit(k=100, w_main=0.3, w_user=0.7, lambda_=1e1, niter=50).fit(X=ratings_train_implicit, U=user_side_info.loc[user_side_info.UserId.isin(users_train)],
I=item_sideinfo_pca.loc[item_sideinfo_pca.ItemId.isin(ratings_train.ItemId.unique())])

I get a assert "Value" in X.columns.values
AssertionError

Errors during install on Windows

Hi, I'm having trouble installing the new version of cmfrec on Windows (was enjoying using a previous version last year): I've attempted to use pip install cmfrec (error message 1 below); pip install git+https://www.github.com/david-cortes/cmfrec.git (also error message 1); cloning this repo and then running python setup.py install (error message 2 below); and cloning this repo and then running python .\setup.py install --prefix=C:\\Users\\me\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages, which asks if a dll is a BLAS library: answering yes results in error message 3.

This is a pretty fresh windows install, but has numpy, scipy, findblas installed. Visual Studio 2019 is also installed, which claimed to come with Visual Studio Build Tools. Using python 3.8.5, pip 20.1.1. Any help as to why the install isn't working would be great!

Error message 1

Collecting cmfrec
  Using cached cmfrec-1.0.6.tar.gz (151 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: cython in c:\users\thoma\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from cmfrec) (0.29.21)
Requirement already satisfied: findblas in c:\users\thoma\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from cmfrec) (0.1.15)
Requirement already satisfied: numpy>=1.17 in c:\users\thoma\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from cmfrec) (1.19.1)
Requirement already satisfied: pandas>=0.25.0 in c:\users\thoma\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from cmfrec) (1.0.5)
Requirement already satisfied: pytz>=2017.2 in c:\users\thoma\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pandas>=0.25.0->cmfrec) (2020.1)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\thoma\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pandas>=0.25.0->cmfrec) (2.8.1)
Requirement already satisfied: six>=1.5 in c:\users\thoma\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from python-dateutil>=2.6.1->pandas>=0.25.0->cmfrec) (1.15.0)
Building wheels for collected packages: cmfrec
  Building wheel for cmfrec (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\thoma\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\thoma\AppData\Local\Temp\tmp5n_zv03y'
       cwd: C:\Users\thoma\AppData\Local\Temp\pip-install-gkukoip4\cmfrec
  Complete output (77 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\cmfrec
  copying cmfrec\__init__.py -> build\lib.win-amd64-3.8\cmfrec
  running build_ext
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
      Optimized (vendor) Blas libraries are not found.
      Falls back to netlib Blas library which has worse performance.
      A better performance should be easily gained by switching
      Blas library.
    if self._calc_info(blas):
  C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
      Blas (http://www.netlib.org/blas/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [blas]) or by setting
      the BLAS environment variable.
    if self._calc_info(blas):
  C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
      Blas (http://www.netlib.org/blas/) sources not found.
      Directories to search for the sources can be specified in the
      numpy/distutils/site.cfg file (section [blas_src]) or by setting
      the BLAS_SRC environment variable.
    if self._calc_info(blas):
  C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\findblas\__init__.py:489: UserWarning: No BLAS library found - taking NumPy's linalg's file as library.
    warnings.warn("No BLAS library found - taking NumPy's linalg's file as library.")
  Traceback (most recent call last):
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
      main()
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\setuptools\build_meta.py", line 229, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\setuptools\build_meta.py", line 215, in _build_with_temp_dir
      self.run_setup()
    File "C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\setuptools\build_meta.py", line 266, in run_setup
      super(_BuildMetaLegacyBackend,
    File "C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\setuptools\build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 33, in <module>
      setup(
    File "C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\setuptools\__init__.py", line 163, in setup
      return distutils.core.setup(**attrs)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 290, in run
      self.run_command('build')
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
      _build_ext.build_ext.run(self)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\command\build_ext.py", line 340, in run
      self.build_extensions()
    File "setup.py", line 31, in build_extensions
      build_ext_with_blas.build_extensions(self)
    File "C:\Users\thoma\AppData\Local\Temp\pip-build-env-39h4rkac\overlay\Lib\site-packages\findblas\distutils.py", line 32, in build_extensions
      raise ValueError(txt)
  ValueError: Found BLAS library at:
  C:/Users/thoma/AppData/Local/Temp/pip-build-env-39h4rkac/overlay/Lib/site-packages/numpy\.libs\libopenblas.NOIJJG62EMASZI6NYURL6JBKM4EVBGM7.gfortran-win_amd64.dll
  But .lib files are missing! Please reinstall it (e.g. 'pip install mkl-devel').
  ----------------------------------------
  ERROR: Failed building wheel for cmfrec
Failed to build cmfrec
ERROR: Could not build wheels for cmfrec which use PEP 517 and cannot be installed directly

Error message 2

running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\\Lib\\site-packages\\test-easy-install-5564.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\Lib\site-packages\

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.

Error message 3

running install
Checking .pth file support in C:\\Users\\thoma\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\Lib\site-packages\
C:\Users\thoma\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\pythonw.exe -E -c pass
TEST FAILED: C:\\Users\\thoma\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\Lib\site-packages\ does NOT support .pth files
bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    C:\\Users\\thoma\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\Lib\site-packages\

and your PYTHONPATH environment variable currently contains:

    ''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations


Please make the appropriate changes for your system and try again.
running bdist_egg
running egg_info
writing cmfrec.egg-info\PKG-INFO
writing dependency_links to cmfrec.egg-info\dependency_links.txt
writing requirements to cmfrec.egg-info\requires.txt
writing top-level names to cmfrec.egg-info\top_level.txt
reading manifest file 'cmfrec.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.gitignore'
warning: no previously-included files found matching '.gitattributes'
warning: no previously-included files found matching 'example\*'
warning: no previously-included files found matching 'cmfrec\*.c'
warning: no previously-included files found matching 'docs\*'
no previously-included directories found matching 'docs\*'
writing manifest file 'cmfrec.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
C:\Users\thoma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\distutils\system_info.py:1914: UserWarning: 
    Optimized (vendor) Blas libraries are not found.
    Falls back to netlib Blas library which has worse performance.
    A better performance should be easily gained by switching
    Blas library.
  if self._calc_info(blas):
C:\Users\thoma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\distutils\system_info.py:1914: UserWarning: 
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable.
  if self._calc_info(blas):
C:\Users\thoma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
    Blas (http://www.netlib.org/blas/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [blas_src]) or by setting
    the BLAS_SRC environment variable.
  if self._calc_info(blas):
Found file with name matching 'blas'
/Users/thoma/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0/LocalCache/local-packages/Python38/site-packages/scipy/.libslibopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll
Is this a BLAS library? [y/n]: y
Traceback (most recent call last):
  File ".\setup.py", line 33, in <module>
    setup(
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\install.py", line 67, in run
    self.do_egg_install()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\bdist_egg.py", line 173, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\bdist_egg.py", line 159, in call_command
    self.run_command(cmdname)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
    self.build()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\thoma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File ".\setup.py", line 31, in build_extensions
    build_ext_with_blas.build_extensions(self)
  File "C:\Users\thoma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\findblas\distutils.py", line 32, in build_extensions
    raise ValueError(txt)
ValueError: Found BLAS library at:
/Users/thoma/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0/LocalCache/local-packages/Python38/site-packages/scipy/.libs\libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll
But .lib files are missing! Please reinstall it (e.g. 'pip install mkl-devel').

Mac installation w/ Homebrew Python

Hi, just wanted to report the C library finds BLAS that ships w/ Mac, but the Python package doesn't.

CMake output

-- Found BLAS: /Applications/Xcode_12.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Accelerate.framework 

Python output

Building wheels for collected packages: cmfrec
  Building wheel for cmfrec (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/[email protected]/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/tmp8xl02vuw
       cwd: /private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-install-mmdobivr/cmfrec
  Complete output (64 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.15-x86_64-3.9
  creating build/lib.macosx-10.15-x86_64-3.9/cmfrec
  copying cmfrec/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/cmfrec
  running build_ext
  /var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/tmpbgte3umb/source.c:1:10: fatal error: 'cblas.h' file not found
  #include <cblas.h>
           ^~~~~~~~~
  1 error generated.
  /var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/tmpyofnvb9v/source.c:1:10: fatal error: 'cblas.h' file not found
  #include <cblas.h>
           ^~~~~~~~~
  1 error generated.
  Traceback (most recent call last):
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 216, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
      self.run_setup()
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 253, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 94, in <module>
      setup(
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 290, in run
      self.run_command('build')
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
      _build_ext.build_ext.run(self)
    File "/usr/local/Cellar/[email protected]/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py", line 340, in run
      self.build_extensions()
    File "setup.py", line 64, in build_extensions
      build_ext_with_blas.build_extensions(self)
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/findblas/distutils.py", line 22, in build_extensions
      blas_path, blas_file, incl_path, incl_file, flags = findblas.find_blas()
    File "/private/var/folders/2t/6lmb55md2kj8pspr5nsfv7rw0000gn/T/pip-build-env-yae_2b7_/overlay/lib/python3.9/site-packages/findblas/__init__.py", line 438, in find_blas
      flags_found += found_syms[1]
  TypeError: 'NoneType' object is not iterable
  ----------------------------------------
  ERROR: Failed building wheel for cmfrec
Failed to build cmfrec
ERROR: Could not build wheels for cmfrec which use PEP 517 and cannot be installed directly

I was able to get the Python package working w/ OpenBLAS, but it'd be nice if it found the built-in one like CMake.

brew install openblas
export USE_OPENBLAS=1
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openblas/lib
pip3 install cmfrec

get each item feature's importance

David, I am wondering whether there is a way to get individual item feature importance in OMF_explicit model. How should I go about it to get information on which item features are positively correlated with a given user and which ones are negatively correlated?

Here are some simulated data:

import numpy as np, pandas as pd
from cmfrec import OMF_explicit

n_users = 40
n_items = 50
n_ratings = 2000
n_user_attr = 4
n_item_attr = 50


np.random.seed(1)
ratings = pd.DataFrame({
    "UserId" : np.random.randint(n_users, size=n_ratings),
    "ItemId" : np.random.randint(n_items, size=n_ratings),
    "Rating" : np.random.normal(loc=3., size=n_ratings)
})
item_info = pd.DataFrame(np.random.normal(size = (n_items, n_item_attr)))
item_info["ItemId"] = np.arange(n_items)

model = OMF_explicit(k=5)
model.fit(ratings, I=item_info)

I assume I can get decomposed item embeddings this way:

model.item_factors_cold(item_info.drop(columns=(['ItemId']))[1])

Is there a way to get more details on item feature importance?

Thanks!

name 'n' is not defined when using CMF_implicit()

Hi,

I used the "CMF_implict" model and tried to recommend users to new items using "predict_new()" function but I got the following error:

__init__.py", line 2178, in _factors_cold_multiple
    n, m_u, 0,
NameError: name 'n' is not defined

Here I do not know what "n" is referring to? is it number of users or items or number of cold items?

something error when install cmfrec on Linux

Hi, I installed this package through pip install cmfrec on Linux . but I got error message as follow.

  Building wheels for collected packages: cmfrec
  Building wheel for cmfrec (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /data/luoyang/miniconda3/envs/cmf/bin/python /data/luoyang/miniconda3/envs/cmf/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpwsk6bmnt
       cwd: /tmp/pip-install-ngr08odx/cmfrec_d9ed4b12636d45d4957fe6990ca10444
  Complete output (30 lines):
  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/cmfrec
  copying cmfrec/__init__.py -> build/lib.linux-x86_64-3.6/cmfrec
  running build_ext
  --- Checking compiler support for option '-march=native'
  --- Checking compiler support for option '-mcpu=native'
  --- Checking compiler support for option '-fopenmp'
  --- Checking compiler support for option '-qopenmp'
  --- Checking compiler support for option '-xopenmp'
  --- Checking compiler support for option '-flto'
  cythoning cmfrec/cfuns_double_plusblas.pyx to cmfrec/cfuns_double_plusblas.c
  cythoning cmfrec/cfuns_float_plusblas.pyx to cmfrec/cfuns_float_plusblas.c
  building 'cmfrec.wrapper_double' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/cmfrec
  creating build/temp.linux-x86_64-3.6/src
  gcc -pthread -B /data/luoyang/miniconda3/envs/cmf/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D_FOR_PYTHON -DUSE_DOUBLE -DNO_FINDBLAS -DAVOID_BLAS_SYR -I/tmp/pip-build-env-twu5cdon/overlay/lib/python3.6/site-packages/numpy/core/include -Isrc -I/data/luoyang/miniconda3/envs/cmf/include/python3.6m -c cmfrec/cfuns_double_plusblas.c -o build/temp.linux-x86_64-3.6/cmfrec/cfuns_double_plusblas.o -O3 -std=c99
  /tmp/pip-build-env-twu5cdon/overlay/lib/python3.6/site-packages/setuptools/dist.py:487: UserWarning: Normalizing '3.2.2-3' to '3.2.2.post3'
    warnings.warn(tmpl.format(**locals()))
  /tmp/pip-build-env-twu5cdon/overlay/lib/python3.6/site-packages/setuptools/dist.py:720: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
    % (opt, underscore_opt)
  /tmp/pip-build-env-twu5cdon/overlay/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-ngr08odx/cmfrec_d9ed4b12636d45d4957fe6990ca10444/cmfrec/cfuns_double_plusblas.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  /tmp/pip-build-env-twu5cdon/overlay/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-ngr08odx/cmfrec_d9ed4b12636d45d4957fe6990ca10444/cmfrec/cfuns_float_plusblas.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  error: command 'gcc' failed with exit status 1
  -------------------------------------
  ERROR: Failed building wheel for cmfrec
Failed to build cmfrec
ERROR: Could not build wheels for cmfrec which use PEP 517 and cannot be installed directly

Then, I tried command pip install --no-use-pep517 cmfrec. it worked. But old version cmfrec 0.5.3 was installed.
I want to use latest version. How to fix this? and could you tell me what is PEP 517 build error?
plz T_T

Logging loss/metrics per iteration

I have tried as best I can to figure this out, I am sorry if the feature already exits and I simply did not find it.

Feature request
I want to log my loss and other metrics per iteration. Ideally, I would want to be able to supply a callback to be evaluated at each iteration. How to interface this with the C backend, I am not certain about.

Do you think this is possible to implement?

fail to use topN_cold

I met a problem when using the method topN_cold,
my user information dimension is 12, if I try to input numpy arrays that are different from 12, it raises
AssertionError,
which I know should be wrong. But when I input the numpy array that is in 12 digits, it raises

ValueError: all the input arrays must have same number of dimensions

here is how the rating matrix looks like

image

and the user information matrix: there are 13 columns of user information, contains the user id
image

also, I upload my jupyter notebook for you to have a detail look
cmf with cold start-Copy1.zip

Install error on Windows

Hi, I'm having trouble installing cmfrec on Windows. I've tried use pip install cmfrec (error message 1 below); running python setup.py install under Lib(error message 2 below); .

II have numpy, scipy, findblas 0.1.18,mkl-devel installed. Visual Studio 2019 and Visual Studio Build Tools are also installed . Using python 3.7.8, pip 21.1.3. Any help as to why the install isn't working would be great!

Error message 1

`C:\Users\dell>pip install cmfrec
Collecting cmfrec
Using cached cmfrec-3.1.2.tar.gz (231 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: findblas in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from cmfrec) (0.1.18)
Requirement already satisfied: pandas>=0.25.0 in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from cmfrec) (1.2.5)
Requirement already satisfied: numpy>=1.17 in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from cmfrec) (1.21.0)
Requirement already satisfied: scipy in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from cmfrec) (1.7.0)
Requirement already satisfied: cython in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from cmfrec) (0.29.23)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from pandas>=0.25.0->cmfrec) (2.8.1)
Requirement already satisfied: pytz>=2017.3 in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from pandas>=0.25.0->cmfrec) (2021.1)
Requirement already satisfied: six>=1.5 in c:\users\dell\appdata\local\programs\python\python37\lib\site-packages (from python-dateutil>=2.7.3->pandas>=0.25.0->cmfrec) (1.16.0)
Building wheels for collected packages: cmfrec
Building wheel for cmfrec (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\dell\appdata\local\programs\python\python37\python.exe' 'c:\users\dell\appdata\local\programs\python\python37\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' build_wheel 'C:\Users\dell\AppData\Local\Temp\tmp9k2o9e9j'
cwd: C:\Users\dell\AppData\Local\Temp\pip-install-kwzhg8aa\cmfrec_884c1e27538648018333bd51b0f2323c
Complete output (127 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\cmfrec
copying cmfrec_init_.py -> build\lib.win-amd64-3.7\cmfrec
running build_ext
cythoning cmfrec/cfuns_double_plusblas.pyx to cmfrec\cfuns_double_plusblas.c
cythoning cmfrec/cfuns_float_plusblas.pyx to cmfrec\cfuns_float_plusblas.c
building 'cmfrec.wrapper_double' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\cmfrec
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FOR_PYTHON -DUSE_DOUBLE -DNO_FINDBLAS -DAVOID_BLAS_SYR -IC:\Users\dell\AppData\Local\Temp\pip-build-env-ly377xdo\overlay\Lib\site-packages\numpy\core\include -Isrc -Ic:\users\dell\appdata\local\programs\python\python37\include -Ic:\users\dell\appdata\local\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tccmfrec\cfuns_double_plusblas.c /Fobuild\temp.win-amd64-3.7\Release\cmfrec\cfuns_double_plusblas.obj /O2 /openmp
cfuns_double_plusblas.c
c:\users\dell\appdata\local\temp\pip-build-env-ly377xdo\overlay\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
cmfrec\cfuns_double_plusblas.c(4925): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(4934): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(5013): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(5022): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(15522): warning C4244: “函数”: 从“npy_intp”转换到“long”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(16594): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(27307): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(27316): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(28249): warning C4244: “函数”: 从“npy_intp”转换到“long”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(29650): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(30165): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(30377): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(32677): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(32704): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33051): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33821): warning C4244: “=”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33859): warning C4244: “=”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(34400): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(35048): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(36629): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(36864): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(37985): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(38090): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(38667): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(39317): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(39929): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(40729): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(41676): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(41747): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(43119): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(43181): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(44542): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(44604): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49854): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49863): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49872): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(51847): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(51909): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(53859): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(56359): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(58110): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59358): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59367): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59376): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59385): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59397): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(60189): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(60863): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FOR_PYTHON -DUSE_DOUBLE -DNO_FINDBLAS -DAVOID_BLAS_SYR -IC:\Users\dell\AppData\Local\Temp\pip-build-env-ly377xdo\overlay\Lib\site-packages\numpy\core\include -Isrc -Ic:\users\dell\appdata\local\programs\python\python37\include -Ic:\users\dell\appdata\local\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/collective.c /Fobuild\temp.win-amd64-3.7\Release\src/collective.obj /O2 /openmp
collective.c
src/collective.c(837): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(842): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(854): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(858): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(1980): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(2009): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(3856): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(3898): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(3814): warning C4101: “ib”: 未引用的局部变量
src/collective.c(3813): warning C4101: “err”: 未引用的局部变量
src/collective.c(5148): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(5547): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(6157): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7406): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7420): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7446): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7458): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7498): warning C4244: “=”: 从“size_t”转换到“double”,可能丢失数据
src/collective.c(7518): warning C4244: “=”: 从“size_t”转换到“double”,可能丢失数据
src/collective.c(8042): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8057): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8235): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8244): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10333): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(10334): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(10502): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10506): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10508): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10509): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10511): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10513): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10515): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10517): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10523): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10525): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10527): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10529): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10531): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10532): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10711): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10714): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10716): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10717): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10719): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10721): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10897): error C3005: “collapse”: OpenMP“parallel for”指令上出现意外的标记
src/collective.c(10901): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10927): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(10929): error C3005: “collapse”: OpenMP“parallel for”指令上出现意外的标记
src/collective.c(10932): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(11377): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(11476): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
C:\Users\dell\AppData\Local\Temp\pip-build-env-ly377xdo\overlay\Lib\site-packages\setuptools\dist.py:694: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
% (opt, underscore_opt))
C:\Users\dell\AppData\Local\Temp\pip-build-env-ly377xdo\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\dell\AppData\Local\Temp\pip-install-kwzhg8aa\cmfrec_884c1e27538648018333bd51b0f2323c\cmfrec\cfuns_double_plusblas.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
C:\Users\dell\AppData\Local\Temp\pip-build-env-ly377xdo\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\dell\AppData\Local\Temp\pip-install-kwzhg8aa\cmfrec_884c1e27538648018333bd51b0f2323c\cmfrec\cfuns_float_plusblas.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Failed building wheel for cmfrec`

Error message 2

C:\Users\dell\AppData\Local\Programs\Python\Python37\Lib\cmfrec-3.1.2\cmfrec-3.1.2>python setup.py install
C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\dist.py:694: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
% (opt, underscore_opt))
running install
running bdist_egg
running egg_info
writing cmfrec.egg-info\PKG-INFO
writing dependency_links to cmfrec.egg-info\dependency_links.txt
writing requirements to cmfrec.egg-info\requires.txt
writing top-level names to cmfrec.egg-info\top_level.txt
reading manifest file 'cmfrec.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '.o' found anywhere in distribution
warning: no previously-included files matching '
.so' found anywhere in distribution
warning: no previously-included files matching '*.md' found anywhere in distribution
warning: no previously-included files found matching '.gitignore'
warning: no previously-included files found matching '.gitattributes'
warning: no previously-included files found matching 'example*'
warning: no previously-included files found matching 'test_math*'
warning: no previously-included files found matching 'cmfrec*.cpp'
warning: no previously-included files found matching 'cmfrec*.hpp'
warning: no previously-included files found matching 'docs*'
no previously-included directories found matching 'docs*'
warning: no previously-included files found matching 'src\Rwrapper.c'
writing manifest file 'cmfrec.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
skipping 'cmfrec\cfuns_double_plusblas.c' Cython extension (up-to-date)
skipping 'cmfrec\cfuns_float_plusblas.c' Cython extension (up-to-date)
building 'cmfrec.wrapper_double' extension
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FOR_PYTHON -DUSE_DOUBLE -DNO_FINDBLAS -DAVOID_BLAS_SYR -IC:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\include -Isrc -IC:\Users\dell\AppData\Local\Programs\Python\Python37\include -IC:\Users\dell\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tccmfrec\cfuns_double_plusblas.c /Fobuild\temp.win-amd64-3.7\Release\cmfrec\cfuns_double_plusblas.obj /O2 /openmp
cfuns_double_plusblas.c
c:\users\dell\appdata\local\programs\python\python37\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
cmfrec\cfuns_double_plusblas.c(4903): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(4912): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(4991): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(5000): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(15500): warning C4244: “函数”: 从“npy_intp”转换到“long”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(16572): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(27285): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(27294): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(28227): warning C4244: “函数”: 从“npy_intp”转换到“long”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(29628): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(30143): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(30355): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(32655): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(32682): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33029): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33799): warning C4244: “=”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33837): warning C4244: “=”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(34378): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(35026): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(36607): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(36842): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(37963): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(38068): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(38645): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(39295): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(39907): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(40707): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(41654): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(41725): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(43097): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(43159): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(44520): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(44582): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49832): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49841): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49850): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(51825): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(51887): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(53837): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(56337): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(58088): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59336): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59345): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59354): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59363): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59375): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(60167): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(60841): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FOR_PYTHON -DUSE_DOUBLE -DNO_FINDBLAS -DAVOID_BLAS_SYR -IC:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\include -Isrc -IC:\Users\dell\AppData\Local\Programs\Python\Python37\include -IC:\Users\dell\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/collective.c /Fobuild\temp.win-amd64-3.7\Release\src/collective.obj /O2 /openmp
collective.c
src/collective.c(837): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(842): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(854): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(858): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(1980): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(2009): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(3856): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(3898): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(3814): warning C4101: “ib”: 未引用的局部变量
src/collective.c(3813): warning C4101: “err”: 未引用的局部变量
src/collective.c(5148): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(5547): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(6157): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7406): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7420): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7446): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7458): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7498): warning C4244: “=”: 从“size_t”转换到“double”,可能丢失数据
src/collective.c(7518): warning C4244: “=”: 从“size_t”转换到“double”,可能丢失数据
src/collective.c(8042): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8057): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8235): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8244): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10333): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(10334): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(10502): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10506): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10508): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10509): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10511): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10513): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10515): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10517): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10523): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10525): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10527): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10529): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10531): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10532): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10711): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10714): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10716): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10717): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10719): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10721): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10897): error C3005: “collapse”: OpenMP“parallel for”指令上出现意外的标记
src/collective.c(10901): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10927): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(10929): error C3005: “collapse”: OpenMP“parallel for”指令上出现意外的标记
src/collective.c(10932): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(11377): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(11476): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit status 2`

Message 3 (pip show -f mkl-devel)

C:\Users\dell>pip show -f mkl-devel
Name: mkl-devel
Version: 2021.3.0
Summary: Intel® oneAPI Math Kernel Library
Home-page: https://software.intel.com/en-us/oneapi/onemkl
Author: Intel Corporation
Author-email: [email protected]
License: Intel Simplified Software License
Location: c:\users\dell\appdata\local\programs\python\python37\lib\site-packages
Requires: mkl, mkl-include
Required-by:
Files:
....\Library\lib\mkl_blacs_ilp64_dll.lib
....\Library\lib\mkl_blacs_lp64_dll.lib
....\Library\lib\mkl_cdft_core_dll.lib
....\Library\lib\mkl_core_dll.lib
....\Library\lib\mkl_intel_ilp64_dll.lib
....\Library\lib\mkl_intel_lp64_dll.lib
....\Library\lib\mkl_intel_thread_dll.lib
....\Library\lib\mkl_pgi_thread_dll.lib
....\Library\lib\mkl_rt.lib
....\Library\lib\mkl_scalapack_ilp64_dll.lib
....\Library\lib\mkl_scalapack_lp64_dll.lib
....\Library\lib\mkl_sequential_dll.lib
....\Library\lib\mkl_tbb_thread_dll.lib
mkl_devel-2021.3.0.dist-info\INSTALLER
mkl_devel-2021.3.0.dist-info\LICENSE.txt
mkl_devel-2021.3.0.dist-info\METADATA
mkl_devel-2021.3.0.dist-info\RECORD
mkl_devel-2021.3.0.dist-info\REQUESTED
mkl_devel-2021.3.0.dist-info\WHEEL
mkl_devel-2021.3.0.dist-info\top_level.txt

Message 4(import findblas
print(findblas.find_blas()))

`>>> import findblas

print(findblas.find_blas())
C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\system_info.py:2026: UserWarning:
Optimized (vendor) Blas libraries are not found.
Falls back to netlib Blas library which has worse performance.
A better performance should be easily gained by switching
Blas library.
if self._calc_info(blas):
C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\system_info.py:2026: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
if self._calc_info(blas):
C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\system_info.py:2026: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
if self._calc_info(blas):
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see pypa/pip#5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
('C:/Users/dell/AppData/Local/Programs/Python/Python37/Library/lib', 'mkl_rt.lib', 'C:/Users/dell/AppData/Local/Programs/Python/Python37/Library/include', 'mkl.h', ['HAS_MKL'])`

Message 5 (try run python setup.py build_ext --inplace --force)
`C:\Users\dell>cd C:\Users\dell\AppData\Local\Programs\Python\Python37\Lib\cmfrec-3.1.2\cmfrec-3.1.2

C:\Users\dell\AppData\Local\Programs\Python\Python37\Lib\cmfrec-3.1.2\cmfrec-3.1.2>python setup.py build_ext --inplace --force
C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\setuptools\dist.py:694: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
% (opt, underscore_opt))
running build_ext
cythoning cmfrec/cfuns_double_plusblas.pyx to cmfrec\cfuns_double_plusblas.c
C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\dell\AppData\Local\Programs\Python\Python37\Lib\cmfrec-3.1.2\cmfrec-3.1.2\cmfrec\cfuns_double_plusblas.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
cythoning cmfrec/cfuns_float_plusblas.pyx to cmfrec\cfuns_float_plusblas.c
C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\dell\AppData\Local\Programs\Python\Python37\Lib\cmfrec-3.1.2\cmfrec-3.1.2\cmfrec\cfuns_float_plusblas.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'cmfrec.wrapper_double' extension
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FOR_PYTHON -DUSE_DOUBLE -DNO_FINDBLAS -DAVOID_BLAS_SYR -IC:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\include -Isrc -IC:\Users\dell\AppData\Local\Programs\Python\Python37\include -IC:\Users\dell\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tccmfrec\cfuns_double_plusblas.c /Fobuild\temp.win-amd64-3.7\Release\cmfrec\cfuns_double_plusblas.obj /O2 /openmp
cfuns_double_plusblas.c
c:\users\dell\appdata\local\programs\python\python37\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
cmfrec\cfuns_double_plusblas.c(4903): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(4912): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(4991): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(5000): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(15500): warning C4244: “函数”: 从“npy_intp”转换到“long”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(16572): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(27285): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(27294): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(28227): warning C4244: “函数”: 从“npy_intp”转换到“long”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(29628): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(30143): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(30355): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(32655): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(32682): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33029): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33799): warning C4244: “=”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(33837): warning C4244: “=”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(34378): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(35026): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(36607): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(36842): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(37963): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(38068): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(38645): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(39295): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(39907): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(40707): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(41654): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(41725): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(43097): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(43159): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(44520): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(44582): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49832): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49841): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(49850): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(51825): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(51887): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(53837): warning C4244: “函数”: 从“npy_intp”转换到“int”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(56337): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(58088): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59336): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59345): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59354): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59363): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(59375): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(60167): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
cmfrec\cfuns_double_plusblas.c(60841): warning C4244: “=”: 从“npy_intp”转换到“__pyx_t_6cmfrec_14wrapper_double_int_t”,可能丢失数据
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FOR_PYTHON -DUSE_DOUBLE -DNO_FINDBLAS -DAVOID_BLAS_SYR -IC:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\include -Isrc -IC:\Users\dell\AppData\Local\Programs\Python\Python37\include -IC:\Users\dell\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/collective.c /Fobuild\temp.win-amd64-3.7\Release\src/collective.obj /O2 /openmp
collective.c
src/collective.c(837): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(842): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(854): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(858): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(1980): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(2009): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(3856): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(3898): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(3814): warning C4101: “ib”: 未引用的局部变量
src/collective.c(3813): warning C4101: “err”: 未引用的局部变量
src/collective.c(5148): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(5547): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(6157): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7406): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7420): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7446): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7458): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(7498): warning C4244: “=”: 从“size_t”转换到“double”,可能丢失数据
src/collective.c(7518): warning C4244: “=”: 从“size_t”转换到“double”,可能丢失数据
src/collective.c(8042): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8057): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8235): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(8244): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10333): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(10334): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(10502): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10506): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10508): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10509): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10511): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10513): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10515): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10517): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10523): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10525): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10527): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10529): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10531): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10532): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10711): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10714): warning C4018: “>=”: 有符号/无符号不匹配
src/collective.c(10716): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10717): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10719): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10721): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10897): error C3005: “collapse”: OpenMP“parallel for”指令上出现意外的标记
src/collective.c(10901): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(10927): warning C4267: “函数”: 从“size_t”转换到“const int”,可能丢失数据
src/collective.c(10929): error C3005: “collapse”: OpenMP“parallel for”指令上出现意外的标记
src/collective.c(10932): warning C4018: “<”: 有符号/无符号不匹配
src/collective.c(11377): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
src/collective.c(11476): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit status 2`

Message 6 (what included in my cmfrec):
图片

Message 6 (try pip install --no-pep-517 cmfrec):

C:\Users\dell>pip install --no-pep-517 cmfrec

Usage:
pip install [options] [package-index-options] ...
pip install [options] -r [package-index-options] ...
pip install [options] [-e] ...
pip install [options] [-e] ...
pip install [options] <archive url/path> ...

no such option: --no-pep-517

predict_new() for OMF: name 'glob_mean' is not defined

Hi,

I am using the OMF model to recommend users to cold-items. When calling the predict_new() on the trained OMF model I got the following error:

B = self._factors_cold_multiple(U=I, is_I=True)
File "/python3.7/site-packages/cmfrec/init.py", line 5961, in _factors_cold_multiple
glob_mean,
NameError: name 'glob_mean' is not defined

The same code perfectly works for CMF model.

from . import wrapper_double, wrapper_float

import cmfrec
File "D:\Python3.7\lib\site-packages\cmfrec_init_.py", line 1, in
from . import wrapper_double, wrapper_float
ImportError: DLL load failed: 找不到指定的模块。

in python 3.7.9, win10, pycharm

Can't reproduce results from recommender

Every time I refit recommender on the same data set I get slightly different results. Using random_seed inside CMF definition does not solve the problem. I am also including two outputs I get after refitting recommender.

I am using
cmfrec - Version: 0.5.2.2
tensorflow - Version: 1.9.0
numpy - Version: 1.14.3
pandas - Version: 0.23.0
python - 3.6.5
MacOS
Darwin-17.7.0-x86_64-i386-64bit'

Bellow is the code with simulated data

import numpy as np
import pandas as pd
from cmfrec import CMF

## simulating some movie ratings
nusers = 10**2
nitems = 10**2
nobs = 10**2
np.random.seed(1)
ratings = pd.DataFrame({
	'UserId' : np.random.randint(nusers, size=nobs),
	'ItemId' : np.random.randint(nitems, size=nobs),
	'Rating' : np.random.randint(low=1, high=6, size=nobs)
	})

## random product side information
user_dim = 10
user_attributes = pd.DataFrame(np.random.normal(size=(nusers, user_dim)))
user_attributes['UserId'] = np.arange(nusers)
user_attributes = user_attributes.sample(int(nusers/2), replace=False)

item_dim = 5
item_attributes = pd.DataFrame(np.random.normal(size=(nitems, item_dim)))
item_attributes['ItemId'] = np.arange(nitems)
item_attributes = item_attributes.sample(int(nitems/2), replace=False)

## fitting a model and making some recommendations
recommender = CMF(k=20, k_main=3, k_user=2, k_item=1, reg_param=1e-4, random_seed=10)

recommender.fit(ratings=ratings, user_info=user_attributes, item_info=item_attributes,
	cols_bin_user=None, cols_bin_item=None)

recommender.predict(user=[0,0,1], item=[0,1,0])

results I get for two runs on the same data set

Message: b'CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL'
Objective function value: 0.014191
Number of iterations: 456
Number of functions evaluations: 472
Out[1318]: array([3.032462 , 3.3919058, 2.881726 ], dtype=float32)

INFO:tensorflow:Optimization terminated with:
Message: b'CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL'
Objective function value: 0.014157
Number of iterations: 380
Number of functions evaluations: 395
Out[1319]: array([3.207756 , 3.1969616, 2.9189765], dtype=float32)

Getting different scores with using predict_new and predict methods

Hi David,

I was doing some experiments on the Movie-lens data and realised that the predicted scores obtained through the model.predict_new and model.predict are quite different from each other, even for the same user and item. And in general, the scores obtained through predict_new on average are much lower than the ones obtained through predict. Any ideas on why this may occur? Thanks!

In the screenshot, the r1_scores are produced by the model.predict method and r2_scores are produced by the model.predict_new. All of the items are in the training dataset.

image

Ruby Library

Hi David, just wanted to let you know a Ruby library has been released. The ability to add side information and implicit features are both really great!

I was wondering if there's a way to get the same latent factors (model.A_, model.B_) between the Python and C libraries (this would make it easier to confirm everything is implemented correctly). I think the current difference may come from Python generating random values in the Cython code instead of using reset_values here.

Also, I'm having trouble with the Windows DLL. It builds (build code and output) but dumpbin reports no exported symbols. Not sure if you have any ideas here.

Dump of file vendor/cmfrec.dll

File Type: DLL

  Summary

        1000 .data
        1000 .pdata
        1000 .rdata
        1000 .reloc
        1000 .rsrc
        1000 .text

A few other features that would be neat are:

  • similar items (item-item recommendations) and similar users for CMF and CMF_implicit
  • validation set and early stopping options

All that said, great library! Thanks for building it!!

Transforming binary feedback into confidence levels

I am experimenting with different methods to turn implicit feedback into a confidence score per Collaborative Filtering for Implicit Feedback Datasets by Hu, Koren, and Volinsky. I understand your library has the alpha parameter available with CMF_implicit for weighting non-zero entries as well as the apply_log_transf. In the paper they add 1 to every value to represent a minimum level of confidence for every product by every user, even if there had not been an interaction (cui = 1 + alpha*rui). The log scaling method includes both the alpha and epsilon terms, where the confidence score cui = 1 + alpha * log(1+ rui/epsilon).

How would you recommend using the linear and log scaling methods outlined in that paper with cmfrec and recometrics? Is this best done with CMF and an array of weights W and/or biases? If adding 1 to each value like in the formulas would this no longer make the data compatible with recometrics which needs sparse input?

Thanks for the help.

Upstream prematurely closing connection on nginx when using topN method

I'm trying to use cmfrec in a Docker container deployed on AWS using Sagemaker. The container implements a gunicorn server with nginx to respond to inference requests at the Sagemaker endpoint. When testing locally using the Docker container everything appears to run fine - I get predictions and no errors. However, when uploading to AWS and performing inference I get the following error in the logs:

[error] 11#11: *1819 upstream prematurely closed connection while reading response header from upstream, client: xxx.xxx.xxx.2, server: , request: "POST /invocations HTTP/1.1", upstream: "http://unix:/tmp/gunicorn.sock:/invocations", host: "xxx.xxx.xxx.2:8080"

I have tried this with setting the ENV DONT_SET_MARCH=1 as well as without specifying that prior to installing cmfrec in the Docker container. It is using an Ubuntu 18.04 image.

This happens when using the topN method with the trained model. The suggested solutions from AWS are to reduce the latency of the algorithm or increase the container's timeout limit. Increasing the timeout settings did not help in this case.

Please let me know if you have any suggestions.

Thank you for the help.

inconsistent kernel performance

@david-cortes, I am encountering some weird kernel behavior and hoping you can help me figure out why and how to solve this issue.

Quite often when I open my jupyter notebook and read in dataset, then run CFM OR OFM model.fit with the parameters that I previously had tested for successful model converge, I would get ALS procedure failed for CMF or failure message for OMF. But if I make a copy of the notebook and open in a new tab, then both models would converge with the same script and datasets. Also, this happens a lot when I did my parameter tuning for OMF, sometimes in a kernel, no parameter set would work, but in another kernel, the parameter set would work... Is this related with setting random seed? I would really appreciate your help. Thank you so so much!

here is my code:

import pickle
import pandas as pd
import numpy as np

#read in ratings data and item side info

ratings = pickle.load( open( "../CMFREC_dataset/ratings.pkl", "rb" ))

item_side_info = pickle.load( open( "../CMFREC_dataset/item_side_info.pkl", "rb" ))
from sklearn.model_selection import train_test_split

#split item into two set, one for training and one for testing
items_train, items_test = train_test_split(ratings.ItemId.unique(), test_size=0.2, random_state=50)


#=================================
# ratings_test1:users and items which were both in the training data.

ratings_train, ratings_test1 = train_test_split(ratings.loc[ratings.ItemId.isin(items_train)],
                                                test_size=0.2, random_state=123)


item_attr_train = item_side_info.loc[item_side_info.ItemId.isin(items_train)]



#=================================
# ratings_test_2: users which were in the training data and items which were not in the training data.
ratings_test2 = ratings.loc[ratings.ItemId.isin(items_test)]


### Handy usage of Pandas indexing
item_attr_test = item_side_info.set_index("ItemId")
from cmfrec import CMF_explicit

m_collective = CMF_explicit(k=100, w_main=0.5,w_item=0.5,niter=100,user_bias=False, item_bias=False)\
                .fit(X=ratings_train, I=item_attr_train)

Here is where the problems kick in, I often will get ALS procedure failed . But I know for a fact that those parameters had worked before.. and it would work if I open a new notebook...

about topN_cold function

hi, Mr david cortes, i notes that the topN_cold function in cmfrec package allow
"U (array(p,), or None) – User attributes in the new data (1-row only). Should only pass one of ‘U’ or ‘U_col’+’U_val’.
U_bin (array(p_bin,)) – User binary attributes in the new data (1-row only). Missing entries should have value np.nan. Only supported with", does it mean this function can only make cold-start recommendation for one user per time?

Error with wheels during install

using python -m pip install --user cmfrec as my command with pip 20.1 I was doing this on a windows machine and tried to install any dependencies that I thought were missing. Still received the error.

Hope this is useful. If there was something I am missing about this, please let me know.

Error Message below:

Building wheel for cmfrec (PEP 517) ... error
ERROR: Command errored out with exit status 120:
command: 'C:\ProgramData\Anaconda3\python.exe' 'C:\Users\PANDA02-User\AppData\Roaming\Python\Python37\site-packages\pip_vendor\pep517_in_process.py' build_wheel 'C:\Users\PANDA01\AppData\Local\Temp\tmpbjtjyp_p'
cwd: C:\Users\PANDA0
1\AppData\Local\Temp\pip-install-4effq2o\cmfrec
Complete output (77 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\cmfrec
copying cmfrec_init
.py -> build\lib.win-amd64-3.7\cmfrec
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
C:\Users\PANDA01\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\numpy\distutils\system_info.py:1896: UserWarning:
Optimized (vendor) Blas libraries are not found.
Falls back to netlib Blas library which has worse performance.
A better performance should be easily gained by switching
Blas library.
if self._calc_info(blas):
C:\Users\PANDA0
1\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\numpy\distutils\system_info.py:1896: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
if self.calc_info(blas):
C:\Users\PANDA01\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\numpy\distutils\system_info.py:1896: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
if self._calc_info(blas):
Traceback (most recent call last):
File "C:\Users\PANDA02-User\AppData\Roaming\Python\Python37\site-packages\pip_vendor\pep517_in_process.py", line 280, in
main()
File "C:\Users\PANDA02-User\AppData\Roaming\Python\Python37\site-packages\pip_vendor\pep517_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\PANDA02-User\AppData\Roaming\Python\Python37\site-packages\pip_vendor\pep517_in_process.py", line 205, in build_wheel
metadata_directory)
File "C:\Users\PANDA0
1\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\setuptools\build_meta.py", line 213, in build_wheel
wheel_directory, config_settings)
File "C:\Users\PANDA01\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\setuptools\build_meta.py", line 198, in _build_with_temp_dir
self.run_setup()
File "C:\Users\PANDA0
1\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\setuptools\build_meta.py", line 250, in run_setup
self).run_setup(setup_script=setup_script)
File "C:\Users\PANDA01\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\setuptools\build_meta.py", line 143, in run_setup
exec(compile(code, file, 'exec'), locals())
File "setup.py", line 63, in
define_macros = [("_FOR_PYTHON", None)]
File "C:\Users\PANDA0
1\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\setuptools_init
.py", line 144, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\PANDA01\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 223, in run
self.run_command('build')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\PANDA0
1\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "setup.py", line 31, in build_extensions
build_ext_with_blas.build_extensions(self)
File "C:\Users\PANDA0~1\AppData\Local\Temp\pip-build-env-6e0raycy\overlay\Lib\site-packages\findblas\distutils.py", line 28, in build_extensions
raise ValueError(txt)
ValueError: Found MKL library at:
C:/ProgramData/Anaconda3/Library/bin\mkl_rt.dll
However, it is missing .lib files - please install them with 'pip install mkl-devel'.
Exception ignored in: <_io.TextIOWrapper mode='w' encoding='cp1252'>
ValueError: underlying buffer has been detached

ERROR: Failed building wheel for cmfrec
Failed to build cmfrec
ERROR: Could not build wheels for cmfrec which use PEP 517 and cannot be installed directly

(base) C:\Users\PANDA02-User>

swap_users_and_items - unexpected keyword argument 'scale_lam'

When i try to swap users and items i always get an error:

model = CMF_implicit(use_cg=True, w_main=0.7, w_user=10.0, w_item=25.0,
finalize_chol=False, k=100, lambda_=0.01,
niter=15, use_float=True)
model.fit(X=coo, U=A_coo, I=B_coo)
model.swap_users_and_items()

TypeError: init() got an unexpected keyword argument 'scale_lam'

How to predict items for new users based on a implicit CMFREC Model? (R)

Hello,

I'm currently building a recommender system that uses implicit feedback data. Now I want to use the built model to predict the instances in the test data. But I get an error-code:

image

Also I don't quite understand how to predict the TopN-items for multiple instances. With the TopN-function it seems to be only possible to predict the Top-N-items for one user. Is that assumption right? Or if not how do I use the the dataset which includes [SessionID, material_number, Score] to predict the topN-Items for each session?

I really would appreciate help. Thanks in advance,

Daniel


X <- as.coo.matrix(Matrix_model_4@data)

reco_split <- create.reco.train.test(
    X,
    users_test_fraction = 0.2,
    items_test_fraction = 0.3,
    min_pos_test = 2,
    seed = 123
)

X_train <- reco_split$X_train ## Train data for test users
X_test <- reco_split$X_test ## Test data for test users
X_rem <- reco_split$X_rem ## Data to fit the model
users_test <- reco_split$users_test ## IDs of the test users

### Random recommendations (random latent factors)
set.seed(123)
UserFactors_random <- matrix(rnorm(nrow(X_test) * 5), nrow=5)
ItemFactors_random <- matrix(rnorm(ncol(X_test) * 5), nrow=5)

### Non-personalized recommendations
model_baseline <- cmfrec::MostPopular(as.coo.matrix(X_rem), implicit=TRUE)
item_biases <- model_baseline$matrices$item_bias


model_iALS <- CMF_implicit(as.coo.matrix(X_rem), k=16, lambda = 0.1, alpha = 0.01, niter = 16L)

pred_iALS <- predict(model_wrmf, X_test)

topN function for C API

Hey @david-cortes, I'm working on updating the cmfrec Ruby library to 3.4.2 and noticed the topN function is no longer exported. Is there a better method to use for it? From what I can tell, the Python and R libraries still use it, so may be good to add CMFREC_EXPORTABLE to export it as part of the C API (relevant code).

nan predictions for unseen users and items

Hi, I wanted to get your thoughts on returning predictions instead of nan for unseen users and items with predict. I think it could return:

  • unseen user and item: global mean
  • unseen user: global mean + item bias
  • unseen item: global mean + user bias

(could be an option for now to keep backward compatibility)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.