{ "info": { "author": "Jeff Hetherly", "author_email": "jeffrey.hetherly@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "|Build Status|\n\n`sparse\\_linear\\_binning: linear binning (optimized for sparsity) `__\n=========================================================================================================================\n\nPerforms a linear binning technique described in `Wand and\nJones `__\non a regularly-spaced grid in an arbitrary number of dimensions. The\n`asymptotic\nbehavior `__\nof this binning technique performs better than so-called simple binning\n(i.e. as in histograms). Each data point in ``d``-dimensional space must\nhave an associated weight (for equally weighted points just use a weight\nof ``1.0`` for each point).\n\nFor example, within a (segment of a) 2D grid with corners A, B, C, and D\nand a 2D data point P with weight wP:\n\n::\n\n A-----------------------------------B\n | | |\n | |\n | | |\n |- - - - P- - - - - - - - - - - - - |\n | | |\n D-----------------------------------C\n\n- Assign a weight to corner A of the proportion of area between P and C\n (times wP)\n- Assign a weight to corner B of the proportion of area between P and D\n (times wP)\n- Assign a weight to corner C of the proportion of area between P and A\n (times wP)\n- Assign a weight to corner D of the proportion of area between P and B\n (times wP)\n\nNote that the under- and overflow bins need to be accounted for when\nspecifying the numbers of grid points in each dimension (grid points act\nas bin centers). For instance, if you want grid points in steps of 0.1\nin a range of [0,1] (i.e. (0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1)),\nspecify the number of grid points to be 11. Internally, the grid points\nare stored in a high performance, C++-based hash table\n(`sparsepp `__). This allows for\nfiner binning in some circumstances because the hash table doesn't\nallocates memory for grid points with near-zero weight. To accommodate\narbitrary numbers of bins along each dimension, an arbitrary precision\nnumeric library (`boost\nmultiprecision `__)\nmay be used internally and will negatively impact performance. If this\ndegradation in performance is unacceptable, consider reducing the number\nof grid points in such a way that the product of grid points in all\ndimensions is less than the numeric maximum of \"unsigned long long\" on\nyour system. For instance, in 20 dimenisons with each dimension having\n51 grid points gives a total of 14171098670753043575626125424226001\npotential grid points at which point the arbitrary precision library\nmust take care of all arithmetic related to determining grid points.\n\nQuickstart\n----------\n\n- pip install sparse\\_linear\\_binning\n\nor\n\n- git clone https://github.com/jhetherly/sparse\\_linear\\_binning\n- cd sparse\\_linear\\_binning\n- python setup.py install\n\nExample\n-------\n\nThis constructs one million random 2D points in the unit square with\nrandom weights and constructs a grid of ``51`` by ``51`` (can be\ndifferent along different dimensions) linearly binned \"bin centers.\" The\nboundaries of the grid of bin centers are specified by ``extents`` and\ncan be thought of as the under- and overflow bins (i.e. these are the\ncoordinates of the first and last bin centers).\n\n.. code:: python\n\n from sparse_linear_binning import sparse_linear_binning\n import numpy as np\n\n # generate one million random 2D points and weights\n # (should take less than a second to bin)\n n_samples=1000000\n D=2\n\n # coordinates, weights, and extents must be of type \"double\"\n sample_coords = np.random.random(size=(n_samples, D))\n sample_weights = np.random.random(size=n_samples)\n extents = np.tile([0., 1.], D).reshape((D, 2))\n n_bins = np.full(D, 51)\n\n coords, weights = sparse_linear_binning(sample_coords, sample_weights,\n extents, n_bins)\n\n # check that weights on grid match original weights\n print(np.allclose(weights.sum(), sample_weights.sum()))\n\nDependencies\n------------\n\n- numpy\n\n.. |Build Status| image:: https://travis-ci.org/jhetherly/sparse_linear_binning.svg?branch=master\n :target: https://travis-ci.org/jhetherly/sparse_linear_binning\n\n# 1.1.0\n\n* Added support for automatically converting Numpy arrays to proper d-types.\n* Added more explicit tests.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jhetherly/sparse_linear_binning", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sparse_linear_binning", "package_url": "https://pypi.org/project/sparse_linear_binning/", "platform": "any", "project_url": "https://pypi.org/project/sparse_linear_binning/", "project_urls": { "Homepage": "https://github.com/jhetherly/sparse_linear_binning" }, "release_url": "https://pypi.org/project/sparse_linear_binning/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Python function for performing a linear binning that is optimized for sparsity", "version": "1.1.0" }, "last_serial": 3226744, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "3f71ca70fb37b7d02e2e76d6913c0316", "sha256": "25648f7e150a74ddb8f2c0026e5e9cea991428809ef9559fc84230f7e6c6d2a8" }, "downloads": -1, "filename": "sparse_linear_binning-1.0.0.tar.gz", "has_sig": false, "md5_digest": "3f71ca70fb37b7d02e2e76d6913c0316", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 962297, "upload_time": "2017-01-23T19:44:33", "url": "https://files.pythonhosted.org/packages/85/f6/d1b61d7ac30ad465d76c7bb6d67b1c5b5a13cd6633248ad2a338bfc82e29/sparse_linear_binning-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "19b2310ed67ad372e9d2b862799608ae", "sha256": "e8083a3cdc1e9e974b9ce9bf73c614001cbe32255723d692cfa641e475475a9e" }, "downloads": -1, "filename": "sparse_linear_binning-1.0.1.tar.gz", "has_sig": false, "md5_digest": "19b2310ed67ad372e9d2b862799608ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 966400, "upload_time": "2017-01-23T22:36:46", "url": "https://files.pythonhosted.org/packages/91/f3/c75870a21f14dbc0115b24d18195cf0c2a0cc4601930e3237c2b0b96f44c/sparse_linear_binning-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "43679e1d26d0cf96afdf47bd7056bbc8", "sha256": "9b8f2df4faaac4e31bd539eecae258ea5520f1f65cf9822d54adeedf3c91ef61" }, "downloads": -1, "filename": "sparse_linear_binning-1.0.2.tar.gz", "has_sig": false, "md5_digest": "43679e1d26d0cf96afdf47bd7056bbc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 966940, "upload_time": "2017-01-24T16:32:51", "url": "https://files.pythonhosted.org/packages/c1/09/3aab502be989c59828179515552194eb3dfdbf3f68c0ccec8f5587ba7322/sparse_linear_binning-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "73bfd19973feb5d7705f9ac2c9768e55", "sha256": "bdf33e1b799b66c53b057647f3ddd09dcd898be79b52f516247843f499615f46" }, "downloads": -1, "filename": "sparse_linear_binning-1.1.0.tar.gz", "has_sig": false, "md5_digest": "73bfd19973feb5d7705f9ac2c9768e55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1315678, "upload_time": "2017-10-05T01:06:31", "url": "https://files.pythonhosted.org/packages/27/88/c9e113c4428b0c105c3e94f947180d1f2a09a0a7a662902a0eebba8a905d/sparse_linear_binning-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "73bfd19973feb5d7705f9ac2c9768e55", "sha256": "bdf33e1b799b66c53b057647f3ddd09dcd898be79b52f516247843f499615f46" }, "downloads": -1, "filename": "sparse_linear_binning-1.1.0.tar.gz", "has_sig": false, "md5_digest": "73bfd19973feb5d7705f9ac2c9768e55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1315678, "upload_time": "2017-10-05T01:06:31", "url": "https://files.pythonhosted.org/packages/27/88/c9e113c4428b0c105c3e94f947180d1f2a09a0a7a662902a0eebba8a905d/sparse_linear_binning-1.1.0.tar.gz" } ] }