{"id":18518341,"url":"https://github.com/arxiv/arxiv-classifier","last_synced_at":"2025-04-09T08:31:40.305Z","repository":{"id":40960445,"uuid":"97148636","full_name":"arXiv/arxiv-classifier","owner":"arXiv","description":"Facebook contributed classifier for abstracts","archived":false,"fork":false,"pushed_at":"2022-12-08T10:22:24.000Z","size":3402,"stargazers_count":14,"open_issues_count":18,"forks_count":2,"subscribers_count":14,"default_branch":"develop","last_synced_at":"2025-03-24T03:53:09.002Z","etag":null,"topics":["flask","in-production","machine-learning","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/arXiv.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-07-13T17:25:41.000Z","updated_at":"2025-03-21T01:13:30.000Z","dependencies_parsed_at":"2022-08-10T01:29:21.795Z","dependency_job_id":null,"html_url":"https://github.com/arXiv/arxiv-classifier","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arXiv%2Farxiv-classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arXiv%2Farxiv-classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arXiv%2Farxiv-classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arXiv%2Farxiv-classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arXiv","download_url":"https://codeload.github.com/arXiv/arxiv-classifier/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248003156,"owners_count":21031743,"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":["flask","in-production","machine-learning","python"],"created_at":"2024-11-06T17:13:03.075Z","updated_at":"2025-04-09T08:31:39.999Z","avatar_url":"https://github.com/arXiv.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# arxiv-classifier\n\n# How to Train\n```\nnb = ArticleClassifier(dbpath='/path/to/db')\nfn = nb.create_input_file(metadata)\nnb.train(fn)\nnb.save()\n   \n```\n# How to Classify\n```\nnb = ArticleClassifier(dbpath='/path/to/db')\nnb.load()\nfn = nb.create_input_file(metadata)\nclasses = nb.classify(fn)\n```\n\nIn these examples, metadata should be a List of Dict where the Dict are in the format given below. The file name paths are relative to the current machine (on the local file system):\n\n```\n{\n  \"id\": \"1704.00222\",\n  \"categories\": [\"cs.NM\", \"hep-th\"],\n  \"filename\": \"/path/to/file.txt\"\n}\n```\n\n# Trained Models\n\nTrained model for use by arXiv staff can be found at s3://arxiv-classifier-models \n\n\n# ULMFiT classifier\n\n## Training\n\nSee [experiments directory](experiments/) for training and evaluation notebooks.\n\n## Models\n\nThe ULMFiT and SentencePiece model files can be downloaded [here](https://github.com/arXiv/arxiv-classifier/releases/download/ulmfit-models-v1.0/models.tar.xz). Make sure `CLASSIFIER_PATH` configuration parameter\npoints to `models/abstracts-classifier.pkl` and that `CLASSIFIER_TYPE` equals `ulmfit`.  \n\n## Testing\n\nTo test the service locally you can run it with\n```shell\nFLASK_APP=classifier.test_app flask run --port 9999\n```\n\nand make a request:\n```shell\ncurl -s -H \"Content-Type: application/json\" -X POST http://localhost:9999/classify \\\n    --data '{\"title\":\"P = NP\", \"abstract\": \"We prove that P = NP for N = 1 or P = 0.\", \"primary\": \"cs.SE\"}'\n\n[{\"category\":\"cs.CC\",\"probability\":0.8264293074607849},{\"category\":\"cs.DS\",\"probability\":0.1285623162984848},...]\n```\n\nThe primary is optional.\n\nBoth the input and output format are not yet compatible with the Naive Bayes classifier.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farxiv%2Farxiv-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farxiv%2Farxiv-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farxiv%2Farxiv-classifier/lists"}