{"id":13861712,"url":"https://github.com/siddsax/XML-CNN","last_synced_at":"2025-07-14T09:33:14.904Z","repository":{"id":33575635,"uuid":"157793998","full_name":"siddsax/XML-CNN","owner":"siddsax","description":"Pytorch implementation of the paper Deep learning for extreme multi-label text classification","archived":false,"fork":false,"pushed_at":"2024-02-11T23:34:05.000Z","size":11895,"stargazers_count":62,"open_issues_count":6,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-05T06:03:52.898Z","etag":null,"topics":["cnn-text-classification","deep-learning","multi-label-classification"],"latest_commit_sha":null,"homepage":"https://www.getmerlin.in","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/siddsax.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-16T01:14:46.000Z","updated_at":"2024-08-05T06:03:53.059Z","dependencies_parsed_at":"2024-08-05T06:13:51.979Z","dependency_job_id":null,"html_url":"https://github.com/siddsax/XML-CNN","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/siddsax%2FXML-CNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddsax%2FXML-CNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddsax%2FXML-CNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddsax%2FXML-CNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siddsax","download_url":"https://codeload.github.com/siddsax/XML-CNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225968858,"owners_count":17553148,"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":["cnn-text-classification","deep-learning","multi-label-classification"],"created_at":"2024-08-05T06:01:28.598Z","updated_at":"2024-11-22T21:31:02.297Z","avatar_url":"https://github.com/siddsax.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"This repo is from my past life. I am now co-founder and CTO @ [Merlin](getmerlin.in). Check out our [blog](getmerlin.in/blog) and [extension](https://chromewebstore.google.com/detail/merlin-1-click-access-to/camppjleccjaphfdbohjdohecfnoikec)\n\n# XML-CNN\n  Pytorch implementation of the paper [Deep Learning for Extreme Multi-label Text Classification](http://nyc.lti.cs.cmu.edu/yiming/Publications/jliu-sigir17.pdf) with dynamic pooling\n\n## Dependencies\n\n* NLTK (stopwords)\n* Pytorch \u003e= 0.3.1\n* Gensim\n* Matplotlib\n\n![](cnn.jpg)\n\nDirectory Structure:\n\n```\n+-- code\n|   +-- cnn_test.py  \n|   +-- cnn_train.py\n|   +-- header.py\n|   +-- main.py\n|   +-- models\n|   |   +-- classifier.py\n|   |   +-- cnn_encoder.py\n|   |   +-- embedding_layer.py\n|   |   +-- header.py\n|   |   +-- xmlCNN.py\n|   +-- precision_k.py\n|   +-- score_matrix.mat\n|   +-- test_manik.m\n+-- datasets\n|   +-- Folder where datasets need to be kept\n+-- embedding_weights\n+-- saved_models\n|   +-- Directory created by default where models are saved\n+-- utils\n|   +-- data_dive.py\n|   +-- data_helpers.py\n|   +-- fiddle_clusters.py\n|   +-- futils.py\n|   +-- loss.py\n|   +-- process_eurlex.py\n|   +-- w2v.py\n+-- README.md\n```\nGlove embeddings are needed by default as pre-training for the model. They can be download from [here](https://nlp.stanford.edu/data/glove.6B.zip) and placed in ```embedding_weights``` directory. The Default embedding dimension is 300 with 6 Billion (6B) tokens. Otherwise you can set --model_variation = 0 for starting from scratch.\n\nSample dataset RCV can be downloaded from [here](http://cse.iitk.ac.in/users/siddsax/rcv.p). Trained model on RCV1 can be downloaded from below.\n\n[Trained model](http://cse.iitk.ac.in/users/siddsax/rcvSaved.pt)\n\nPrecision Scores\n\n| 1 | 2 | 3 | 4 | 5 | \n|---|---|---|---|---|\n|0.96 | 0.8848 | 0.7809 | 0.6436 | 0.5457 |\n\nNote: The scores are slighltly higher as the tested dataset is part of the full test dataset.\n\nProcedure to train and test the model is as follows. The code by default doesn't plot graphs. Though that can be enabled wth a visdom server running [[Visdom](https://github.com/facebookresearch/visdom)] and turing on flag --d\n```bash\npython main.py # train a model\npython main.py --mn=rcv # train a model and save in directory rcv [inside saved_models]\n```\nThis will create multiple files inside the folder ```saved_models/rcv``` in the above case. Checkpoints are saved after every \n```save_step``` epochs, this can be changed with ``--ss`` option in command line. Also a checkpoint is made according to best test precision@1 score and best training batch precision@1.\n\n```bash\npython main.py --lm=$DESTINATION OF SAVED MODEL # This resumes trainign from the given checkpoint\n```\n\nIn order to test the model run\n```bash\npython main.py --lm=$DESTINATION OF SAVED MODEL --tr=0 \n```\n\nThis will first print the training error and then the test error while also saving a score_matrix.mat in the folder the model is loaded that can be used to run test scripts from [here](https://drive.google.com/open?id=0B3lPMIHmG6vGN0hSQjFJUHZ0YTg)\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddsax%2FXML-CNN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddsax%2FXML-CNN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddsax%2FXML-CNN/lists"}