{"id":29605733,"url":"https://github.com/tidymodels/filtro","last_synced_at":"2025-08-19T14:05:02.287Z","repository":{"id":301610530,"uuid":"1001104875","full_name":"tidymodels/filtro","owner":"tidymodels","description":"Tidy tools to apply filter-based supervised feature selection methods","archived":false,"fork":false,"pushed_at":"2025-08-15T21:59:03.000Z","size":2015,"stargazers_count":5,"open_issues_count":22,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-15T23:35:49.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://filtro.tidymodels.org/dev/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidymodels.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","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,"zenodo":null}},"created_at":"2025-06-12T20:39:50.000Z","updated_at":"2025-08-15T21:55:49.000Z","dependencies_parsed_at":"2025-06-27T19:46:23.772Z","dependency_job_id":"063bccf1-1dc5-489a-af3c-cbbbbed4fcf4","html_url":"https://github.com/tidymodels/filtro","commit_stats":null,"previous_names":["tidymodels/filters","tidymodels/filtro"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tidymodels/filtro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Ffiltro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Ffiltro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Ffiltro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Ffiltro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidymodels","download_url":"https://codeload.github.com/tidymodels/filtro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Ffiltro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270665709,"owners_count":24624765,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-07-20T16:07:16.479Z","updated_at":"2025-08-19T14:05:02.277Z","avatar_url":"https://github.com/tidymodels.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# filtro\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/tidymodels/filtro/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidymodels/filtro/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/tidymodels/filtro/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/filtro)\n[![CRAN status](https://www.r-pkg.org/badges/version/filtro)](https://CRAN.R-project.org/package=filtro)\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n\u003c!-- badges: end --\u003e\n\n\u003e ⚠️ **filtro is under active development; breaking changes may occur.**\n\n## Overview\n\nfiltro is tidy tools to apply filter-based supervised feature\nselection methods. These methods score and rank feature relevance\nusing metrics such as p-values, correlation, feature importance, information gain, \nand more.\n\nThe package provides functions to rank and select a top proportion or number \nof features using built-in methods and the\n[desirability2](https://desirability2.tidymodels.org) package, and \nsupports streamlined preprocessing, either standalone or within tidymodels\nworkflows such as the [recipes](https://recipes.tidymodels.org) package. \n\nFor a detailed introduction, please see [vignette(\"filtro\")](https://filtro.tidymodels.org/dev/articles/filtro.html). \n\n## Installation\n\nInstall the released version of filtro from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"filtro\")\n```\n\nInstall the development version from GitHub with:\n\n``` r\n# install.packages(\"pak\")\npak::pak(\"tidymodels/filtro\")\n```\n\n## Feature selection methods\n\nCurrently, the implemented filters include:\n\n1. ANOVA F-test \n\n2. Correlation\n\n3. Random forest feature importance \n\n4. Information gain\n\n5. Area under the ROC curve \n\n6. Cross tabulation (Chi-squared test and Fisher's exact test) \n\n## Scoring examples\n\n```{r}\n#| label: start\n#| include: false\nlibrary(filtro)\nlibrary(desirability2)\nlibrary(dplyr)\nlibrary(modeldata)\n```\n\n```{r}\nlibrary(filtro)\nlibrary(desirability2)\nlibrary(dplyr)\nlibrary(modeldata)\n```\n\n```{r}\names_subset \u003c- modeldata::ames |\u003e\n  # Use a subset of data for demonstration\n  dplyr::select(\n    Sale_Price,\n    MS_SubClass,\n    MS_Zoning,\n    Lot_Frontage,\n    Lot_Area,\n    Street\n  )\names_subset \u003c- ames_subset |\u003e\n  dplyr::mutate(Sale_Price = log10(Sale_Price))\n```\n\n```{r}\n# ANOVA p-value\names_aov_pval_res \u003c-\n  score_aov_pval |\u003e\n  fit(Sale_Price ~ ., data = ames_subset)\names_aov_pval_res@results\n```\n\n```{r}\n# Pearson correlation\names_cor_pearson_res \u003c-\n  score_cor_pearson |\u003e\n  fit(Sale_Price ~ ., data = ames_subset)\names_cor_pearson_res@results\n```\n\n```{r}\n# Forest importance\names_imp_rf_reg_res \u003c-\n  score_imp_rf |\u003e\n  fit(Sale_Price ~ ., data = ames_subset, seed = 42)\names_imp_rf_reg_res@results\n```\n\n```{r}\n# Information gain\names_info_gain_reg_res \u003c-\n  score_info_gain |\u003e\n  fit(Sale_Price ~ ., data = ames_subset)\names_info_gain_reg_res@results\n```\n\n## Filtering exmples for score *singular* \n\n```{r}\names_aov_pval_res@results\n```\n\n```{r}\n# Show best score, based on proportion of predictors\names_aov_pval_res |\u003e show_best_score_prop(prop_terms = 0.2)\n```\n\n```{r}\n# Fill safe value, then show best score \names_aov_pval_res \u003c- ames_aov_pval_res |\u003e fill_safe_value()\names_aov_pval_res |\u003e show_best_score_prop(prop_terms = 0.2)\n```\n\n## Filtering examples for scores *plural* \n\n```{r}\n# Create a list\nclass_score_list \u003c- list(\n  ames_cor_pearson_res,\n  ames_imp_rf_reg_res,\n  ames_info_gain_reg_res\n)\n```\n\n```{r}\n# Fill safe values\names_scores_results \u003c- class_score_list |\u003e\n  fill_safe_values() |\u003e\n  # Remove outcome\n  dplyr::select(-outcome)\names_scores_results\n```\n\n```{r}\n# Single and multi-parameter optimization using desirability functions\n# Optimize correlation alone\names_scores_results |\u003e\n  show_best_desirability_prop(\n    maximize(cor_pearson, low = 0, high = 1)\n  )\n\n# Optimize correlation and forest importance\names_scores_results |\u003e\n  show_best_desirability_prop(\n    maximize(cor_pearson, low = 0, high = 1),\n    maximize(imp_rf)\n  )\n\n# Optimize correlation, forest importance and information gain\names_scores_results |\u003e\n  show_best_desirability_prop(\n    maximize(cor_pearson, low = 0, high = 1),\n    maximize(imp_rf),\n    maximize(infogain)\n  )\n\n# Same as above, but retain only a proportion of predictors\names_scores_results |\u003e\n  show_best_desirability_prop(\n    maximize(cor_pearson, low = 0, high = 1),\n    maximize(imp_rf),\n    maximize(infogain),\n    prop_terms = 0.2\n  )\n\n# Optimize toward a target\names_scores_results |\u003e\n  show_best_desirability_prop(\n    target(cor_pearson, low = 0.2, target = 0.255, high = 0.9)\n  )\n\n# Optimize with box constraints\names_scores_results |\u003e\n  show_best_desirability_prop(\n    constrain(cor_pearson, low = 0.2, high = 1)\n  )\n```\n\n## Contributing\n\nPlease note that the filtro project is released with a [Contributor Code of Conduct](https://filtro.tidymodels.org/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n\n- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on Posit Community](https://forum.posit.co/new-topic?category_id=15\u0026tags=tidymodels,question).\n\n- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/filtro/issues).\n\n- Either way, learn how to create and share a [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) (a minimal, reproducible example), to clearly communicate about your code.\n\n- Check out further details on [contributing guidelines for tidymodels packages](https://www.tidymodels.org/contribute/) and [how to get help](https://www.tidymodels.org/help/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidymodels%2Ffiltro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidymodels%2Ffiltro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidymodels%2Ffiltro/lists"}