skPartialPCA_step: take a step in sklearn IncrementalPCA partial fit procedure

Description Usage Arguments Value Note Examples

View source: R/skPartial.R

Description

take a step in sklearn IncrementalPCA partial fit procedure

Usage

1
skPartialPCA_step(mat, n_components, obj)

Arguments

mat

a matrix – can be R matrix or numpy.ndarray

n_components

number of PCA to retrieve

obj

sklearn.decomposition.IncrementalPCA instance

Value

trained IncrementalPCA reference, to which 'transform' method can be applied to obtain projection for any compliant input

Note

if obj is missing, the process is initialized with the matrix provided

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
# these steps are not basilisk-compliant, you need to acquire references 
irloc = system.file("csv/iris.csv", package="BiocSklearn")
irismat = SklearnEls()$np$genfromtxt(irloc, delimiter=',')
ta = SklearnEls()$np$take
ipc = skPartialPCA_step(ta(irismat,0:49,0L))
ipc = skPartialPCA_step(ta(irismat,50:99,0L), obj=ipc)
ipc = skPartialPCA_step(ta(irismat,100:149,0L), obj=ipc)
head(names(ipc))
ipc$transform(ta(irismat,0:5,0L))
fullproj = ipc$transform(irismat)
fullpc = prcomp(data.matrix(iris[,1:4]))$x
round(cor(fullpc,fullproj),3)

## End(Not run)

BiocSklearn documentation built on Nov. 8, 2020, 7:52 p.m.