{"id":33906943,"url":"https://github.com/techtonique/unifiedml","last_synced_at":"2026-04-04T15:02:19.178Z","repository":{"id":322532672,"uuid":"1089769913","full_name":"Techtonique/unifiedml","owner":"Techtonique","description":"Unified Machine Learning interface for any R model","archived":false,"fork":false,"pushed_at":"2026-04-03T15:04:00.000Z","size":504,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T17:43:19.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.techtonique.net/unifiedml/","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/Techtonique.png","metadata":{"files":{"readme":"README.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-04T19:38:18.000Z","updated_at":"2026-04-03T15:04:05.000Z","dependencies_parsed_at":"2026-04-03T15:04:13.188Z","dependency_job_id":null,"html_url":"https://github.com/Techtonique/unifiedml","commit_stats":null,"previous_names":["techtonique/unifiedml"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Techtonique/unifiedml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techtonique%2Funifiedml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techtonique%2Funifiedml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techtonique%2Funifiedml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techtonique%2Funifiedml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Techtonique","download_url":"https://codeload.github.com/Techtonique/unifiedml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techtonique%2Funifiedml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31403952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: 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":[],"created_at":"2025-12-12T02:14:50.484Z","updated_at":"2026-04-04T15:02:19.161Z","avatar_url":"https://github.com/Techtonique.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unifiedml\n\n\u003e A Unified Machine Learning Interface for R\n\n[![](https://cranlogs.r-pkg.org/badges/unifiedml)](https://cran.r-project.org/package=unifiedml)\n[![](https://cranlogs.r-pkg.org/badges/grand-total/unifiedml)](https://cranlogs.r-pkg.org/badges/grand-total/unifiedml)\n[![Documentation](https://img.shields.io/badge/documentation-is_here-green)](http://docs.techtonique.net/unifiedml/index.html)\n\n## Overview\n\n`unifiedml` provides a (work in progress) consistent, sklearn-like interface for various (any) machine learning models in R. \n\nIt eliminates the need to remember different function signatures across packages by **automatically detecting the appropriate interface** (formula vs matrix) and **task type** (regression vs classification).\n\n### Key Features\n\nFor now: \n\n- **Automatic Task Detection**: Automatically detects regression vs classification based on response variable type (numeric → regression, factor → classification)\n- **Universal Interface**: Works seamlessly with `glmnet`, `randomForest`, `e1071::svm`, and other popular ML packages with formula or matrix interface\n- **Built-in Cross-Validation**: Consistent `cross_val_score()` function with automatic metric selection\n- **Model Interpretability**: Numerical derivatives and statistical significance testing via `summary()`\n- **Partial Dependence Plots**: Visualize feature effects with `plot()`\n- **Method Chaining**: Clean, pipeable syntax with R6 classes\n\n## Installation\n\n- From CRAN: \n\n  ```R\n  install.packages(\"unifiedml\")\n  ```\n  \n- From Github (development version):\n  \n  ```R\n  # Install from GitHub (development version, for now)\n  devtools::install_github(\"Techtonique/unifiedml\")\n  ```\n\n## Quick Start\n\n### Regression Example\n\n```R\nlibrary(unifiedml)\nlibrary(glmnet)\n\n# Prepare data\ndata(mtcars)\nX \u003c- as.matrix(mtcars[, -1])\ny \u003c- mtcars$mpg  # numeric → automatic regression\n\n# Fit model\nmod \u003c- Model$new(glmnet::glmnet)\nmod$fit(X, y, alpha = 0, lambda = 0.1)\n\n# Make predictions\npredictions \u003c- mod$predict(X)\n\n# Get model summary with feature importance\nmod$summary()\n\n# Visualize partial dependence\nmod$plot(feature = 1)\n\n# Cross-validation (automatically uses RMSE for regression)\ncv_scores \u003c- cross_val_score(mod, X, y, cv = 5)\ncat(\"Mean RMSE:\", mean(cv_scores), \"\\n\")\n```\n\n### Classification Example\n\n```R\nlibrary(randomForest)\n\n# Prepare data\ndata(iris)\nX \u003c- as.matrix(iris[, 1:4])\ny \u003c- iris$Species  # factor → automatic classification\n\n# Fit model\nmod \u003c- Model$new(randomForest::randomForest)\nmod$fit(X, y, ntree = 100)\n\n# Make predictions\npredictions \u003c- mod$predict(X)\n\n# Get model summary\nmod$summary()\n\n# Cross-validation (automatically uses accuracy for classification)\ncv_scores \u003c- cross_val_score(mod, X, y, cv = 5)\ncat(\"Mean Accuracy:\", mean(cv_scores), \"\\n\")\n```\n\n## Core Functionality\n\n### The Model Class\n\nThe `Model` R6 class provides a unified interface for any machine learning function:\n\n```R\n# Create a model wrapper\nmod \u003c- Model$new(model_function)\n\n# Fit the model (task type auto-detected from y)\nmod$fit(X, y, ...)\n\n# Make predictions\npredictions \u003c- mod$predict(X_new)\n\n# Get interpretable summary\nmod$summary(h = 0.01, alpha = 0.05)\n\n# Visualize feature effects\nmod$plot(feature = 1)\n\n# Print model info\nmod$print()\n```\n\n### Cross-Validation\n\nThe `cross_val_score()` function provides consistent k-fold cross-validation:\n\n```R\n# Automatic metric selection based on task\nscores \u003c- cross_val_score(mod, X, y, cv = 5)\n\n# Specify custom metric\nscores \u003c- cross_val_score(mod, X, y, cv = 10, scoring = \"mae\")\n\n# Available metrics:\n# - Regression: \"rmse\" (default), \"mae\"\n# - Classification: \"accuracy\" (default), \"f1\"\n```\n\n### Model Interpretability\n\nThe `summary()` method uses numerical derivatives to assess feature importance:\n\n```R\nmod$summary()\n# Output:\n# Model Summary - Numerical Derivatives\n# ======================================\n# Task: regression\n# Samples: 150 | Features: 4\n# \n# Feature         Mean_Derivative  Std_Error  t_value  p_value  Significance\n# Sepal.Length    0.523           0.042       12.45    \u003c 0.001  ***\n# Sepal.Width    -0.234           0.038       -6.16    \u003c 0.001  ***\n# ...\n```\n\n## Supported Models\n\n`unifiedml` automatically detects the appropriate interface for:\n\n- **glmnet**: Ridge, Lasso, Elastic Net regression and classification\n- **randomForest**: Random forest for regression and classification\n- **e1071::svm**: Support Vector Machines\n- **Any model** with either formula (`y ~ .`) or matrix (`x, y`) interface\n\n## Automatic Task Detection\n\nThe package automatically determines the task type:\n\n```R\n# Regression (numeric y)\ny_reg \u003c- c(1.2, 3.4, 5.6, ...)\nmod$fit(X, y_reg)  # → task = \"regression\"\n\n# Classification (factor y)\ny_class \u003c- factor(c(\"A\", \"B\", \"A\", ...))\nmod$fit(X, y_class)  # → task = \"classification\"\n```\n\n## Advanced Features\n\n### Partial Dependence Plots\n\n```R\n# Visualize how feature j affects predictions\nmod$plot(feature = 3, n_points = 100)\n```\n\n### Model Cloning\n\n```R\n# Create independent copy for parallel processing\nmod_copy \u003c- mod$clone_model()\n```\n\n## Examples\n\nSee the package vignette for comprehensive examples:\n\n```R\nvignette(\"introduction\", package = \"unifiedml\")\n```\n\n## Why unifiedml?\n\nTraditional R modeling requires remembering different interfaces:\n\n```R\n# Different interfaces = cognitive overhead\nglmnet(x = X, y = y, ...)               # matrix interface\nrandomForest(y ~ ., data = df, ...)     # formula interface\nsvm(x = X, y = y, ...)                  # matrix interface\n```\n\nWith `unifiedml`, it's always the same:\n\n```R\n# One interface to rule them all\nModel$new(glmnet)$fit(X, y, ...)\nModel$new(randomForest)$fit(X, y, ...)\nModel$new(svm)$fit(X, y, ...)\n```\n\n## Contributing\n\nContributions are welcome, feel free to submit a Pull Request.\n\n## License\n\nThe Clear BSD License - see LICENSE file for details.\n\n## Citation\n\nIf you use this package in your research, please cite:\n\n```\n@Manual{unifiedml,\n  title = {unifiedml: Unified Machine Learning Interface for R},\n  author = {T. Moudiki},\n  year = {2025},\n  note = {R package version 0.1.0}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechtonique%2Funifiedml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechtonique%2Funifiedml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechtonique%2Funifiedml/lists"}