{"id":21474650,"url":"https://github.com/pabsan-0/vfs2","last_synced_at":"2025-03-17T07:43:15.548Z","repository":{"id":109899711,"uuid":"494853749","full_name":"pabsan-0/vfs2","owner":"pabsan-0","description":"Vectorial Mutual-Information based feature selection","archived":false,"fork":false,"pushed_at":"2022-06-27T11:16:16.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-23T16:53:04.237Z","etag":null,"topics":["feature-selection","mutual-information","repos-ml","statistics"],"latest_commit_sha":null,"homepage":"","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/pabsan-0.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":"2022-05-21T17:40:46.000Z","updated_at":"2024-08-30T08:47:46.000Z","dependencies_parsed_at":"2023-04-29T10:30:43.480Z","dependency_job_id":null,"html_url":"https://github.com/pabsan-0/vfs2","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/pabsan-0%2Fvfs2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabsan-0%2Fvfs2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabsan-0%2Fvfs2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabsan-0%2Fvfs2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pabsan-0","download_url":"https://codeload.github.com/pabsan-0/vfs2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243996898,"owners_count":20380978,"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":["feature-selection","mutual-information","repos-ml","statistics"],"created_at":"2024-11-23T10:24:24.841Z","updated_at":"2025-03-17T07:43:15.521Z","avatar_url":"https://github.com/pabsan-0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Vector feature selection\n\nMutual-information based feature selection considering feature sets rather than single-dimensional features.\n\nThe mutual information (MI) among two random variables X and Y, I(X;Y) can be computed from their joint and marginal probability density functions (pdf) *fxy*, *fx* and *fy*. The MI can be expanded to random vectors ***X*** and ***Y***, however their pdf estimation becomes much harder.\n\nTake the three types of feature selection methods:   \n  - Forward selection  \n  - Backward elimination  \n  - Exhaustive search  \n\nMutual information based selection methods in the literature traditionally follow the Forward Selection approach by using a variety of scores such as:\n - MIM\n - MRMR\n - JMIM\n - etc.\n\nWhich consist of different combinations of low-dim MI among the different candidate features and the target, keeping to the trivariate case MI(X,Y;Z) at most and avoiding the hindrance of estimating high-dimensional probability densities.\n\nThis repository provides implementations for:\n  - Mutual Information MI(***X***;***Y***)\n  - Forward selection methods in the literature\n  - Backward elimination from the methods in the literature\n  - Exhaustive selection based on the raw MI(***X***;***Y***)\n  - Vectorized versions of MRMR and DISR methods by replacing f(MI(X*i*;Y)) -\u003e MI(***X***;***Y***)\n\n\n:boom: See next section [Shorts](#shorts) for a super brief tutorial on how to use the library.  \n\n:boom: See subdirectory [scripts](scripts) for more detailed examples.\n\n\n\n### Shorts\n```\nfrom vfs import *\nfrom vfs.shorthands import df_iris, MRMR\ndf, features, targets = df_iris()\n```\n##### Mutual information\n```\n# Mutual information between two variables\nmi = mi_frame(df)(['F1'], ['F2'])\nprint(mi)\n\n# Mutual information between two groups of variables (vectors)\nmi = mi_frame(df)(['F1','F2'], ['F3','F4', 'F5'])\nprint(mi)\n```\n\n\n##### Traditional feature selection\n```\n# Select the two best features according to MRMR (forward), using shorthand\nsummary, __, __ = MRMR(df, ['F1', 'F2', 'F3', 'F4'], ['F5'], k=2)\nprint(summary)\n\n# Select the best two features according to JMIM (backward), using default func\n__, sel, disc = backward_eliminator(df, ['F1', 'F2', 'F3', 'F4'], ['F5'], k=2, loss=jmim, mi_fun=mi_frame(df))\nprint(sel)\nprint(disc)\n```\n\n##### Vectorial feature selection\n```\n# Select the best three features by testing all feat combinations\nsel, score = exhaustive_searcher(df, ['F1', 'F2', 'F3', 'F4'], ['F5'], k=2, mi_fun=mi_frame(df))\nprint(sel)\n\n# Select the best feature vector between two candidates\nmifun = mi_frame(df)\naa = ['F1', 'F2']\nbb = ['F3', 'F4']\nbest = aa if mifun(aa, ['F5']) \u003e mifun(bb, ['F5']) else bb\n```\n\n\n\n### Bibliography\n\n- \u003cdiv id=\"ref-battiti1994\" class=\"csl-entry\" role=\"doc-biblioentry\"\u003e Battiti, Roberto. 1994. \u003cspan\u003e“Using Mutual Information for Selecting Features in Supervised Neural Net Learning.”\u003c/span\u003e \u003cem\u003eIEEE Transactions on Neural Networks\u003c/em\u003e 5 (4): 537–50. \u003c/div\u003e\u003cbr/\u003e\n\n- \u003cdiv id=\"ref-yang1999\" class=\"csl-entry\" role=\"doc-biblioentry\"\u003eYang, H, and John Moody. 1999. \u003cspan\u003e“Feature Selection Based on Joint Mutual Information.”\u003c/span\u003e In \u003cem\u003eProceedings of International ICSC Symposium on Advances in Intelligent Data Analysis\u003c/em\u003e, 1999:22–25. Citeseer. \u003c/div\u003e\u003cbr/\u003e\n\n- \u003cdiv id=\"ref-fleuret2004\" class=\"csl-entry\" role=\"doc-biblioentry\"\u003e Fleuret, François. 2004. \u003cspan\u003e“Fast Binary Feature Selection with Conditional Mutual Information.”\u003c/span\u003e \u003cem\u003eJournal of Machine Learning Research\u003c/em\u003e 5 (9). \u003c/div\u003e\u003cbr/\u003e \n\n- \u003cdiv id=\"ref-peng2005\" class=\"csl-entry\" role=\"doc-biblioentry\"\u003e Peng, Hanchuan, Fuhui Long, and Chris Ding. 2005. \u003cspan\u003e“Feature Selection Based on Mutual Information Criteria of Max-Dependency, Max-Relevance, and Min-Redundancy.”\u003c/span\u003e \u003cem\u003eIEEE Transactions on Pattern Analysis and Machine Intelligence\u003c/em\u003e 27 (8): 1226–38. \u003c/div\u003e\u003cbr/\u003e\n\n- \u003cdiv id=\"ref-meyer2006\" class=\"csl-entry\" role=\"doc-biblioentry\"\u003e Meyer, Patrick E, and Gianluca Bontempi. 2006. \u003cspan\u003e“On the Use of Variable Complementarity for Feature Selection in Cancer Classification.”\u003c/span\u003e In \u003cem\u003eWorkshops on Applications of Evolutionary Computation\u003c/em\u003e, 91–102. Springer. \u003c/div\u003e\u003cbr/\u003e\n\n- \u003cdiv id=\"ref-bennasar2015\" class=\"csl-entry\" role=\"doc-biblioentry\"\u003e Bennasar, Mohamed, Yulia Hicks, and Rossitza Setchi. 2015. \u003cspan\u003e“Feature Selection Using Joint Mutual Information Maximisation.”\u003c/span\u003e \u003cem\u003eExpert Systems with Applications\u003c/em\u003e 42 (22): 8520–32. \u003c/div\u003e \u003cbr/\u003e\n\n- \u003cdiv id=\"ref-bommert2020\" class=\"csl-entry\" role=\"doc-biblioentry\"\u003e Bommert, Andrea, Xudong Sun, Bernd Bischl, Jörg Rahnenführer, and Michel Lang. 2020. \u003cspan\u003e“Benchmark for Filter Methods for Feature Selection in High-Dimensional Classification Data.”\u003c/span\u003e \u003cem\u003eComputational Statistics \u0026amp; Data Analysis\u003c/em\u003e 143: 106839. \u003c/div\u003e\u003cbr/\u003e\n\n- \u003cdiv id=\"ref-kursa2021\" class=\"csl-entry\" role=\"doc-biblioentry\"\u003e Kursa, Miron B. 2021. \u003cspan\u003e“Praznik: High Performance Information-Based Feature Selection.”\u003c/span\u003e \u003cem\u003eSoftwareX\u003c/em\u003e 16: 100819. \u003c/div\u003e\u003cbr/\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpabsan-0%2Fvfs2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpabsan-0%2Fvfs2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpabsan-0%2Fvfs2/lists"}