{"id":15899602,"url":"https://github.com/jmloyola/early-classification","last_synced_at":"2026-01-21T21:33:04.580Z","repository":{"id":73414932,"uuid":"110585802","full_name":"jmloyola/early-classification","owner":"jmloyola","description":"Early Text Classification in Python","archived":false,"fork":false,"pushed_at":"2018-06-15T04:05:33.000Z","size":3864,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T21:51:53.766Z","etag":null,"topics":["early-classification","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmloyola.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":"2017-11-13T18:31:52.000Z","updated_at":"2022-01-24T13:37:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c777aca-4364-4e83-9100-2c109c7e00ba","html_url":"https://github.com/jmloyola/early-classification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jmloyola/early-classification","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Fearly-classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Fearly-classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Fearly-classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Fearly-classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmloyola","download_url":"https://codeload.github.com/jmloyola/early-classification/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Fearly-classification/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28644076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T21:29:11.980Z","status":"ssl_error","status_checked_at":"2026-01-21T21:24:31.872Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["early-classification","machine-learning","python"],"created_at":"2024-10-06T10:21:57.692Z","updated_at":"2026-01-21T21:33:04.566Z","avatar_url":"https://github.com/jmloyola.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Early Text Classification\n\nThis repository contains the implementation of the Early Text Classification framework.\n\nThe problem of classification is a widely studied one in supervised learning.\nNonetheless, there are scenarios that received little attention despite its applicability.\nOne of such scenarios is _early text classification_, where one needs to know the category of a document as soon as possible.\nThe importance of this variant of the classification problem is evident in tasks like sexual predator detection, where one wants to identify an offender as early as possible.\nThis framework highlights the two main pieces involved in this problem: _classification with partial information_ and _deciding the\nmoment of classification_.\n\nBased on the paper:\n\u003e Loyola J.M., Errecalde M.L., Escalante H.J., Montes y Gomez M. (2018) Learning When to Classify for Early Text Classification. In: De Giusti A. (eds) Computer Science – CACIC 2017. CACIC 2017. Communications in Computer and Information Science, vol 790. Springer, Cham. [[Springer Link]](https://doi.org/10.1007/978-3-319-75214-3_3) [[SEDICI Link]](http://sedici.unlp.edu.ar/handle/10915/63498)\n\n## How to use framework\nThe jupyter notebook [example.ipynb](https://github.com/jmloyola/early-classification/blob/master/notebooks/example.ipynb) shows how to use this framework. You need to specify the following parameters:\n* etc_kwargs : dict\n    * dataset_name: name of the dataset to use. We expect the dataset to already be splitted in training and test set and to be located inside the folder `dataset`. There should be two files named `{dataset_name}_train.txt` and `{dataset_name}_test.txt`. Each file must have the following structure for each document `i`: `{label_i}[TAB]{document_i}`. Both corpus must end with an empty line.\n    * initial_step: initial percentage of the document to read.\n    * step_size: percentage of the document to read in each step.\n* preprocess_kwargs : dict\n    * min_word_length: number of letters the terms must have to be consider.\n    * max_number_words: maximum number of words to consider. In case you want to include all words use `'all'`.\n* cpi_kwargs : dict\n    * train_dataset_percentage: percentage of documents to use for training cpi.\n    * test_dataset_percentage: percentage of documents to use for testing cpi.\n    * doc_rep: document representation to use. For now the only representation available is `term_frec`.\n    * cpi_clf: classifier for the cpi module. It must have methods `fit(X, y)`, `predict(X)` and `get_params()` similar to those in the scikit-learn API. The method `fit` should accept a sparse matrix as the parameter `X`.\n* context_kwargs : dict\n    * number_most_common: number of most common terms of each category to use.\n* dmc_kwargs : dict\n    * train_dataset_percentage: percentage of documents to use for training dmc.\n    * test_dataset_percentage: percentage of documents to use for testing dmc.\n    * dmc_clf: classifier for the dmc module. It must have methods `fit(X, y)`, `predict(X)` and `get_params()` similar to those in the scikit-learn API.\n\n## Dependencies\nThis code was developed and tested on Python 3.6 and depends on:\n* scipy == 1.0.0\n* numpy == 1.14.0\n* scikit_learn == 0.19.1\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmloyola%2Fearly-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmloyola%2Fearly-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmloyola%2Fearly-classification/lists"}