{"id":14959158,"url":"https://github.com/tansey/sdp","last_synced_at":"2025-10-07T05:24:25.377Z","repository":{"id":57474894,"uuid":"82965598","full_name":"tansey/sdp","owner":"tansey","description":"Deep nonparametric estimation of discrete conditional distributions via smoothed dyadic partitioning","archived":false,"fork":false,"pushed_at":"2017-04-19T22:26:00.000Z","size":3555,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-31T03:13:20.089Z","etag":null,"topics":["deep-learning","density-estimation","machine-learning-algorithms","probability-distribution","tensorflow","tensorflow-models"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tansey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-23T19:54:04.000Z","updated_at":"2021-06-11T07:04:25.000Z","dependencies_parsed_at":"2022-09-10T04:05:03.555Z","dependency_job_id":null,"html_url":"https://github.com/tansey/sdp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tansey%2Fsdp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tansey%2Fsdp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tansey%2Fsdp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tansey%2Fsdp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tansey","download_url":"https://codeload.github.com/tansey/sdp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237999681,"owners_count":19399920,"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":["deep-learning","density-estimation","machine-learning-algorithms","probability-distribution","tensorflow","tensorflow-models"],"created_at":"2024-09-24T13:18:57.392Z","updated_at":"2025-10-07T05:24:20.329Z","avatar_url":"https://github.com/tansey.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Smoothed Dyadic Partitions\n----------------------------------------------\nDeep nonparametric conditional discrete probability estimation via smoothed dyadic partitioning.\n\n- See the `tfsdp` directory (specifically models.py) for the details of all the models we implemented. Note that this file contains a lot of garbage code and legacy naming that needs to be cleaned up. Our SDP model is named LocallySmoothedMultiscaleLayer and is often referred to in some of the experiments as trendfiltering-multiscale. \n\n- See the `experiments` directory for the code to replicate our experiments.\n\nNote that you should be able to install the package as a local pip package via `pip -e .` in this directory. The best example for how to run the models is in `experiments/uci/main.py`, which contains the most recent code and should not have any API issues.\n\nInstallation\n============\nYou can install via Pip: `pip install tf-sdp`\n\nUsing SDP\n=========\nAdding an SDP layer to your code is straightforward:\n\n```python\nimport tensorflow as tf\nfrom keras import backend as K\nfrom keras.regularizers import l2\nfrom keras.layers import Dense, Dropout, Flatten\nfrom tfsdp.models import LocallySmoothedMulticaleLyaer\n\n# Load everything else you need\n# ...\nnum_classes = (32, 45) # Discrete output space with shape 32 x 45\n\n# Create your awesome deep model with lots of layers and whatnot\n# ...\nfinal_hidden_layer = Dense(final_hidden_size, W_regularizer=l2(0.01), activation=K.relu)(...)\nfinal_hidden_drop = Dropout(0.5)(final_hidden_layer)\nmodel = LocallySmoothedMultiscaleLayer(final_hidden_drop, final_hidden_size, num_classes, one_hot=False)\n\n# ...\n# You can get the training loss for an optimizer\nopt = tf.train.AdamOptimizer(learning_rate=learning_rate, epsilon=args.epsilon)\ntrain_step = opt.minimize(model.train_loss)\n\n# Training evaluation and learning is straightforward\nfeed_dict = {} # fill the train dict with other needed params like training flag and input vars\nmodel.fill_train_dict(self._train_dict, labels) # add the relevant dyadic nodes to the dictionary\nsess.run(train_step, feed_dict=feed_dict)\n\n# You can also get the testing loss for validation\nfeed_dict = {} # fill the train dict with other needed params like training flag and input vars\nmodel.fill_test_dict(self._train_dict, labels) # add the relevant dyadic nodes to the dictionary\nloss += sess.run(model.test_loss, feed_dict=feed_dict)\n\n# If you want the full conditional distribution over the entire space:\nfeed_dict = {} # fill the train dict with other needed params like training flag and input vars\ndensity = sess.run(model.density, feed_dict=feed_dict) # density will have shape [batchsize,num_classes]\n```\n\nSee `experiments/uci/model.py` and `experiments/uci/main.py` for complete examples on how to setup and run the model.\n\nCitation\n========\nIf you use this code in your work, please cite the following:\n\n```\n@article{tansey:etal:2017:sdp,\n  title={Deep Nonparametric Estimation of Discrete Conditional Distributions via\n  Smoothed Dyadic Partitioning},\n  author={Tansey, Wesley and Pichotta, Karl and Scott, James G.},\n  journal={arXiv preprint arXiv:1702.07398},\n  year={2017}\n}\n```\n\nThe paper is [available here](http://arxiv.org/abs/1702.07398).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftansey%2Fsdp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftansey%2Fsdp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftansey%2Fsdp/lists"}