A TensorFlow recommendation algorithm and framework in Python.

Overview

TensorRec

A TensorFlow recommendation algorithm and framework in Python.

PyPI version Build Status Gitter chat

NOTE: TensorRec is not under active development

TensorRec will not be receiving any more planned updates. Please feel free to open pull requests -- I am happy to review them.

Thank you for your contributions, support, and usage of TensorRec!

-James Kirk, @jfkirk

For similar tools, check out:

TensorFlow Ranking

Spotlight

LightFM

What is TensorRec?

TensorRec is a Python recommendation system that allows you to quickly develop recommendation algorithms and customize them using TensorFlow.

TensorRec lets you to customize your recommendation system's representation/embedding functions and loss functions while TensorRec handles the data manipulation, scoring, and ranking to generate recommendations.

A TensorRec system consumes three pieces of data: user_features, item_features, and interactions. It uses this data to learn to make and rank recommendations.

For an overview of TensorRec and its usage, please see the wiki.

For more information, and for an outline of this project, please read this blog post.

For an introduction to building recommender systems, please see these slides.

TensorRec System Diagram

Example: Basic usage

import numpy as np
import tensorrec

# Build the model with default parameters
model = tensorrec.TensorRec()

# Generate some dummy data
interactions, user_features, item_features = tensorrec.util.generate_dummy_data(
    num_users=100,
    num_items=150,
    interaction_density=.05
)

# Fit the model for 5 epochs
model.fit(interactions, user_features, item_features, epochs=5, verbose=True)

# Predict scores and ranks for all users and all items
predictions = model.predict(user_features=user_features,
                            item_features=item_features)
predicted_ranks = model.predict_rank(user_features=user_features,
                                     item_features=item_features)

# Calculate and print the recall at 10
r_at_k = tensorrec.eval.recall_at_k(predicted_ranks, interactions, k=10)
print(np.mean(r_at_k))

Quick Start

TensorRec can be installed via pip: pip install tensorrec

Comments
  • Low average precision value

    Low average precision value

    I have a dataset with 12000 users and 500 items, and I used it to build a recommender model by different approaches. With user based collaborative filtering I have precision=0.1, with content based model precision=0.45. I expected to increase the precision value with TensorFlow by obvious reasons, but precision=0.0013, which does not make any sense. I tried your basic_usage code, which generates ratings, user_features and item_features randomly by the function tensorrec.util.generate_dummy_data(), and I see precision=0.003. It makes sense because in this case we don't have any correlations between ratings and user-item features. Please, clarify why real data and random numbers give the same level of precision.

    question 
    opened by vladimir-sevastyanov 15
  • How to design a system with low density?

    How to design a system with low density?

    I have read through (most of) the issues and have the recommendation up and running but the result is not as good as I hoped. I have a few questions looking for your answer. Below is info about my current dataset:

    user_features.shape = (79770, 26035) # avg features/user = 2
    item_features.shape = (21093, 20157) # avg features/item = 4
    interactions.shape = (79770, 21093)
    

    I train with this code, which is similar to your example:

    model = tensorrec.TensorRec()
    model.fit(interactions, user_features, item_features, epochs=1000, verbose=True)
    

    However, my hardware is not powerful enough so I had to picked samples from the full dataset instead of running it in full:

    sample_user_features.shape = (4, 26035)
    sample_interactions.shape = (4, 21093)
    
    predicted_ranks = model.predict_rank(user_features=sample_user_features, item_features=item_features)
    r_at_k = tensorrec.eval.recall_at_k(predicted_ranks, sample_interactions, k=10)
    print(np.mean(r_at_k))
    

    The recall@10 value is 0.00006. I manually inspected the predicted item for these users and it's not good. So my questions are:

    1. I think my avg features/user of 2 and avg features/item of 4 are too small. Do you think so? Should the recommendation works with such low density?
    2. I choose 4 user ids from the dataset and build sample matrix to run the recall. I'm not confident about this step. Is this mathematically and statistically correct?
    3. I understand that you have implemented fit_partial. In my situation, the item features can increase over time. Will fit_partial works with resized matrix?

    Thank you.

    question 
    opened by daohoangson 14
  • TensorFlow version problem

    TensorFlow version problem

    Here is the code I copy from the sample: https://colab.research.google.com/drive/1VPBOMyc9GEUknlK1hgflLHtquaLK3IRg

    I got the following error. I think it is the problem with the tensorflow version, the version on the colab is 1.13.0 I think

      "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-1-beee77fbc4f6> in <module>()
         19 
         20 # # Fit the model for 5 epochs
    ---> 21 model.fit(interactions, user_features, item_features, epochs=5, verbose=True)
         22 
         23 # Predict scores and ranks for all users and all items
    
    /usr/local/lib/python3.6/dist-packages/tensorrec/tensorrec.py in fit(self, interactions, user_features, item_features, epochs, learning_rate, alpha, verbose, user_batch_size, n_sampled_items)
        535                          verbose=verbose,
        536                          user_batch_size=user_batch_size,
    --> 537                          n_sampled_items=n_sampled_items)
        538 
        539     def fit_partial(self, interactions, user_features, item_features, epochs=1, learning_rate=0.1,
    
    /usr/local/lib/python3.6/dist-packages/tensorrec/tensorrec.py in fit_partial(self, interactions, user_features, item_features, epochs, learning_rate, alpha, verbose, user_batch_size, n_sampled_items)
        603             # Numbers of features are either learned at fit time from the shape of these two matrices or specified at
        604             # TensorRec construction and cannot be changed.
    --> 605             self._build_tf_graph(n_user_features=n_user_features, n_item_features=n_item_features)
        606             session.run(tf.global_variables_initializer())
        607 
    
    /usr/local/lib/python3.6/dist-packages/tensorrec/tensorrec.py in _build_tf_graph(self, n_user_features, n_item_features)
        490 
        491         # Record the new node names
    --> 492         self._record_graph_hook_names()
        493 
        494     def fit(self, interactions, user_features, item_features, epochs=100, learning_rate=0.1, alpha=0.00001,
    
    /usr/local/lib/python3.6/dist-packages/tensorrec/tensorrec.py in _record_graph_hook_names(self)
        176             hook = self.__getattribute__(graph_iterator_hook_attr_name)
        177             iterator_resource_name = hook._iterator_resource.name
    --> 178             output_types = hook._output_types
        179             output_shapes = hook._output_shapes
        180             output_classes = hook._output_classes
    
    AttributeError: 'Iterator' object has no attribute '_output_types'```
    bug 
    opened by mabodx 8
  • Equal recommendations for same user features with different actions

    Equal recommendations for same user features with different actions

    I think that with the described architecture a user with the same features but different actions will receive the same recommendations, is this correct?

    I understand that there is a use case for this, but I just want to get things clear in my understanding.

    The only possibility I see is creating a model per user using his/her specific actions.

    Have you think about how to overcome this?

    opened by rragundez 7
  • Importing tests.datasets fails

    Importing tests.datasets fails

    On a fresh install of tensorrec and tf tensorflow==1.8.0 tensorrec==0.25.1

    (prototype) examples❯ python plot_movielens.py tensorrec/git/master

    Traceback (most recent call last): File "plot_movielens.py", line 16, in from test.datasets import get_movielens_100k ImportError: No module named datasets

    pulled down the entire repo and am in the examples directory

    help wanted maintenance 
    opened by nikisix 7
  • question: new user_interactions

    question: new user_interactions

    Hi and thanks for the great project, may be the question was already here but i can not find it . I whold like to implement prediction for some new user with some known interactions on known products . Currently all model functions accept user_features item_features which are identity matrixes for the simple case :

    I can extract the info for some existing user :

    model.predict(user_features=user_features[75], item_features=item_features[100:103]) but i can not do something like this:

    model.predict(user_features=zero vector , item_features=item_features, user_interactions = [
    0 0 0 ... 1 ... 1 
    ] )
    
    

    for the new customer that likes 2 products.

    question 
    opened by martende 6
  • Model Saving

    Model Saving

    Addresses https://github.com/jfkirk/tensorrec/issues/8

    1. Adds methods for saving/loading the TensorRec object and the TensorFlow session behind it.

    2. Adds a test for the saving/loading methods.

    3. Refactors graph hook management to be done with lists of attr/node names. This allows us to quickly strip all hooks from the Python object before serializing it.

    4. Removes many unnecessary graph hooks. A hook was necessary if it was used to power an API function outside of graph construction.

    opened by jfkirk 6
  • WMRB vs WARP

    WMRB vs WARP

    WMRB is supposed to be WARP adapted for a batch setting right? According to my movie lens tests, the difference seems a bit large:

    10D Embeddings, 10 Epochs: WARP p@10: 0.110 WMRB p@10: 0.032

    Test: https://gist.github.com/eggie5/863133def026a1dc0bf43c4ba3faaefd

    Any idea why?

    question 
    opened by eggie5 5
  • Example application check_movielens_losses.py fails when I run it

    Example application check_movielens_losses.py fails when I run it

    When I run the code in check_movielens_losses.py or any other example application, I see the same error message--see the stack trace below:

    Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
    Type "copyright", "credits" or "license" for more information.
    
    IPython 6.2.1 -- An enhanced Interactive Python.
    
    runfile('C:/temp/RecommenderSystems/tensorrec-master/examples/check_movielens_losses.py', wdir='C:/temp/RecommenderSystems/tensorrec-master/examples')
    C:\ProgramData\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
      from ._conv import register_converters as _register_converters
    C:\ProgramData\Anaconda3\lib\site-packages\lightfm\_lightfm_fast.py:9: UserWarning: LightFM was compiled without OpenMP support. Only a single thread will be used.
      warnings.warn('LightFM was compiled without OpenMP support. '
    INFO:root:Processing interaction and feature data
    C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\gradients_impl.py:100: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
      "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
    INFO:root:Beginning fitting
    Traceback (most recent call last):
    
      File "<ipython-input-1-c519eabf3859>", line 1, in <module>
        runfile('C:/temp/RecommenderSystems/tensorrec-master/examples/check_movielens_losses.py', wdir='C:/temp/RecommenderSystems/tensorrec-master/examples')
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
        execfile(filename, namespace)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
        exec(compile(f.read(), filename, 'exec'), namespace)
    
      File "C:/temp/RecommenderSystems/tensorrec-master/examples/check_movielens_losses.py", line 93, in <module>
        fit_kwargs)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorrec\eval.py", line 155, in fit_and_eval
        interactions=train_interactions, **fit_kwargs)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorrec\tensorrec.py", line 539, in fit
        n_sampled_items=n_sampled_items)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorrec\tensorrec.py", line 629, in fit_partial
        feed_dict=feed_dict
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 905, in run
        run_metadata_ptr)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1140, in _run
        feed_dict_tensor, options, run_metadata)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1321, in _do_run
        run_metadata)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1340, in _do_call
        raise type(e)(node_def, op, message)
    
    InvalidArgumentError: 0-th value returned by pyfunc_0 is int32, but expects int64
    	 [[Node: PyFunc = PyFunc[Tin=[DT_INT64, DT_INT64, DT_INT64], Tout=[DT_INT64], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/device:CPU:0"](IteratorGetNext_3:3, IteratorGetNext_2:3, _arg_Placeholder_0_0)]]
    
    Caused by op 'PyFunc', defined at:
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\ipython\start_kernel.py", line 268, in <module>
        main()
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\ipython\start_kernel.py", line 264, in main
        kernel.start()
      File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 478, in start
        self.io_loop.start()
      File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\eventloop\ioloop.py", line 177, in start
        super(ZMQIOLoop, self).start()
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\ioloop.py", line 888, in start
        handler_func(fd_obj, events)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
        return fn(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 440, in _handle_events
        self._handle_recv()
      File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 472, in _handle_recv
        self._run_callback(callback, msg)
      File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 414, in _run_callback
        callback(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
        return fn(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 283, in dispatcher
        return self.dispatch_shell(stream, msg)
      File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 233, in dispatch_shell
        handler(stream, idents, msg)
      File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 399, in execute_request
        user_expressions, allow_stdin)
      File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\ipkernel.py", line 208, in do_execute
        res = shell.run_cell(code, store_history=store_history, silent=silent)
      File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\zmqshell.py", line 537, in run_cell
        return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2728, in run_cell
        interactivity=interactivity, compiler=compiler, result=result)
      File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2856, in run_ast_nodes
        if self.run_code(code, result):
      File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2910, in run_code
        exec(code_obj, self.user_global_ns, self.user_ns)
      File "<ipython-input-1-c519eabf3859>", line 1, in <module>
        runfile('C:/temp/RecommenderSystems/tensorrec-master/examples/check_movielens_losses.py', wdir='C:/temp/RecommenderSystems/tensorrec-master/examples')
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
        execfile(filename, namespace)
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
        exec(compile(f.read(), filename, 'exec'), namespace)
      File "C:/temp/RecommenderSystems/tensorrec-master/examples/check_movielens_losses.py", line 93, in <module>
        fit_kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorrec\eval.py", line 155, in fit_and_eval
        interactions=train_interactions, **fit_kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorrec\tensorrec.py", line 539, in fit
        n_sampled_items=n_sampled_items)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorrec\tensorrec.py", line 607, in fit_partial
        self._build_tf_graph(n_user_features=n_user_features, n_item_features=n_item_features)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorrec\tensorrec.py", line 303, in _build_tf_graph
        Tout=tf.int64)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\script_ops.py", line 330, in py_func
        func=func, inp=inp, Tout=Tout, stateful=stateful, eager=False, name=name)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\script_ops.py", line 231, in _internal_py_func
        input=inp, token=token, Tout=Tout, name=name)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_script_ops.py", line 129, in py_func
        "PyFunc", input=input, token=token, Tout=Tout, name=name)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
        op_def=op_def)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3290, in create_op
        op_def=op_def)
      File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1654, in __init__
        self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access
    
    InvalidArgumentError (see above for traceback): 0-th value returned by pyfunc_0 is int32, but expects int64
    	 [[Node: PyFunc = PyFunc[Tin=[DT_INT64, DT_INT64, DT_INT64], Tout=[DT_INT64], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/device:CPU:0"](IteratorGetNext_3:3, IteratorGetNext_2:3, _arg_Placeholder_0_0)]]
    

    pip freeze:

    (base) C:\Users\user>pip freeze
    absl-py==0.1.13
    alabaster==0.7.10
    anaconda-client==1.6.9
    anaconda-navigator==1.7.0
    anaconda-project==0.8.2
    asn1crypto==0.24.0
    astor==0.6.2
    astroid==1.6.1
    astropy==2.0.3
    attrs==17.4.0
    Babel==2.5.3
    backports.shutil-get-terminal-size==1.0.0
    beautifulsoup4==4.6.0
    bitarray==0.8.1
    bkcharts==0.2
    blaze==0.11.3
    bleach==1.5.0
    bokeh==0.12.13
    boto==2.48.0
    Bottleneck==1.2.1
    certifi==2018.1.18
    cffi==1.11.4
    chardet==3.0.4
    click==6.7
    cloudpickle==0.5.2
    clyent==1.2.2
    colorama==0.3.9
    comtypes==1.1.4
    conda==4.4.10
    conda-build==3.4.1
    conda-verify==2.0.0
    contextlib2==0.5.5
    cryptography==2.1.4
    cycler==0.10.0
    Cython==0.27.3
    cytoolz==0.9.0
    dask==0.16.1
    dataIO==0.0.5
    datashape==0.5.4
    decorator==4.2.1
    distributed==1.20.2
    docutils==0.14
    entrypoints==0.2.3
    et-xmlfile==1.0.1
    fastcache==1.0.2
    filelock==2.0.13
    Flask==0.12.2
    Flask-Cors==3.0.3
    gast==0.2.0
    gevent==1.2.2
    glob2==0.6
    greenlet==0.4.12
    grpcio==1.10.1
    h5py==2.7.1
    heapdict==1.0.0
    html5lib==0.9999999
    idna==2.6
    imageio==2.2.0
    imagesize==0.7.1
    ipython==6.2.1
    ipython-genutils==0.2.0
    ipywidgets==7.1.1
    isort==4.2.15
    itsdangerous==0.24
    jdcal==1.3
    jedi==0.11.1
    Jinja2==2.10
    jsonschema==2.6.0
    jupyter==1.0.0
    jupyter-client==5.2.2
    jupyter-console==5.2.0
    jupyter-core==4.4.0
    jupyterlab==0.31.4
    jupyterlab-launcher==0.10.2
    Keras==2.1.5
    lazy-object-proxy==1.3.1
    lightfm==1.15
    llvmlite==0.21.0
    locket==0.2.0
    lxml==4.1.1
    Markdown==2.6.11
    MarkupSafe==1.0
    matplotlib==2.1.2
    mccabe==0.6.1
    menuinst==1.4.11
    mistune==0.8.3
    mpmath==1.0.0
    msgpack-python==0.5.1
    multipledispatch==0.4.9
    navigator-updater==0.1.0
    nbconvert==5.3.1
    nbformat==4.4.0
    networkx==2.1
    nltk==3.2.5
    normalization==0.4
    nose==1.3.7
    notebook==5.4.0
    numba==0.36.2
    numexpr==2.6.4
    numpy==1.14.0
    numpydoc==0.7.0
    odo==0.5.1
    olefile==0.45.1
    openpyxl==2.4.10
    packaging==16.8
    pandas==0.22.0
    pandocfilters==1.4.2
    parso==0.1.1
    partd==0.3.8
    path.py==10.5
    pathlib2==2.3.0
    patsy==0.5.0
    pep8==1.7.1
    pickleshare==0.7.4
    Pillow==5.0.0
    pkginfo==1.4.1
    pluggy==0.6.0
    ply==3.10
    prompt-toolkit==1.0.15
    protobuf==3.5.2.post1
    psutil==5.4.3
    py==1.5.2
    pycodestyle==2.3.1
    pycosat==0.6.3
    pycparser==2.18
    pycrypto==2.6.1
    pycurl==7.43.0.1
    pyflakes==1.6.0
    Pygments==2.2.0
    pylint==1.8.2
    pymongo==3.6.1
    pyodbc==4.0.22
    pyOpenSSL==17.5.0
    pyparsing==2.2.0
    PySocks==1.6.7
    pytest==3.3.2
    python-dateutil==2.6.1
    pytz==2017.3
    PyWavelets==0.5.2
    pywin32==222
    pywinpty==0.5
    PyYAML==3.12
    pyzmq==16.0.3
    QtAwesome==0.4.4
    qtconsole==4.3.1
    QtPy==1.3.1
    requests==2.18.4
    rope==0.10.7
    ruamel-yaml==0.15.35
    scikit-image==0.13.1
    scikit-learn==0.19.1
    scipy==1.0.0
    seaborn==0.8.1
    Send2Trash==1.4.2
    simplegeneric==0.8.1
    singledispatch==3.4.0.3
    six==1.11.0
    snowballstemmer==1.2.1
    sortedcollections==0.5.3
    sortedcontainers==1.5.9
    Sphinx==1.6.6
    sphinxcontrib-websupport==1.0.1
    spyder==3.2.6
    SQLAlchemy==1.2.1
    statsmodels==0.8.0
    sympy==1.1.1
    tables==3.4.2
    tblib==1.3.2
    tensorboard==1.7.0
    tensorflow==1.7.0
    tensorrec==0.25.3
    termcolor==1.1.0
    terminado==0.8.1
    testpath==0.3.1
    toolz==0.9.0
    tornado==4.5.3
    traitlets==4.3.2
    typing==3.6.2
    unicodecsv==0.14.1
    urllib3==1.22
    wcwidth==0.1.7
    webencodings==0.5.1
    Werkzeug==0.14.1
    widgetsnbextension==3.1.0
    win-inet-pton==1.0.1
    win-unicode-console==0.5
    wincertstore==0.2
    wrapt==1.10.11
    xlrd==1.1.0
    XlsxWriter==1.0.2
    xlwings==0.11.5
    xlwt==1.3.0
    zict==0.1.3
    
    bug 
    opened by vladimir-sevastyanov 5
  • get_book_crossing crashes

    get_book_crossing crashes

    I believe all relevant packages are up to date running on python 3.6.5


    TypeError Traceback (most recent call last) in () 29 train_interactions, test_interactions, user_features, item_features, _ = get_book_crossing(user_indicators=False, 30 item_indicators=True, ---> 31 cold_start_users=True) 32 33 # Establish baseline metrics with random ranks for warm and cold start users

    in get_book_crossing(min_positive_score, min_interactions_per_book, user_indicators, item_indicators, cold_start_users, cold_start_items)

    /usr/local/lib/python3.6/site-packages/sklearn/pipeline.py in fit_transform(self, X, y, **fit_params) 737 delayed(_fit_transform_one)(trans, weight, X, y, 738 **fit_params) --> 739 for name, trans, weight in self._iter()) 740 741 if not result:

    /usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/parallel.py in call(self, iterable) 777 # was dispatched. In particular this covers the edge 778 # case of Parallel used with an exhausted iterator. --> 779 while self.dispatch_one_batch(iterator): 780 self._iterating = True 781 else:

    /usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/parallel.py in dispatch_one_batch(self, iterator) 623 return False 624 else: --> 625 self._dispatch(tasks) 626 return True 627

    /usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/parallel.py in _dispatch(self, batch) 586 dispatch_timestamp = time.time() 587 cb = BatchCompletionCallBack(dispatch_timestamp, len(batch), self) --> 588 job = self._backend.apply_async(batch, callback=cb) 589 self._jobs.append(job) 590

    /usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/_parallel_backends.py in apply_async(self, func, callback) 109 def apply_async(self, func, callback=None): 110 """Schedule a func to be run""" --> 111 result = ImmediateResult(func) 112 if callback: 113 callback(result)

    /usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/_parallel_backends.py in init(self, batch) 330 # Don't delay the application, to avoid keeping the input 331 # arguments in memory --> 332 self.results = batch() 333 334 def get(self):

    /usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/parallel.py in call(self) 129 130 def call(self): --> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items] 132 133 def len(self):

    /usr/local/lib/python3.6/site-packages/sklearn/externals/joblib/parallel.py in (.0) 129 130 def call(self): --> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items] 132 133 def len(self):

    /usr/local/lib/python3.6/site-packages/sklearn/pipeline.py in _fit_transform_one(transformer, weight, X, y, **fit_params) 579 **fit_params): 580 if hasattr(transformer, 'fit_transform'): --> 581 res = transformer.fit_transform(X, y, **fit_params) 582 else: 583 res = transformer.fit(X, y, **fit_params).transform(X)

    /usr/local/lib/python3.6/site-packages/sklearn/pipeline.py in fit_transform(self, X, y, **fit_params) 281 Xt, fit_params = self._fit(X, y, **fit_params) 282 if hasattr(last_step, 'fit_transform'): --> 283 return last_step.fit_transform(Xt, y, **fit_params) 284 elif last_step is None: 285 return Xt

    TypeError: fit_transform() takes 2 positional arguments but 3 were given

    bug maintenance 
    opened by borisrev 5
  • Add API to retrieve projected user/item biases

    Add API to retrieve projected user/item biases

    Could be useful to examine item biases, for example.

    • [ ] Add predict_user_bias and predict_item_bias API method to TensorRec
    • [ ] Add hooks to projected_user_biases and projected_item_biases in TensorRec that can be used by the new API and for saving/loading
    • [ ] Add tests for the new prediction methods
    enhancement good first issue 
    opened by jfkirk 5
  • Bump pillow from 5.0.0 to 9.3.0

    Bump pillow from 5.0.0 to 9.3.0

    Bumps pillow from 5.0.0 to 9.3.0.

    Release notes

    Sourced from pillow's releases.

    9.3.0

    https://pillow.readthedocs.io/en/stable/releasenotes/9.3.0.html

    Changes

    ... (truncated)

    Changelog

    Sourced from pillow's changelog.

    9.3.0 (2022-10-29)

    • Limit SAMPLESPERPIXEL to avoid runtime DOS #6700 [wiredfool]

    • Initialize libtiff buffer when saving #6699 [radarhere]

    • Inline fname2char to fix memory leak #6329 [nulano]

    • Fix memory leaks related to text features #6330 [nulano]

    • Use double quotes for version check on old CPython on Windows #6695 [hugovk]

    • Remove backup implementation of Round for Windows platforms #6693 [cgohlke]

    • Fixed set_variation_by_name offset #6445 [radarhere]

    • Fix malloc in _imagingft.c:font_setvaraxes #6690 [cgohlke]

    • Release Python GIL when converting images using matrix operations #6418 [hmaarrfk]

    • Added ExifTags enums #6630 [radarhere]

    • Do not modify previous frame when calculating delta in PNG #6683 [radarhere]

    • Added support for reading BMP images with RLE4 compression #6674 [npjg, radarhere]

    • Decode JPEG compressed BLP1 data in original mode #6678 [radarhere]

    • Added GPS TIFF tag info #6661 [radarhere]

    • Added conversion between RGB/RGBA/RGBX and LAB #6647 [radarhere]

    • Do not attempt normalization if mode is already normal #6644 [radarhere]

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Question - install of tensorrec only once

    Question - install of tensorrec only once

    • pip install tensorrec takes forever to complete install
    • do I need to install each time, on say, a kaggle notebook

    Please respond at the earliest as I need to use tensorrec for a recommender system

    opened by pankaja0285 0
  • Update input_utils.py

    Update input_utils.py

    Hello,this issue shows the reason that I commit this PR. I sincerely wish my PR will help you.And if you think my PR has a little work,Hoping you could merge it. Thank you,my friend.

    opened by DLPerf 0
  • Performance issues in the program

    Performance issues in the program

    Hello,I found a performance issue in the definition of create_tensorrec_dataset_from_tfrecord , jfkirk/tensorrec/blob/master/tensorrec/input_utils.py, tf.data.TFRecordDataset(tfrecord_path).map was called without num_parallel_calls. I think it will increase the efficiency of your program if you add this.

    Here is the documemtation of tensorflow to support this thing.

    Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.

    opened by DLPerf 0
  • About users Features matrix

    About users Features matrix

    Hello , Great work on Tensorrec . For my use case i have both items as well as users features so can i initialize these Features to the hybrid model instead of initializing it with identity matrix.

    opened by pranav318 0
  • module 'tensorflow' has no attribute 'get_default_session'

    module 'tensorflow' has no attribute 'get_default_session'

    I installed tensorrec in brand new Virtualenv and stuck here.

    \lib\site-packages\tensorrec\session_management.py in get_session() 10 if _session is None: ---> 11 if tf.get_default_session() is not None: 12 _session = tf.get_default_session() 13 else:

    AttributeError: module 'tensorflow' has no attribute 'get_default_session'

    installed tensorflow 2.0.4 version

    opened by abhiHunts 3
Owner
James Kirk
Machine Learning @ Spotify, Recommendations, Personalization. Formerly Quantopian, Amazon Robotics.
James Kirk
A Python implementation of LightFM, a hybrid recommendation algorithm.

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

Lyst 4.2k Jan 2, 2023
ToR[e]cSys is a PyTorch Framework to implement recommendation system algorithms

ToR[e]cSys is a PyTorch Framework to implement recommendation system algorithms, including but not limited to click-through-rate (CTR) prediction, learning-to-ranking (LTR), and Matrix/Tensor Embedding. The project objective is to develop a ecosystem to experiment, share, reproduce, and deploy in real world in a smooth and easy way (Hope it can be done).

LI, Wai Yin 90 Oct 8, 2022
A framework for large scale recommendation algorithms.

A framework for large scale recommendation algorithms.

Alibaba Group - PAI 880 Jan 3, 2023
Books Recommendation With Python

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

Çağrı Karadeniz 7 Mar 12, 2022
Persine is an automated tool to study and reverse-engineer algorithmic recommendation systems.

Persine, the Persona Engine Persine is an automated tool to study and reverse-engineer algorithmic recommendation systems. It has a simple interface a

Jonathan Soma 87 Nov 29, 2022
An open source movie recommendation WebApp build by movie buffs and mathematicians that uses cosine similarity on the backend.

Movie Pundit Find your next flick by asking the (almost) all-knowing Movie Pundit Jump to Project Source » View Demo · Report Bug · Request Feature Ta

Kapil Pramod Deshmukh 8 May 28, 2022
Recommendation System to recommend top books from the dataset

recommendersystem Recommendation System to recommend top books from the dataset Introduction The recom.py is the main program code. The dataset is als

Vishal karur 1 Nov 15, 2021
Implementation of a hadoop based movie recommendation system

Implementation-of-a-hadoop-based-movie-recommendation-system 通过编写代码,设计一个基于Hadoop的电影推荐系统,通过此推荐系统的编写,掌握在Hadoop平台上的文件操作,数据处理的技能。windows 10 hadoop 2.8.3 p

汝聪(Ricardo) 5 Oct 2, 2022
Bert4rec for news Recommendation

News-Recommendation-system-using-Bert4Rec-model Bert4rec for news Recommendation

saran pandian 2 Feb 4, 2022
QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

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

Yu 1.4k Dec 27, 2022
Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk

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

Spotify 10.6k Jan 1, 2023
A Python scikit for building and analyzing recommender systems

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

Nicolas Hug 5.7k Jan 1, 2023
Fast Python Collaborative Filtering for Implicit Feedback Datasets

Implicit Fast Python Collaborative Filtering for Implicit Datasets. This project provides fast Python implementations of several different popular rec

Ben Frederickson 3k Dec 31, 2022
EXEMPLO DE SISTEMA ESPECIALISTA PARA RECOMENDAR SERIADOS EM PYTHON

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

Josue Lopes 3 Aug 31, 2021
E-Commerce recommender demo with real-time data and a graph database

?? E-Commerce recommender demo ?? This is a simple stream setup that uses Memgraph to ingest real-time data from a simulated online store. Data is str

g-despot 3 Feb 23, 2022
A TensorFlow recommendation algorithm and framework in Python.

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

James Kirk 1.2k Jan 4, 2023
Genetic Algorithm, Particle Swarm Optimization, Simulated Annealing, Ant Colony Optimization Algorithm,Immune Algorithm, Artificial Fish Swarm Algorithm, Differential Evolution and TSP(Traveling salesman)

scikit-opt Swarm Intelligence in Python (Genetic Algorithm, Particle Swarm Optimization, Simulated Annealing, Ant Colony Algorithm, Immune Algorithm,A

郭飞 3.7k Jan 3, 2023
Genetic Algorithm, Particle Swarm Optimization, Simulated Annealing, Ant Colony Optimization Algorithm,Immune Algorithm, Artificial Fish Swarm Algorithm, Differential Evolution and TSP(Traveling salesman)

scikit-opt Swarm Intelligence in Python (Genetic Algorithm, Particle Swarm Optimization, Simulated Annealing, Ant Colony Algorithm, Immune Algorithm,A

郭飞 3.7k Jan 1, 2023
Elliot is a comprehensive recommendation framework that analyzes the recommendation problem from the researcher's perspective.

Comprehensive and Rigorous Framework for Reproducible Recommender Systems Evaluation

Information Systems Lab @ Polytechnic University of Bari 215 Nov 29, 2022
Recommendationsystem - Movie-recommendation - matrixfactorization colloborative filtering recommendation system user

recommendationsystem matrixfactorization colloborative filtering recommendation

kunal jagdish madavi 1 Jan 1, 2022