# mmd-critic
[](https://github.com/yourusername/mmd-critic/blob/main/LICENSE)
A Python package for implementing the Maximum Mean Discrepancy Critic (MMD-Critic) method. This method is commonly used to find prototypes and criticisms (outliers, roughly speaking) in datasets.
## Installation
You can install the package via pip:
```bash
pip install mmd-critic
```
## Usage
```python
from mmd_critic import MMDCritic
from mmd_critic.kernels import RBFKernel
critic = MMDCritic(X, RBFKernel(sigma=1), criticism_kernel=RBFKernel(2), labels=y)
protos, proto_labels = critic.select_prototypes(50)
criticisms, criticism_labels = critic.select_criticisms(10, protos)
```
Note that the labels and criticism_kernel are optional arguments which are None by default. If `criticism_kernel`
is none, then the prototype kernel will be used for criticisms. If labels are none, then returned labels will be None.
See more in the [examples](https://github.com/PhysBoom/mmd_critic/tree/main/examples)
## More Info
Read my [article](https://medium.com/@physboom/the-mmd-critic-method-explained-c6a77f2dbf18) for more info on the MMD critic method. I also encourage you to read the original [paper](https://papers.nips.cc/paper_files/paper/2016/hash/5680522b8e2bb01943234bce7bf84534-Abstract.html).
## Acknowledgements
The implementation here is based on Been Kim's [original implementation](https://github.com/BeenKim/MMD-critic/tree/master) and [paper](https://papers.nips.cc/paper_files/paper/2016/hash/5680522b8e2bb01943234bce7bf84534-Abstract.html)
Raw data
{
"_id": null,
"home_page": "https://github.com/PhysBoom/mmd_critic",
"name": "mmd-critic",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Matthew Chak",
"author_email": "mchak@calpoly.edu",
"download_url": "https://files.pythonhosted.org/packages/3e/35/934bbcb8930616e95c1f46f85a209659f6ec25c328c8eb20f90297a449db/mmd_critic-0.1.2.tar.gz",
"platform": null,
"description": "# mmd-critic\r\n\r\n[](https://github.com/yourusername/mmd-critic/blob/main/LICENSE)\r\n\r\nA Python package for implementing the Maximum Mean Discrepancy Critic (MMD-Critic) method. This method is commonly used to find prototypes and criticisms (outliers, roughly speaking) in datasets.\r\n\r\n## Installation\r\n\r\nYou can install the package via pip:\r\n\r\n```bash\r\npip install mmd-critic\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom mmd_critic import MMDCritic\r\nfrom mmd_critic.kernels import RBFKernel\r\n\r\ncritic = MMDCritic(X, RBFKernel(sigma=1), criticism_kernel=RBFKernel(2), labels=y)\r\n\r\nprotos, proto_labels = critic.select_prototypes(50)\r\ncriticisms, criticism_labels = critic.select_criticisms(10, protos)\r\n```\r\n\r\nNote that the labels and criticism_kernel are optional arguments which are None by default. If `criticism_kernel`\r\nis none, then the prototype kernel will be used for criticisms. If labels are none, then returned labels will be None.\r\n\r\nSee more in the [examples](https://github.com/PhysBoom/mmd_critic/tree/main/examples)\r\n\r\n## More Info\r\n\r\nRead my [article](https://medium.com/@physboom/the-mmd-critic-method-explained-c6a77f2dbf18) for more info on the MMD critic method. I also encourage you to read the original [paper](https://papers.nips.cc/paper_files/paper/2016/hash/5680522b8e2bb01943234bce7bf84534-Abstract.html).\r\n\r\n## Acknowledgements\r\n\r\nThe implementation here is based on Been Kim's [original implementation](https://github.com/BeenKim/MMD-critic/tree/master) and [paper](https://papers.nips.cc/paper_files/paper/2016/hash/5680522b8e2bb01943234bce7bf84534-Abstract.html)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python package for the MMD Critic method",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/PhysBoom/mmd_critic"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f62d2eaebda72968b6f7504cfb9722b61bbf0724766baff3ed10528b9d4568bf",
"md5": "8b55127c2ae8bf08c1e88457dc7a2d17",
"sha256": "2d79c5df264a5a1f63eac000109df861acecbd08c8324b5946aa2d4bac696d46"
},
"downloads": -1,
"filename": "mmd_critic-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8b55127c2ae8bf08c1e88457dc7a2d17",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 9610,
"upload_time": "2025-01-02T01:50:27",
"upload_time_iso_8601": "2025-01-02T01:50:27.535343Z",
"url": "https://files.pythonhosted.org/packages/f6/2d/2eaebda72968b6f7504cfb9722b61bbf0724766baff3ed10528b9d4568bf/mmd_critic-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3e35934bbcb8930616e95c1f46f85a209659f6ec25c328c8eb20f90297a449db",
"md5": "a82f0475457caf4d0ff158118fb4ce23",
"sha256": "2165a4006191293f0c1cfac4caf211248b1f417245690107ca61c95a585fb369"
},
"downloads": -1,
"filename": "mmd_critic-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "a82f0475457caf4d0ff158118fb4ce23",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7556,
"upload_time": "2025-01-02T01:50:29",
"upload_time_iso_8601": "2025-01-02T01:50:29.725435Z",
"url": "https://files.pythonhosted.org/packages/3e/35/934bbcb8930616e95c1f46f85a209659f6ec25c328c8eb20f90297a449db/mmd_critic-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-02 01:50:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PhysBoom",
"github_project": "mmd_critic",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mmd-critic"
}