Git Product home page Git Product logo

lfda's Introduction

Note: This package has been maintained by @terrytangyuan since 2015. Please consider sponsoring!

Coverage Status CRAN_Status_Badge Downloads from the RStudio CRAN mirror License DOI DOI

lfda

R 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.

Introduction to the algorithms and their application can be found here and here. 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.

Welcome any feedback and pull request.

Install the current release from CRAN:

install.packages('lfda')

Install the latest development version from github:

devtools::install_github('terrytangyuan/lfda')

Citation

Please call citation("lfda") in R to properly cite this software. A white paper is published on Journal of Open Source Software here.

Examples

Local Fisher Discriminant Analysis(LFDA)

Suppose 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:

k <- iris[,-5] # this matrix contains all the predictors to be transformed
y <- iris[,5] # this should be a vector that represents different classes
r <- 3 # dimensionality of the resulting matrix

# run the model, note that two other kinds metrics we can use: 'weighted' and 'orthonormalized'
model <- lfda(k, y, r, metric = "plain") 

plot(model, y) # 3D visualization of the resulting transformed data set

predict(model, iris[,-5]) # transform new data set using predict

Kernel Local Fisher Discriminant Analysis(KLFDA)

The main usage is the same except for an additional kmatrixGauss call to the original data set to perform a kernel trick:

k <- kmatrixGauss(iris[,-5])
y <- iris[,5]
r <- 3
model <- klfda(k, y, r, metric = "plain")

Note that the predict method for klfda is still under development. The plot method works the same way as in lfda.

Semi-supervised Local Fisher Discriminant Analysis(SELF)

This 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:

k <- iris[,-5]
y <- iris[,5]
r <- 3
model <- self(k, y, beta = 0.1, r = 3, metric = "plain")

The methods predict and plot work the same way as in lfda.

Integration with {ggplot2::autoplot}

{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 and scroll down to the last section for an example.

Contribute & Code of Conduct

To contribute to this project, please take a look at the Contributing Guidelines first. Please note that this project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Contact

Contact the maintainer of this package: Yuan Tang [email protected]

lfda's People

Contributors

terrytangyuan avatar zachmayer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lfda's Issues

JOSS Review: Functionality

For JOSS review. I have not been able to plot any of the example models in the README using the plot(model, y) syntax. The code runs and no errors are produced, and the model object looks ok, but plot(model, y) does not produce anything.

What could I be missing? I have all the dependencies and suggests installed.

Code Optimization

A lot of the code can be optimized, e.g. parallellization, faster eigen solver, etc, to cope with large number of classes and observations in each class.

installation problem

When I use "install.packages("lfda")" to install lfda package in Rstudio with linux, there's a problem appeared. The following is problem state:

/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'RSpectra.so' failed
make: *** [RSpectra.so] Error 1
ERROR: compilation failed for package ‘RSpectra’

  • removing ‘/home/vidolf/R/x86_64-pc-linux-gnu-library/3.2/RSpectra’
    Warning in install.packages :
    installation of package ‘RSpectra’ had non-zero exit status
    ERROR: dependency ‘RSpectra’ is not available for package ‘rARPACK’
  • removing ‘/home/vidolf/R/x86_64-pc-linux-gnu-library/3.2/rARPACK’
    Warning in install.packages :
    installation of package ‘rARPACK’ had non-zero exit status
    ERROR: dependency ‘rARPACK’ is not available for package ‘lfda’
  • removing ‘/home/vidolf/R/x86_64-pc-linux-gnu-library/3.2/lfda’
    Warning in install.packages :
    installation of package ‘lfda’ had non-zero exit status

The downloaded source packages are in
‘/tmp/RtmpYbpUNY/downloaded_packages’

What should I do to solve this problem?
OS:Ubuntu 16.04 with Plasma desktop
Rstudio version 1.0.143
R version 3.2.3

JOSS Review General Checks

This repository does not pass two of the general checks from the JOSS review:

  1. "License: Does the repository contain a plain-text LICENSE file with the contents of an OSI approved software license?" No. The current license is not adequate.
  2. "Version: Does the release version given match the GitHub release (v1.1.2)?" The description file lists the current version as 1.1.3.

[JOSS review] - paper

The third paragraph in the paper (PCA) suddenly uses technical terms that are common in machine learning (like "feature"). From the first two paragraphs, it was not clear that or if the application of lfda is limited to machine learning. If not, I suggest a more broad / general wording, so users in disciplines like social science or psychology feel more comfortable with the content of the paper. Please either revise the wording, or introduce a link to machine learning earlier if the applicaton of lfda is only limited to ml.

Kernel SELF (KSELF)

Applying the standard kernel trick allows us to obtain a non-linear extension of SELF called Kernel SELF (KSELF).

Add predict method for klfda

After applying kmatrixGauss to the original data matrix and then apply klfda, the resulting transforming matrix cannot be applied to new data set since the dimensions don't match. I have sent an email to Dr. Sugiyama for a solution for this.

[JOSS review]

A minor one, there seems to be a typo in the output of lfda():

The trained transforming matric is:

Is it metric or matrix?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.