{"id":13784412,"url":"https://github.com/AWehenkel/UMNN","last_synced_at":"2025-05-11T19:33:03.292Z","repository":{"id":41570506,"uuid":"186380540","full_name":"AWehenkel/UMNN","owner":"AWehenkel","description":"Implementation of Unconstrained Monotonic Neural Network and the related experiments. These architectures are particularly useful for modelling monotonic transformations in normalizing flows.","archived":false,"fork":false,"pushed_at":"2024-12-18T07:08:50.000Z","size":26161,"stargazers_count":118,"open_issues_count":1,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T07:49:59.264Z","etag":null,"topics":["monotonic","neural-network","normalizing-flows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AWehenkel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-13T08:44:07.000Z","updated_at":"2025-02-21T17:47:12.000Z","dependencies_parsed_at":"2024-12-29T18:09:23.371Z","dependency_job_id":null,"html_url":"https://github.com/AWehenkel/UMNN","commit_stats":{"total_commits":41,"total_committers":2,"mean_commits":20.5,"dds":"0.024390243902439046","last_synced_commit":"e89345770adee81dae8434e2689a9cfd5fe55d39"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWehenkel%2FUMNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWehenkel%2FUMNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWehenkel%2FUMNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWehenkel%2FUMNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AWehenkel","download_url":"https://codeload.github.com/AWehenkel/UMNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253621336,"owners_count":21937508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["monotonic","neural-network","normalizing-flows"],"created_at":"2024-08-03T19:00:42.658Z","updated_at":"2025-05-11T19:33:01.582Z","avatar_url":"https://github.com/AWehenkel.png","language":"Python","funding_links":[],"categories":["🧑‍💻 Repos \u003csmall\u003e(18)\u003c/small\u003e"],"sub_categories":["\u003cimg src=\"assets/pytorch.svg\" alt=\"PyTorch\" height=\"20px\"\u003e \u0026nbsp;PyTorch Repos"],"readme":"# Unconstrained Monotonic Neural Networks (UMNN)\n![](figures/archi.png)\nOfficial implementation of Unconstrained Monotonic Neural Networks (UMNN) and the experiments presented in the paper:\n\u003e Antoine Wehenkel and Gilles Louppe. \"Unconstrained Monotonic Neural Networks.\" (2019).\n\u003e [[arxiv]](https://arxiv.org/abs/1908.05164)\n\n# Other implementations:\n- Check the [Zuko](https://github.com/francois-rozet/zuko) library for a clean and complete implementation of UMNNs based normalizing flows.\n- Check [here](https://github.com/AWehenkel/generalized-UMNN/) if you are interested by modeling functions that are monotonic with respect to more than one input variable. (Do not hesitate to contact me for more details)\n\n# Dependencies\nThe code has been tested with Pytorch 1.1 and Python3.6.\nSome code to draw figures and load dataset are taken from \n[FFJORD](https://github.com/rtqichen/ffjord) \nand [Sylvester normalizing flows for variational inference](https://github.com/riannevdberg/sylvester-flows).\n\n# Usage\n## Simple Monotonic Function\nThis experiment is not described in the paper. We create the following dataset:\nx = [x_1, x_2, x_3] is drawn from a multivariate Gaussian, y = 0.001(x_1^3 + x_1) + x_2 + sin(x_3). \nWe suppose that we are given the information about the monotonicity of y with respect to x_1.\n```bash\npython MonotonicMLP.py \n```\nIn this experiment we show that a classical MLP won't be able to \nmodel a function that is monotonic with respect to x_1 because its effect is small\nin comparison to the other variables. The UMNN performs better than an MLP while \nensuring that the output is monotonic with respect to x_1.\n![](figures/Monotonicity.png)\n## Toy Experiments\n![](figures/toy/all_flow.png)\n```bash\npython ToyExperiments.py \n```\nSee ToyExperiments.py for optional arguments.\n## MNIST\n![](figures/MNIST/MNIST_3_075.png)\n```bash\npython MNISTExperiment.py\n```\nSee MNISTExperiment.py for optional arguments.\n\n## UCI Dataset\nYou have to download the datasets with the following command:\n```bash\npython datasets/download_datasets.py \n```\nThen you can execute:\n```bash\npython UCIExperiments.py --data ['power', 'gas', 'hepmass', 'miniboone', 'bsds300']\n```\nSee UCIExperiments.py for optional arguments.\n\n## VAE\nYou have to download the datasets:\n* MNIST: \n```\npython datasets/download_datasets.py\n```\n* OMNIGLOT: the dataset can be downloaded from [link](https://github.com/yburda/iwae/blob/master/datasets/OMNIGLOT/chardata.mat);\n* Caltech 101 Silhouettes: the dataset can be downloaded from [link](https://people.cs.umass.edu/~marlin/data/caltech101_silhouettes_28_split1.mat).\n* Frey Faces: the dataset can be downloaded from [link](https://github.com/y0ast/Variational-Autoencoder/blob/master/freyfaces.pkl).\n```bash\npython TrainVaeFlow.py -d ['mnist', 'freyfaces', 'omniglot', 'caltech']\n```\n\n## Other Usage\nAll the files related to the implementation of UMNN (Conditionner network, Integrand Network and Integral)\nare located in the folder models/UMNN. \n- `NeuralIntegral.py` computes the integral of a neural network\n(with 1d output) using the Clenshaw-Curtis(CC) quadrature, it computes sequentially the different evaluation points required by CC.\n- `ParallelNeuralIntegral.py` processes all the evaluation points at once making the computation almost as fast as the forward evaluation \nthe net but to the price of a higher memory cost. \n- `UMNNMAF.py` contains the implementation of the different networks required by UMNN.\n- `UMNNMAFFlow.py` contains the implementation of flows made of UMNNs.\n\n## Cite\n\nIf you make use of this code in your own work, please cite our paper:\n\n```\n@inproceedings{wehenkel2019unconstrained,\n  title={Unconstrained monotonic neural networks},\n  author={Wehenkel, Antoine and Louppe, Gilles},\n  booktitle={Advances in Neural Information Processing Systems},\n  pages={1543--1553},\n  year={2019}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAWehenkel%2FUMNN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAWehenkel%2FUMNN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAWehenkel%2FUMNN/lists"}