Wide (partial Khatri-Rao) sparse matrix product
Project description
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:
wide_product ( [[a]], [[b]] ) == [[a * b]]
Where matrices are constructed by vertical stacking, the product is row-wise:
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:
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
pip install wide-product
Development
To build the module:
python setup.py build
To test:
PYTHONPATH=$(echo build/lib*):. py.test
To install:
pip install .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wide-product-0.0.1.tar.gz
(2.6 kB
view hashes)
Built Distributions
Close
Hashes for wide_product-0.0.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5671fc0d006e521e9cd643b0874f2f43b349b0b0098010432f36d2305eb13fbf |
|
MD5 | f5e242deacebd7e010d982d3a2998d1a |
|
BLAKE2b-256 | 1eb00ce75a1a4d901e0480a6aea61e17fc71e2c575cb8feddad20272aa9beba2 |
Close
Hashes for wide_product-0.0.1-cp27-cp27m-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81640097189665dde091787aaa0ce021cba878dd231b4d9e087b75649fa1f2e0 |
|
MD5 | dbe8064b36f42a0298b12bb17a007df7 |
|
BLAKE2b-256 | bcdb23cebec91e73481131bbaa05a928b09098744259d61c6362d85e03c8b8be |