{ "info": { "author": "Sahil Moza", "author_email": "sahil.moza@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "LHS-MDU\n--------\n\nBasics\n======\nThis is a package for generating latin hypercube samples with multi-dimensional uniformity.\n\nTo use, simply do::\n\n >>> import lhsmdu \n >>> k = lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformity \n\nThis will generate a nested list with 2 variables, with 20 samples each.\n\nTo plot and see the difference between Monte Carlo and LHS-MDU sampling for a 2 dimensional system::\n\n >>> l = lhsmdu.createRandomStandardUniformMatrix(2, 20) # Monte Carlo sampling \n >>> import matplotlib.pyplot as plt \n >>> fig = plt.figure() \n >>> ax = fig.gca()\n >>> ax.set_xticks(numpy.arange(0,1,0.1))\n >>> ax.set_yticks(numpy.arange(0,1,0.1))\n >>> plt.scatter(k[0], k[1], col=\"g\", label=\"LHS-MDU\") \n >>> plt.scatter(l[0], l[1], col=\"r\", label=\"MC\") \n >>> plt.grid()\n >>> plt.show() \n\nYou can use the strata generated by the algorithm to sample again, if you so desire. For this, you can do::\n\n >>> m = lhsmdu.resample()\n >>> n = lhsmdu.resample()\n >>> o = lhsmdu.resample()\n\nThis will again generate the same number of samples as before, a nested list with 2 variables, with 20 samples each.\n\nYou can plot these together and see the sampling from the strata::\n\n >>> fig = plt.figure() \n >>> ax = fig.gca()\n >>> ax.set_xticks(numpy.arange(0,1,0.1))\n >>> ax.set_yticks(numpy.arange(0,1,0.1))\n >>> plt.title(\"LHS-MDU\") \n >>> plt.scatter(k[0], k[1], c=\"g\", label=\"sample 1\") \n >>> plt.scatter(m[0], m[1], c=\"r\", label=\"resample 2\") \n >>> plt.scatter(n[0], n[1], c=\"b\", label=\"resample 3\") \n >>> plt.scatter(o[0], o[1], c=\"y\", label=\"resample 4\") \n >>> plt.grid()\n >>> plt.show() \n\nAlternatively, you can choose to get new strata each time, and see the sampling hence::\n\n >>> p = lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformity \n >>> q = lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformity \n >>> r = lhsmdu.sample(2, 20) # Latin Hypercube Sampling with multi-dimensional uniformity \n >>> fig = plt.figure() \n >>> ax = fig.gca()\n >>> ax.set_xticks(numpy.arange(0,1,0.1))\n >>> ax.set_yticks(numpy.arange(0,1,0.1))\n >>> plt.title(\"LHS-MDU\") \n >>> plt.scatter(k[0], k[1], c=\"g\", label=\"sample 1\") \n >>> plt.scatter(p[0], p[1], c=\"r\", label=\"sample 2\") \n >>> plt.scatter(q[0], q[1], c=\"b\", label=\"sample 3\") \n >>> plt.scatter(r[0], r[1], c=\"y\", label=\"sample 4\") \n >>> plt.grid()\n >>> plt.show() \n\n===========================================================================================\n\nSampling from arbitrary CDFs\n=======================\n\nAfter uniformly distributed samples have been generated from LHSMDU, you can convert these to samples from arbitrary distributions using inverse tranform sampling. In this, the CDF [0,1] of the distribution of interest is inverted, and then data points corresponding to the uniformly sampled points are picked up. To do this, you must have a `rv_contiuous` or `rv_discrete` distribution instance taken from scipy.stats. You can also use frozen distributions (after setting loc and scale parameters). Following is an example for normal distribution.::\n\n >>> import scipy.stats.distributions as ssd\n >>> p = ssd.norm\n >>> new_samples = lhsmdu.inverseTransformSample(p, k[0])\n >>> plt.hist(lhsmdu.inverseTransformSample(p, k[0]))\n >>> plt.show()\n\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/sahilm89/lhsmdu", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lhsmdu", "package_url": "https://pypi.org/project/lhsmdu/", "platform": "", "project_url": "https://pypi.org/project/lhsmdu/", "project_urls": { "Homepage": "http://github.com/sahilm89/lhsmdu" }, "release_url": "https://pypi.org/project/lhsmdu/0.1/", "requires_dist": [ "numpy", "scipy" ], "requires_python": "", "summary": "This is an implementation of Latin Hypercube Sampling with Multi-Dimensional Uniformity (LHS-MDU) from Deutsch and Deutsch, \"Latin hypercube sampling with multidimensional uniformity.", "version": "0.1" }, "last_serial": 4944897, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "0c47562d66997658203368a4c4b73846", "sha256": "e94b173b2485ed2728beaed0812b39ed36636903ba8d44cf12c28acada3b779c" }, "downloads": -1, "filename": "lhsmdu-0.1-py2.7.egg", "has_sig": false, "md5_digest": "0c47562d66997658203368a4c4b73846", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 6777, "upload_time": "2019-03-15T16:16:37", "url": "https://files.pythonhosted.org/packages/21/7a/9d91818a73ac0ceb8dc83c72480c8302aa68ccaffa1fe63fef2333db1e39/lhsmdu-0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "8cc401cfafe09912f33180ec945af421", "sha256": "833818903027c655f04fd28b763891a1ef59c3120003fb51a3fdca909aa8fe4c" }, "downloads": -1, "filename": "lhsmdu-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8cc401cfafe09912f33180ec945af421", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5049, "upload_time": "2019-03-15T16:16:35", "url": "https://files.pythonhosted.org/packages/7b/f0/e714a4dae734bcd7228a09d74fff7dc5857dc3311cd72a3e07b09c85d088/lhsmdu-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c62d42af4cb5ce10b4a6562df9a59232", "sha256": "ef462054b354cd20b10c6d80876c8fdb552a8d2e23eaf74179dc91956d68d32a" }, "downloads": -1, "filename": "lhsmdu-0.1.tar.gz", "has_sig": false, "md5_digest": "c62d42af4cb5ce10b4a6562df9a59232", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4177, "upload_time": "2019-03-15T16:16:38", "url": "https://files.pythonhosted.org/packages/4b/dd/52342d9f3cf7bfffa6a30c8a4c8a2b38fcdb7a25634a8a40a29a3b25cbf4/lhsmdu-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0c47562d66997658203368a4c4b73846", "sha256": "e94b173b2485ed2728beaed0812b39ed36636903ba8d44cf12c28acada3b779c" }, "downloads": -1, "filename": "lhsmdu-0.1-py2.7.egg", "has_sig": false, "md5_digest": "0c47562d66997658203368a4c4b73846", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 6777, "upload_time": "2019-03-15T16:16:37", "url": "https://files.pythonhosted.org/packages/21/7a/9d91818a73ac0ceb8dc83c72480c8302aa68ccaffa1fe63fef2333db1e39/lhsmdu-0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "8cc401cfafe09912f33180ec945af421", "sha256": "833818903027c655f04fd28b763891a1ef59c3120003fb51a3fdca909aa8fe4c" }, "downloads": -1, "filename": "lhsmdu-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8cc401cfafe09912f33180ec945af421", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5049, "upload_time": "2019-03-15T16:16:35", "url": "https://files.pythonhosted.org/packages/7b/f0/e714a4dae734bcd7228a09d74fff7dc5857dc3311cd72a3e07b09c85d088/lhsmdu-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c62d42af4cb5ce10b4a6562df9a59232", "sha256": "ef462054b354cd20b10c6d80876c8fdb552a8d2e23eaf74179dc91956d68d32a" }, "downloads": -1, "filename": "lhsmdu-0.1.tar.gz", "has_sig": false, "md5_digest": "c62d42af4cb5ce10b4a6562df9a59232", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4177, "upload_time": "2019-03-15T16:16:38", "url": "https://files.pythonhosted.org/packages/4b/dd/52342d9f3cf7bfffa6a30c8a4c8a2b38fcdb7a25634a8a40a29a3b25cbf4/lhsmdu-0.1.tar.gz" } ] }