# 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-binning",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "binning mixturemapping",
"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": [
"binning",
"mixturemapping"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c5cd52526ef5f21b043f10ef47578fec0a2a625784f38e8af9579d9b3fafcb4f",
"md5": "8d990942ee9a964def947e1370ee4882",
"sha256": "3339ce6c0e6da39151adfd3f5009d102a97fa71488fa9de3906a9ea33dbb4123"
},
"downloads": -1,
"filename": "mixturemapping_binning-0.5.5-py310-none-any.whl",
"has_sig": false,
"md5_digest": "8d990942ee9a964def947e1370ee4882",
"packagetype": "bdist_wheel",
"python_version": "py310",
"requires_python": ">=3.7",
"size": 36156,
"upload_time": "2024-05-21T13:07:42",
"upload_time_iso_8601": "2024-05-21T13:07:42.469452Z",
"url": "https://files.pythonhosted.org/packages/c5/cd/52526ef5f21b043f10ef47578fec0a2a625784f38e8af9579d9b3fafcb4f/mixturemapping_binning-0.5.5-py310-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2d3444d002e166fb3f3f1b6e7292eaad7175eb4e41cc16aefad8407f5259f01e",
"md5": "886488458b00125a1cb111ae8cd16974",
"sha256": "7a3b89d918e52d8aca32a1084f50318c7c0252b58a4a8834fa50d8086e2f7fa0"
},
"downloads": -1,
"filename": "mixturemapping_binning-0.5.5-py311-none-any.whl",
"has_sig": false,
"md5_digest": "886488458b00125a1cb111ae8cd16974",
"packagetype": "bdist_wheel",
"python_version": "py311",
"requires_python": ">=3.7",
"size": 36157,
"upload_time": "2024-05-21T13:07:43",
"upload_time_iso_8601": "2024-05-21T13:07:43.732921Z",
"url": "https://files.pythonhosted.org/packages/2d/34/44d002e166fb3f3f1b6e7292eaad7175eb4e41cc16aefad8407f5259f01e/mixturemapping_binning-0.5.5-py311-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8c4dee16a7af16e6e2374c6db4f7ac619ba7b59948ef9cffc96bff23e6a092ec",
"md5": "7a86e86e5cb9553170e8c5b8cbd6a7f0",
"sha256": "8d40d3be8b0c862a058db431655802091eafa564708a1e8fc976037c290f112e"
},
"downloads": -1,
"filename": "mixturemapping_binning-0.5.5-py39-none-any.whl",
"has_sig": false,
"md5_digest": "7a86e86e5cb9553170e8c5b8cbd6a7f0",
"packagetype": "bdist_wheel",
"python_version": "py39",
"requires_python": ">=3.7",
"size": 36186,
"upload_time": "2024-05-21T13:07:45",
"upload_time_iso_8601": "2024-05-21T13:07:45.751475Z",
"url": "https://files.pythonhosted.org/packages/8c/4d/ee16a7af16e6e2374c6db4f7ac619ba7b59948ef9cffc96bff23e6a092ec/mixturemapping_binning-0.5.5-py39-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-21 13:07:42",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mixturemapping-binning"
}