Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thread/wide-product
Fast column-wise partial Khatri-Rao product
https://github.com/thread/wide-product
Last synced: about 2 months ago
JSON representation
Fast column-wise partial Khatri-Rao product
- Host: GitHub
- URL: https://github.com/thread/wide-product
- Owner: thread
- License: mit
- Created: 2017-04-05T12:52:53.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-18T11:04:09.000Z (about 2 years ago)
- Last Synced: 2024-10-01T14:58:05.640Z (4 months ago)
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 21
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: COPYING
Awesome Lists containing this project
README
wide-product
============`wide-product` implements a partial, column-wise Khatri-Rao product. It is fast,
and works on sparse matrices.It can be useful for engineering of cross-features for machine learning.
Definition
----------For a pair of scalars (~ one by one matrices), the wide product is
multiplication:.. code:: python
wide_product ( [[a]], [[b]] ) == [[a * b]]
Where matrices are constructed by *vertical stacking*, the product is row-wise:
.. code:: python
wide_product ( vstack((A, B)), vstack((C, D)) ) ==
vstack((wide_product(A, C),
wide_product(B, D)))Where matrices are constructed by *horizontal stacking*, the product contains
all the products of the subcomponents up to permutation of columns:.. code:: python
wide_product ( hstack((A, B)), hstack((C, D)) ) ==
hstack((wide_product(A, C),
wide_product(A, D),
wide_product(B, C),
wide_product(B, D)))Installation
------------.. code:: bash
pip install wide-product
Development
-----------To build the module:
.. code:: bash
python setup.py build
To test:
.. code:: bash
PYTHONPATH=$(echo build/lib*):. py.test
To install:
.. code:: bash
pip install .