MyNixOS website logo
Description
Random Projection with Classification
Performs random projection using Johnson-Lindenstrauss (JL) Lemma (see William B.Johnson and Joram Lindenstrauss (1984) <doi:10.1090/conm/026/737400>). Random Projection is a dimension reduction technique, where the data in the high dimensional space is projected into the low dimensional space using JL transform. The original high dimensional data matrix is multiplied with the low dimensional projection matrix which results in reduced matrix. The projection matrix can be generated using the projection function that is independent to the original data. Then finally apply the classification task on the projected data.

RandPro

The goal of RandPro is to provide the platform for R users to perform random projection (RP) based feature extraction with ease and simple functions. Random Projection is one of the projection based feature extraction technique where the projection matrix is filled with independent and identically distributed (i.i.d) random values. Even though the projection is random, RP nearly preserves all the pairwise distance between any two samples in the projected low dimensional subspace with the controlled amount of error. RP even outperforms principal component analysis (PCA) in very high dimensional data analysis and streaming applications.

Functions in RandPro

dimension() - determines the number of dimension required to project the data in low dimensional space using Johnson-Lindenstrauss Lemma.

form_matrix() - creates a projection matrix filled with four suitable distributions that are primarily used in the research community.

classify() - performs the classification with random projection based feature extraction. It uses classifiers in the caret package.

Installation

You can install the released version of RandPro from CRAN with:

install.packages("RandPro")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("cran/RandPro")

Example - IRIS dataset

This is a basic example which shows you how to perform random projection based feature extraction with classification

# Load Library
library(RandPro)
## Loading required package: caret

## Loading required package: lattice

## Loading required package: ggplot2
#Load Iris Data
data("iris")
#Split the data into training set and test set of 75:25 ratio.
set.seed(101)
sample <- sample.int(n = nrow(iris), size = floor(.75*nrow(iris)), replace = FALSE)
trainn <- iris[sample, ]
testt <- iris[-sample,]
#Extract the train label and test label
trainl <- trainn$Species
testl <- testt$Species
typeof(trainl)
#Remove the label from training set and test set
trainn <- trainn[,1:4]
testt <- testt[,1:4]
#classify the Iris data with default K-NN Classifier.
res <- classify(trainn,testt,trainl,testl)
## Function uses default value 0.5 for epsilon

## Function uses Gaussian Projection function

## Function uses default K-NN classifier
res

Additional Information

The detailed explanation of the RandPro package and its functions are available in this manual - Click here.

Metadata

Version

0.2.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows