# MixtureMapping
[![Documentation](https://github.com/VK/dash-express-components/workflows/Publish%20release/badge.svg)](https://vk.github.io/mixturemapping-doc)
[![PyPI version](https://badge.fury.io/py/mixturemapping.svg)](https://badge.fury.io/py/mixturemapping)
Train Gaussian Mixture Mappings
## Provides:
1. Layers to build tensorflow models to map Gaussian mixtures
2. Tools to compute yield values of Gaussian mixtures in complex binning schemes
## Example
import mixturemapping as mm
import tensorflow as tf
inMeans = tf.keras.Input(shape=(mixN, inputMixM), name="Means", dtype=dataType)
inStdDevs = tf.keras.Input(shape=(mixN, inputMixM), name="StdDevs", dtype=dataType)
inWeight = tf.keras.Input(shape=(mixN), name="Weights", dtype=dataType)
mapModel = tf.keras.Sequential()
mapModel.add( tf.keras.layers.Dense(40, activation="relu", kernel_regularizer=regularizers.l2(0.001)) )
mapModel.add( tf.keras.layers.Dense(40, activation="relu", kernel_regularizer=regularizers.l2(0.001)) )
mapModel.add( tf.keras.layers.Dense(outputMixM))
y = mapModel(inMeans)
deltaModel = tf.keras.Sequential()
deltaModel.add( tf.keras.layers.Dense(40, activation="relu", kernel_regularizer=regularizers.l2(0.001)) )
deltaModel.add( tf.keras.layers.Dense(40, activation="relu", kernel_regularizer=regularizers.l2(0.001)) )
deltaModel.add( tf.keras.layers.Dense(outputMixM))
yDelta = deltaModel(inMeans)
covALayer = mm.layers.TrainableCovMatrix(outputMixM, name="CovA")
covA = covALayer(inMeans)
mapLayer = mm.layers.GeneralMapping(outputMixM, name="Mapping", dtype=dataType)
newDist = mapLayer({'means': inMeans, 'y':y, 'yDelta':yDelta, 'stdDevs': inStdDevs, 'weights': inWeight, 'covA': covA})
distLayer = mm.layers.Distribution(dtype=dataType, regularize_cov_epsilon=0.95)
dist = distLayer(newDist)
### Developement
```
$ py -m venv env
$ .\env\Scripts\activate
$ pip install -r requirements.txt
```
Raw data
{
"_id": null,
"home_page": "https://vk.github.io/mixturemapping-doc/",
"name": "mixturemapping",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "tensorflow distributions gaussian mixtures",
"author": null,
"author_email": null,
"download_url": null,
"platform": null,
"description": "# MixtureMapping\n\n[![Documentation](https://github.com/VK/dash-express-components/workflows/Publish%20release/badge.svg)](https://vk.github.io/mixturemapping-doc)\n[![PyPI version](https://badge.fury.io/py/mixturemapping.svg)](https://badge.fury.io/py/mixturemapping)\n\nTrain Gaussian Mixture Mappings\n\n\n## Provides:\n 1. Layers to build tensorflow models to map Gaussian mixtures\n 2. Tools to compute yield values of Gaussian mixtures in complex binning schemes\n\n## Example\n \n import mixturemapping as mm \n import tensorflow as tf\n\n inMeans = tf.keras.Input(shape=(mixN, inputMixM), name=\"Means\", dtype=dataType)\n inStdDevs = tf.keras.Input(shape=(mixN, inputMixM), name=\"StdDevs\", dtype=dataType)\n inWeight = tf.keras.Input(shape=(mixN), name=\"Weights\", dtype=dataType)\n\n mapModel = tf.keras.Sequential()\n mapModel.add( tf.keras.layers.Dense(40, activation=\"relu\", kernel_regularizer=regularizers.l2(0.001)) )\n mapModel.add( tf.keras.layers.Dense(40, activation=\"relu\", kernel_regularizer=regularizers.l2(0.001)) )\n mapModel.add( tf.keras.layers.Dense(outputMixM))\n y = mapModel(inMeans)\n\n deltaModel = tf.keras.Sequential()\n deltaModel.add( tf.keras.layers.Dense(40, activation=\"relu\", kernel_regularizer=regularizers.l2(0.001)) )\n deltaModel.add( tf.keras.layers.Dense(40, activation=\"relu\", kernel_regularizer=regularizers.l2(0.001)) )\n deltaModel.add( tf.keras.layers.Dense(outputMixM))\n yDelta = deltaModel(inMeans)\n\n covALayer = mm.layers.TrainableCovMatrix(outputMixM, name=\"CovA\")\n covA = covALayer(inMeans)\n\n mapLayer = mm.layers.GeneralMapping(outputMixM, name=\"Mapping\", dtype=dataType)\n newDist = mapLayer({'means': inMeans, 'y':y, 'yDelta':yDelta, 'stdDevs': inStdDevs, 'weights': inWeight, 'covA': covA})\n\n distLayer = mm.layers.Distribution(dtype=dataType, regularize_cov_epsilon=0.95)\n dist = distLayer(newDist)\n\n### Developement\n```\n$ py -m venv env\n$ .\\env\\Scripts\\activate\n$ pip install -r requirements.txt\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.5.5",
"project_urls": {
"Homepage": "https://vk.github.io/mixturemapping-doc/"
},
"split_keywords": [
"tensorflow",
"distributions",
"gaussian",
"mixtures"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "518b475061f4f429422f8692cb5bc153f4e6c01a9330e7eb1a011636de691caa",
"md5": "a3d0cf6f97f9150137f0e21dffeb63a0",
"sha256": "688f513978677fa5955cdc5cce11ca7db54b8617cc482d4fe0dc5de0f0d5d098"
},
"downloads": -1,
"filename": "mixturemapping-0.5.5-py310-none-any.whl",
"has_sig": false,
"md5_digest": "a3d0cf6f97f9150137f0e21dffeb63a0",
"packagetype": "bdist_wheel",
"python_version": "py310",
"requires_python": ">=3.7",
"size": 21494,
"upload_time": "2024-05-21T13:10:46",
"upload_time_iso_8601": "2024-05-21T13:10:46.221407Z",
"url": "https://files.pythonhosted.org/packages/51/8b/475061f4f429422f8692cb5bc153f4e6c01a9330e7eb1a011636de691caa/mixturemapping-0.5.5-py310-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ab138a434f90f9dbd8b0375133eaa7bd9e5881698094866ff260059d432ea046",
"md5": "691e5d8b23bce5bf029420571cd62315",
"sha256": "9bbdc6c5a8e369ea3e1163d36cca64fb45e52e02a3c0e78d80e9a5e7f453c0d5"
},
"downloads": -1,
"filename": "mixturemapping-0.5.5-py311-none-any.whl",
"has_sig": false,
"md5_digest": "691e5d8b23bce5bf029420571cd62315",
"packagetype": "bdist_wheel",
"python_version": "py311",
"requires_python": ">=3.7",
"size": 21495,
"upload_time": "2024-05-21T13:10:47",
"upload_time_iso_8601": "2024-05-21T13:10:47.460701Z",
"url": "https://files.pythonhosted.org/packages/ab/13/8a434f90f9dbd8b0375133eaa7bd9e5881698094866ff260059d432ea046/mixturemapping-0.5.5-py311-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "47ef04a94fb920f81448eb030adaa93e3118523554d106743b461668062b6b9e",
"md5": "0b4044487817d243e4711c4f7ac84f0d",
"sha256": "e1b02a01fddc4591f43ca816b8f362b135f4c7d97e26ff7d6d9ead2e920e317b"
},
"downloads": -1,
"filename": "mixturemapping-0.5.5-py39-none-any.whl",
"has_sig": false,
"md5_digest": "0b4044487817d243e4711c4f7ac84f0d",
"packagetype": "bdist_wheel",
"python_version": "py39",
"requires_python": ">=3.7",
"size": 21521,
"upload_time": "2024-05-21T13:10:48",
"upload_time_iso_8601": "2024-05-21T13:10:48.721512Z",
"url": "https://files.pythonhosted.org/packages/47/ef/04a94fb920f81448eb030adaa93e3118523554d106743b461668062b6b9e/mixturemapping-0.5.5-py39-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-21 13:10:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mixturemapping"
}