{"id":13474890,"url":"https://github.com/terrytangyuan/lfda","last_synced_at":"2025-08-20T03:31:53.201Z","repository":{"id":36201626,"uuid":"40505861","full_name":"terrytangyuan/lfda","owner":"terrytangyuan","description":"Local Fisher Discriminant Analysis in R","archived":false,"fork":false,"pushed_at":"2023-07-07T16:53:11.000Z","size":114,"stargazers_count":76,"open_issues_count":0,"forks_count":14,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-07-08T03:25:43.587Z","etag":null,"topics":["dimensionality-reduction","distance-metric-learning","machine-learning","metric-learning","r","statistics"],"latest_commit_sha":null,"homepage":"","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/terrytangyuan.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","contributing":"CONTRIBUTING.md","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},"funding":{"github":"terrytangyuan"}},"created_at":"2015-08-10T20:58:19.000Z","updated_at":"2024-11-12T14:57:32.000Z","dependencies_parsed_at":"2022-08-24T12:20:57.472Z","dependency_job_id":"27d41a59-54d8-435a-854e-3bae0b69bc6e","html_url":"https://github.com/terrytangyuan/lfda","commit_stats":{"total_commits":109,"total_committers":3,"mean_commits":"36.333333333333336","dds":"0.25688073394495414","last_synced_commit":"0331f8bf01fd03d3a3d4ef8f32b5e9d053ed4fb3"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/terrytangyuan/lfda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrytangyuan%2Flfda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrytangyuan%2Flfda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrytangyuan%2Flfda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrytangyuan%2Flfda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terrytangyuan","download_url":"https://codeload.github.com/terrytangyuan/lfda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrytangyuan%2Flfda/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264194099,"owners_count":23571100,"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":["dimensionality-reduction","distance-metric-learning","machine-learning","metric-learning","r","statistics"],"created_at":"2024-07-31T16:01:15.712Z","updated_at":"2025-08-20T03:31:52.848Z","avatar_url":"https://github.com/terrytangyuan.png","language":"R","funding_links":["https://github.com/sponsors/terrytangyuan","https://github.com/sponsors/terrytangyuan)!"],"categories":["R"],"sub_categories":[],"readme":"**Note**: This package has been maintained by [@terrytangyuan](https://github.com/terrytangyuan) since 2015. Please [consider sponsoring](https://github.com/sponsors/terrytangyuan)!\n\n[![Coverage Status](https://coveralls.io/repos/terrytangyuan/lfda/badge.svg?branch=master)](https://coveralls.io/r/terrytangyuan/lfda?branch=master)\n[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/lfda)](https://cran.r-project.org/package=lfda)\n[![Downloads from the RStudio CRAN mirror](https://cranlogs.r-pkg.org/badges/grand-total/lfda)](https://cran.r-project.org/package=lfda)\n[![License](http://img.shields.io/:license-mit-blue.svg?style=flat)](http://badges.mit-license.org)\n[![DOI](http://joss.theoj.org/papers/10.21105/joss.01572/status.svg)](https://doi.org/10.21105/joss.01572)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3352038.svg)](https://doi.org/10.5281/zenodo.3352038)\n\n# lfda\nR package for performing and visualizing *Local Fisher Discriminant Analysis*, *Kernel Local Fisher Discriminant Analysis*, and *Semi-supervised Local Fisher Discriminant Analysis*. It's the first package with those methods implemented in native R language. It also provides visualization functions to easily visualize the dimension reduction results.\n\nIntroduction to the algorithms and their application can be found [here](https://www.gastrograph.com/resources/local-fisher-discriminant-analysis-on-beer-style-clustering) and [here](http://www.ms.k.u-tokyo.ac.jp/software.html#LFDA). These methods are widely applied in feature extraction, dimensionality reduction, clustering, classification, information retrieval, and computer vision problems. An introduction to the package is also available in Chinese [here](https://cosx.org/2015/08/a-brief-description-of-the-method-and-the-algorithm-of-the-lfda-package/).\n\nWelcome any [feedback](https://github.com/terrytangyuan/lfda/issues) and [pull request](https://github.com/terrytangyuan/lfda/pulls).  \n\n## Install the current release from CRAN:\n```{R}\ninstall.packages('lfda')\n```\n\n## Install the latest development version from github:\n```{R}\ndevtools::install_github('terrytangyuan/lfda')\n```\n\n## Citation\n\nPlease call `citation(\"lfda\")` in R to properly cite this software. A white paper is published on Journal of Open Source Software [here](http://joss.theoj.org/papers/10.21105/joss.01572). \n\n## Examples\n### Local Fisher Discriminant Analysis(LFDA)\nSuppose we want to reduce the dimensionality of the original data set (we are using `iris` data set here) to 3, then we can run the following:\n```{R}\nk \u003c- iris[,-5] # this matrix contains all the predictors to be transformed\ny \u003c- iris[,5] # this should be a vector that represents different classes\nr \u003c- 3 # dimensionality of the resulting matrix\n\n# run the model, note that two other kinds metrics we can use: 'weighted' and 'orthonormalized'\nmodel \u003c- lfda(k, y, r, metric = \"plain\") \n\nplot(model, y) # 3D visualization of the resulting transformed data set\n\npredict(model, iris[,-5]) # transform new data set using predict\n\n```\n### Kernel Local Fisher Discriminant Analysis(KLFDA)\nThe main usage is the same except for an additional `kmatrixGauss` call to the original data set to perform a kernel trick: \n```{R}\nk \u003c- kmatrixGauss(iris[,-5])\ny \u003c- iris[,5]\nr \u003c- 3\nmodel \u003c- klfda(k, y, r, metric = \"plain\")\n\n```\nNote that the `predict` method for klfda is still under development. The `plot` method works the same way as in `lfda`.\n\n### Semi-supervised Local Fisher Discriminant Analysis(SELF)\nThis algorithm requires one additional argument such as `beta` that represents the degree of semi-supervisedness. Let's assume we ignore 10% of the labels in `iris` data set:\n```{R}\nk \u003c- iris[,-5]\ny \u003c- iris[,5]\nr \u003c- 3\nmodel \u003c- self(k, y, beta = 0.1, r = 3, metric = \"plain\")\n\n```\nThe methods `predict` and `plot` work the same way as in `lfda`. \n### Integration with {ggplot2::autoplot}\n`{ggplot2::autoplot}` has been integrated with this package. Now `{lfda}` can be plotted in 2D easily and beautifully using `{ggfortify}` package. Go to [this link](http://rpubs.com/sinhrks/plot_pca) and scroll down to the last section for an example. \n\n## Contribute \u0026 Code of Conduct\n\nTo contribute to this project, please take a look at the [Contributing Guidelines](https://github.com/terrytangyuan/lfda/blob/master/CONTRIBUTING.md) first. Please note that this project is released with a [Contributor Code of Conduct](https://github.com/terrytangyuan/lfda/blob/master/CONDUCT.md). By contributing to this project, you agree to abide by its terms.\n\n## Contact\n\nContact the maintainer of this package:\nYuan Tang \u003cterrytangyuan@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterrytangyuan%2Flfda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterrytangyuan%2Flfda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterrytangyuan%2Flfda/lists"}