{"id":28103429,"url":"https://github.com/westlake-ai/dmt-learn","last_synced_at":"2025-08-07T09:14:09.495Z","repository":{"id":258951622,"uuid":"875970091","full_name":"Westlake-AI/DMT-learn","owner":"Westlake-AI","description":"An Explainable Deep Network for Dimension Reduction","archived":false,"fork":false,"pushed_at":"2024-11-18T03:43:02.000Z","size":16197,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T13:46:34.495Z","etag":null,"topics":["data-science","dimension-reduction","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Westlake-AI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2024-10-21T07:23:47.000Z","updated_at":"2025-02-11T08:25:25.000Z","dependencies_parsed_at":"2024-10-28T12:59:10.085Z","dependency_job_id":"b0da11ff-e529-4773-9abe-c39d8f2e3af3","html_url":"https://github.com/Westlake-AI/DMT-learn","commit_stats":null,"previous_names":["westlake-ai/dmtev-lean","westlake-ai/dmtev-learn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Westlake-AI%2FDMT-learn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Westlake-AI%2FDMT-learn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Westlake-AI%2FDMT-learn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Westlake-AI%2FDMT-learn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Westlake-AI","download_url":"https://codeload.github.com/Westlake-AI/DMT-learn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254022041,"owners_count":22001045,"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":["data-science","dimension-reduction","python"],"created_at":"2025-05-13T20:37:47.771Z","updated_at":"2025-05-13T20:37:48.342Z","avatar_url":"https://github.com/Westlake-AI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# DMT-EV: An Explainable Deep Network for Dimension Reduction\n\nThe code includes the following modules:\n* Training\n* Inference\n* Comparison with t-SNE, UMAP and PCA\n\n\n## Requirements\n\n* torch\u003e=2.3.1\n* torchaudio\u003e=2.3.1\n* torchvision\u003e=0.18.1\n* pytorch-lightning==2.4.0\n\n\n## Installation\nCreate a new conda environment and install torch, torchvision, torchaudio:\n```bash\nconda create -n DMT python=3.10\nconda activate DMT\npip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121\n```\nThen you can install the package from source or from PyPI.\nInstall from source:\n```bash\npip install -e git+https://github.com/Westlake-AI/DMT-learn.git#egg=dmt-learn\n```\nInstall from PyPI:\n```bash\npip install dmt-learn\n```\n\n## Running the code\nUse the following code to fit the model to the dataset and visualize the results.\n\n```python\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.datasets import load_iris\nfrom dmt import DMT\n\n# Load sample dataset\niris = load_iris()\nX = iris.data\ny = iris.target\n\n# Perform t-SNE\ndmt = DMT(num_fea_aim=100)\nX_dmt = dmt.fit_transform(X)\n\n# Plot the result\nplt.figure(figsize=(8, 6))\nscatter = plt.scatter(X_dmt[:, 0], X_dmt[:, 1], c=y, cmap='viridis')\n\n# Create legend\nlegend1 = plt.legend(*scatter.legend_elements(), title=\"Classes\")\nplt.gca().add_artist(legend1)  # Add the legend to the current axes\n\nplt.title('DMT-EV visualization of Iris dataset')\nplt.xlabel('DMT-EV Component 1')\nplt.ylabel('DMT-EV Component 2')\nplt.savefig('dmt.png')\n```\nYou can alse separate the training and inference steps:\n```python\ndmt.fit(X)\nX_dmt = dmt.transform(X)\n```\nIf you want to compare the results with other dimension reduction methods(t-SNE, UMAP), you can use the following code:\n```python\ndmt.compare(X, \"comparison.png\")\n```\n\n## Example Results\n\nThe code is in [example](https://github.com/zangzelin/example_dmtlearn.git).\n\n### Mnist Dataset\n\n![mnist dataset](example/pic/mnist.png)\n\n### breast_cancer Dataset\n\n![breast_cancer dataset](example/pic/breast_cancer.png)\n\n### 20News Dataset\n\n![20News dataset](example/pic/20News.png)\n\n### PBMC Dataset\n\n![PBMC dataset](example/pic/pbmc.png)\n\n\n## Cite the paper\n\n```\n@article{zang2024dmt,\n  title={DMT-EV: An Explainable Deep Network for Dimension Reduction},\n  author={Zang, Zelin and Cheng, Shenghui and Xia, Hanchen and Li, Liangyu and Sun, Yaoting and Xu, Yongjie and Shang, Lei and Sun, Baigui and Li, Stan Z},\n  journal={IEEE Transactions on Visualization and Computer Graphics},\n  volume={30},\n  number={3},\n  pages={1710--1727},\n  year={2024},\n  publisher={IEEE}\n}\n```\n\n\n## License\n\nDMT-EV is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwestlake-ai%2Fdmt-learn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwestlake-ai%2Fdmt-learn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwestlake-ai%2Fdmt-learn/lists"}