{"id":51456629,"url":"https://github.com/ielbadisy/funcml","last_synced_at":"2026-07-06T01:01:32.139Z","repository":{"id":364991718,"uuid":"1183769851","full_name":"ielbadisy/funcml","owner":"ielbadisy","description":"Functional Machine Learning in R","archived":false,"fork":false,"pushed_at":"2026-06-15T11:03:48.000Z","size":4356,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T12:26:16.948Z","etag":null,"topics":["classification","g-computation","interpretable-machine-learning","machine-learning","regression","tabular-data"],"latest_commit_sha":null,"homepage":"","language":"R","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/ielbadisy.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-16T23:53:07.000Z","updated_at":"2026-06-15T11:03:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ielbadisy/funcml","commit_stats":null,"previous_names":["ielbadisy/funcml"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ielbadisy/funcml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielbadisy%2Ffuncml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielbadisy%2Ffuncml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielbadisy%2Ffuncml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielbadisy%2Ffuncml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ielbadisy","download_url":"https://codeload.github.com/ielbadisy/funcml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ielbadisy%2Ffuncml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35174071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"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":["classification","g-computation","interpretable-machine-learning","machine-learning","regression","tabular-data"],"created_at":"2026-07-06T01:01:30.017Z","updated_at":"2026-07-06T01:01:32.116Z","avatar_url":"https://github.com/ielbadisy.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\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  warning = FALSE,\n  message = FALSE\n)\n\npkgload::load_all(\".\", export_all = FALSE, helpers = FALSE, quiet = TRUE)\nggplot2::theme_set(theme_funcml())\nset.seed(42)\n```\n\n\n\n# funcml\n\n[![R-CMD-check](https://github.com/ielbadisy/funcml/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ielbadisy/funcml/actions/workflows/R-CMD-check.yaml)\n[![CRAN status](https://www.r-pkg.org/badges/version/funcml)](https://CRAN.R-project.org/package=funcml)\n[![CRAN checks](https://badges.cranchecks.info/worst/funcml.svg)](https://cran.r-project.org/web/checks/check_results_funcml.html)\n[![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/funcml)](https://cran.r-project.org/package=funcml)\n[![License: GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![CRAN Task View: Machine Learning](https://img.shields.io/badge/CRAN%20Task%20View-Machine%20Learning-2c7fb8)](https://cran.r-project.org/web/views/MachineLearning.html)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.20707605.svg)](https://doi.org/10.5281/zenodo.20707605)\n\n`funcml` is a functional machine learning framework for tabular data in R.\n\n`funcml` is listed in the\n[CRAN Task View: Machine Learning \u0026 Statistical Learning](https://cran.r-project.org/web/views/MachineLearning.html).\n\nIt provides one explicit interface for the core modeling workflow:\n\n* fit models with `fit()`\n* generate predictions with `predict()`\n* validate performance with `evaluate()`\n* tune hyperparameters with `tune()`\n* compare learners with `compare_learners()`\n* interpret fitted models with `interpret()`\n* estimate causal effects with `estimate()`\n\nThe package is intentionally compact and opinionated: preprocessing happens before modeling, inputs stay explicit, and the API stays small instead of expanding into a large orchestration layer.\n\nA companion paper for `funcml` is submitted to JMLR.\n\n## Installation\n\n```r\ninstall.packages(\"funcml\")\n\ninstall.packages(\"remotes\")\nremotes::install_github(\"ielbadisy/funcml\")\n```\n\n## Core API\n\nThe design of `funcml` centers on a small set of functions:\n\n```r\nfit()\npredict()\nevaluate()\ntune()\ncompare_learners()\ninterpret()\nestimate()\n```\n\n## Explore the registry\n\n`funcml` exposes a session-aware registry of learners, metrics, and interpretation methods.\n\n```{r registry}\nlist_learners()\n```\n\n```{r registry-tunable}\nlist_tunable_learners()\n```\n\n```{r registry-metrics}\nlist_metrics()\n```\n\n```{r registry-interpret}\nlist_interpretability_methods()\n```\n\n## Example data\n\nThis README uses `funcml::arthritis` as the main running example.\n\nHere, `status` is the outcome for a binary classification task.\n\n```{r demo-data}\ndemo_dat \u003c- funcml::arthritis\ndemo_dat$status \u003c- as.factor(demo_dat$status)\nlevels(demo_dat$status)\n```\n\n## Fit a classification model\n\n`fit()` trains a model and returns a `funcml_fit` object.\n\n```{r fit-model}\nxgb_spec \u003c- list(\n  nrounds = 30,\n  max_depth = 3,\n  eta = 0.1,\n  subsample = 1,\n  colsample_bytree = 1\n)\n\nfit_obj \u003c- fit(\n  status ~ age + gender + bmi + diabetes + smoke + covered_health,\n  data = demo_dat,\n  model = \"xgboost\",\n  spec = xgb_spec,\n  seed = 42\n)\n\nfit_obj\n```\n\n## Generate predictions\n\nThe same fitted object can produce class predictions or class probabilities.\n\n```{r predict-class}\npredict(fit_obj, demo_dat[1:6, ])\n```\n\n```{r predict-prob}\npred_prob \u003c- predict(\n  fit_obj,\n  demo_dat[1:6, ],\n  type = \"prob\"\n)\n\npred_prob\n```\n\n## Evaluate predictive performance\n\n`evaluate()` applies the same learner under a resampling plan and returns fold-level results with summary statistics.\n\n```{r evaluate-model}\neval_obj \u003c- evaluate(\n  data = demo_dat,\n  formula = status ~ age + gender + bmi + diabetes + smoke + covered_health,\n  model = \"xgboost\",\n  spec = xgb_spec,\n  resampling = cv(v = 4, seed = 42)\n)\n\neval_obj\n```\n\n```{r evaluate-plot}\nplot(eval_obj)\n```\n\n`funcml` also supports grouped cross-validation, time-based resampling, and holdout validation through `group_cv()`, `time_cv()`, and `holdout()`.\n\n## Tune hyperparameters\n\n`tune()` searches candidate hyperparameter settings using the same evaluation framework.\n\n```{r tune-model}\ntune_grid \u003c- expand.grid(\n  max_depth = c(2, 3),\n  eta = c(0.05, 0.1),\n  nrounds = c(20, 30)\n)\n\ntune_obj \u003c- tune(\n  data = demo_dat,\n  formula = status ~ age + gender + bmi + diabetes + smoke + covered_health,\n  model = \"xgboost\",\n  grid = tune_grid,\n  resampling = cv(v = 3, seed = 42),\n  metric = \"logloss\",\n  subsample = 1,\n  colsample_bytree = 1,\n  seed = 42\n)\n\ntune_obj\n```\n\n```{r tune-plot}\nplot(tune_obj)\n```\n\n## Compare learners\n\n`compare_learners()` benchmarks multiple learners under a common resampling design.\n\n```{r compare-models}\ncompare_obj \u003c- compare_learners(\n  data = demo_dat,\n  formula = status ~ age + gender + bmi + diabetes + smoke + covered_health,\n  models = c(\"glm\", \"rpart\", \"xgboost\"),\n  metrics = c(\"accuracy\", \"logloss\"),\n  resampling = cv(v = 4, seed = 42),\n  specs = list(xgboost = xgb_spec)\n)\n\ncompare_obj\n```\n\n```{r compare-plot}\nplot(compare_obj)\n```\n\n## Interpret fitted models\n\n`interpret()` operates directly on fitted `funcml_fit` objects.\n\n```{r interpret-permute}\npermute_obj \u003c- interpret(\n  fit = fit_obj,\n  data = demo_dat,\n  method = \"permute\",\n  nsim = 20,\n  seed = 42\n)\n\nsummary(permute_obj)\n```\n\n```{r interpret-permute-plot}\nplot(permute_obj)\n```\n\nA second example shows accumulated local effects for one feature from the same fitted model.\n\n```{r interpret-ale}\nale_obj \u003c- interpret(\n  fit = fit_obj,\n  data = demo_dat,\n  method = \"ale\",\n  features = c(\"age\"),\n  type = \"prob\"\n)\n\nplot(ale_obj)\n```\n\nOther supported methods include PDP, ICE, SHAP, local explanations, surrogate models, interaction diagnostics, and calibration plots.\n\n## Inspect calibration\n\nFor classification, the same interface also supports calibration diagnostics.\n\n```{r calibration}\ncalibration_obj \u003c- interpret(\n  fit = fit_obj,\n  data = demo_dat,\n  method = \"calibration\",\n  type = \"prob\",\n  bins = 10,\n  strategy = \"quantile\"\n)\n\nplot(calibration_obj)\n```\n\n## Estimate causal effects\n\n`estimate()` extends the same framework to plug-in g-computation estimands such as the ATE.\n\nThe example below treats `smoke` as the treatment variable and `status` as the outcome, adjusting for the remaining covariates.\n\n```{r estimate-causal}\nest_obj \u003c- estimate(\n  data = demo_dat,\n  formula = status ~ smoke + diabetes + age + gender + bmi + covered_health,\n  model = \"glm\",\n  estimand = \"ATE\",\n  treatment = \"smoke\",\n  interval = \"normal\",\n  seed = 42\n)\n\nest_obj\n```\n\nBy default, `plot()` shows the model-implied potential outcome distributions\nunder treatment and control, with dashed lines marking the corresponding means.\nThe unit-level effect histogram remains available with\n`plot(est_obj, style = \"effects\")`.\n\n```{r estimate-plot}\nplot(est_obj)\n```\n\nThe same interface also supports `ATT`, `CATE`, and `IATE`.\n\n## Ensembles as first-class learners\n\nEnsembles live in the same learner registry as base models.\n\n```{r ensemble}\nstack_fit \u003c- fit(\n  status ~ age + gender + bmi + diabetes + smoke + covered_health,\n  data = demo_dat,\n  model = \"superlearner\", # or \"stacking\"\n  spec = list(\n    learners = c(\"glm\", \"rpart\", \"xgboost\", \"nnet\"),\n    learner_specs = list(xgboost = xgb_spec),\n    meta_model = \"glmnet\"\n  ),\n  seed = 42\n)\n\npredict(stack_fit, demo_dat[1:5, ], type = \"prob\")\n```\n\n## Summary\n\n`funcml` provides a compact interface for tabular machine learning in R.\n\nUse it to:\n\n* train models\n* generate predictions\n* validate performance\n* tune hyperparameters\n* compare learners\n* interpret fitted models\n* estimate causal effects\n\nThe package is designed to keep the main analysis workflow explicit. \n\n## Contributing\n\nContributions are welcome.\n\nFor development setup, coding standards, and pull request guidelines, see `CONTRIBUTING.md`.\n\n## Citation\n\nIf you use `funcml` in your work, please cite it using one of the references below.\n\n**Zenodo (preferred, citable archive):**\n```\nEL BADISY, I. (2026). funcml: Functional Machine Learning Software for R. https://doi.org/10.5281/zenodo.20707605\n```\n\n**GitHub repository:**\n```\nEl Badisy, I. (2026). funcml (Version 0.7.1) [Computer software]. https://github.com/ielbadisy/funcml\n```\n\nBibTeX:\n```\n@software{El_Badisy_funcml_2026, author = {El Badisy, Imad},\nlicense = {GPL-3.0-only},\nmonth = apr,\ntitle = {{funcml}},\ndoi = {10.5281/zenodo.20707605},\nurl = {https://doi.org/10.5281/zenodo.20707605},\nversion = {0.7.1},\nyear = {2026}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fielbadisy%2Ffuncml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fielbadisy%2Ffuncml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fielbadisy%2Ffuncml/lists"}