Git Product home page Git Product logo

lfda's Introduction

Travis-CI Build Status Coverage Status CRAN_Status_Badge License

lfda

R package for performing and visualizing Local Fisher Discriminant Analysis, Kernel Local Fisher Discriminant Analysis, and Semi-supervised Local Fisher Discriminant Analysis.

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.

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')

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.

lfda's People

Contributors

terrytangyuan avatar zachmayer avatar

Watchers

James Cloos avatar  avatar

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.