# Smartnoise Synth Logger
Logger for Smartnoise Synth Transformers
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python](https://img.shields.io/badge/python-3.11-blue)](https://www.python.org/)
[![ci tests](https://github.com/dscc-admin-ch/smartnoise-synth-logger/actions/workflows/tests.yml/badge.svg)](https://github.com/dscc-admin-ch/smartnoise-synth-logger/actions/workflows/tests.yml?query=branch%3Amain)
Serialize and deserialize Smartnoise Synth constraints to and from JSON.
## Installation
Install with pip:
```python
pip install smartnoise-synth-logger
```
## Example
```python
from snsynth.transform import (
AnonymizationTransformer,
BinTransformer,
ChainTransformer,
ClampTransformer,
DropTransformer,
LabelTransformer,
LogTransformer,
MinMaxTransformer,
OneHotEncoder,
StandardScaler,
)
constraints = {
"id": AnonymizationTransformer("uuid4"),
"email": "email", # also possible
"income": ChainTransformer(
[
LogTransformer(),
BinTransformer(bins=20, lower=0, upper=50),
]
),
"height": ChainTransformer(
[
StandardScaler(lower=0, upper=1),
BinTransformer(bins=20, lower=0, upper=1),
]
),
"weight": ChainTransformer(
[ClampTransformer(lower=10, upper=200), BinTransformer(bins=20)]
),
"age": MinMaxTransformer(lower=0, upper=100),
"sex": ChainTransformer(
[LabelTransformer(nullable=True), OneHotEncoder()]
),
"rank": LabelTransformer(nullable=False),
"job": DropTransformer(),
}
```
## Serialise
```python
from smartnoise_synth_logger import serialise_constraints
serialised_constraints = serialise_constraints(constraints)
```
## Deserialise
```python
from smartnoise_synth_logger import deserialise_constraints
deserialised_constraints = deserialise_constraints(serialised_constraints)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/dscc-admin/lomas/",
"name": "smartnoise-synth-logger",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.10",
"maintainer_email": null,
"keywords": "smartnoise-synth, logger, serialiser, deserialiser",
"author": "Data Science Competence Center, Swiss Federal Statistical Office",
"author_email": "dscc@bfs.admin.ch",
"download_url": "https://files.pythonhosted.org/packages/f1/40/506bcf69d5f0b8df64da87d6ec72608e4caa75d10c7a4e5b8e1bfcf28410/smartnoise_synth_logger-0.0.3.tar.gz",
"platform": null,
"description": "# Smartnoise Synth Logger\nLogger for Smartnoise Synth Transformers\n\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python](https://img.shields.io/badge/python-3.11-blue)](https://www.python.org/)\n[![ci tests](https://github.com/dscc-admin-ch/smartnoise-synth-logger/actions/workflows/tests.yml/badge.svg)](https://github.com/dscc-admin-ch/smartnoise-synth-logger/actions/workflows/tests.yml?query=branch%3Amain)\n\nSerialize and deserialize Smartnoise Synth constraints to and from JSON.\n\n## Installation\nInstall with pip:\n```python\npip install smartnoise-synth-logger\n```\n\n## Example\n\n```python\nfrom snsynth.transform import (\n AnonymizationTransformer,\n BinTransformer,\n ChainTransformer,\n ClampTransformer,\n DropTransformer,\n LabelTransformer,\n LogTransformer,\n MinMaxTransformer,\n OneHotEncoder,\n StandardScaler,\n)\n\nconstraints = {\n \"id\": AnonymizationTransformer(\"uuid4\"),\n \"email\": \"email\", # also possible\n \"income\": ChainTransformer(\n [\n LogTransformer(),\n BinTransformer(bins=20, lower=0, upper=50),\n ]\n ),\n \"height\": ChainTransformer(\n [\n StandardScaler(lower=0, upper=1),\n BinTransformer(bins=20, lower=0, upper=1),\n ]\n ),\n \"weight\": ChainTransformer(\n [ClampTransformer(lower=10, upper=200), BinTransformer(bins=20)]\n ),\n \"age\": MinMaxTransformer(lower=0, upper=100),\n \"sex\": ChainTransformer(\n [LabelTransformer(nullable=True), OneHotEncoder()]\n ),\n \"rank\": LabelTransformer(nullable=False),\n \"job\": DropTransformer(),\n}\n```\n\n## Serialise\n```python\nfrom smartnoise_synth_logger import serialise_constraints\n\nserialised_constraints = serialise_constraints(constraints)\n```\n\n## Deserialise\n```python\nfrom smartnoise_synth_logger import deserialise_constraints\n\ndeserialised_constraints = deserialise_constraints(serialised_constraints)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A logger wrapper for Smartnoise Synth Table Transformer",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/dscc-admin/lomas/"
},
"split_keywords": [
"smartnoise-synth",
" logger",
" serialiser",
" deserialiser"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f140506bcf69d5f0b8df64da87d6ec72608e4caa75d10c7a4e5b8e1bfcf28410",
"md5": "480c9e63d48f1b7c74342fe32652d49a",
"sha256": "da67bacfb10c5381847dd6d9e52c3fc24b8128ca64ad423c17026744febfdddc"
},
"downloads": -1,
"filename": "smartnoise_synth_logger-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "480c9e63d48f1b7c74342fe32652d49a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.10",
"size": 6238,
"upload_time": "2024-08-12T08:12:08",
"upload_time_iso_8601": "2024-08-12T08:12:08.571888Z",
"url": "https://files.pythonhosted.org/packages/f1/40/506bcf69d5f0b8df64da87d6ec72608e4caa75d10c7a4e5b8e1bfcf28410/smartnoise_synth_logger-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-12 08:12:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dscc-admin",
"github_project": "lomas",
"github_not_found": true,
"lcname": "smartnoise-synth-logger"
}