Skip to main content

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.


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)))


pip install wide-product


To build the module:

python build

To test:

PYTHONPATH=$(echo build/lib*):. py.test

To install:

pip install .

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
wide_product-0.0.1-cp27-cp27m-macosx_10_11_x86_64.whl (10.7 kB) Copy SHA256 hash SHA256 Wheel cp27 Apr 21, 2017
wide_product-0.0.1-cp27-cp27mu-manylinux1_x86_64.whl (20.7 kB) Copy SHA256 hash SHA256 Wheel cp27 Apr 21, 2017
wide-product-0.0.1.tar.gz (2.6 kB) Copy SHA256 hash SHA256 Source None Apr 21, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page