PPPDiffRef | R Documentation |
Apply the diff w.r.t. a ref transformation.
Transform a dataset such that all 'lower' dimensions are replaced by the 'ref' dimension minus the 'lower'; and all 'upper' dimensions are replaced by 'upper' minus 'ref'.
SBCK::PrePostProcessing
-> PPPDiffRef
ref
[integer] The reference column
lower
[vector integer] Dimensions lower than ref
upper
[vector integer] Dimensions upper than ref
new()
Create a new PPPDiffRef object.
PPPDiffRef$new(ref, lower = NULL, upper = NULL, ...)
ref
The reference column
lower
Dimensions lower than ref
upper
Dimensions upper than ref
...
Others arguments are passed to PrePostProcessing
A new 'PPPDiffRef' object.
transform()
Apply the DiffRef transform.
PPPDiffRef$transform(X)
X
Data to transform
Xt a transformed matrix
itransform()
Apply the DiffRef inverse transform.
PPPDiffRef$itransform(Xt)
Xt
Data to transform
X a transformed matrix
clone()
The objects of this class are cloneable with this method.
PPPDiffRef$clone(deep = FALSE)
deep
Whether to make a deep clone.
## Parameters
size = 2000
nfeat = 5
sign = base::sample( base::c(-1,1) , nfeat - 1 , replace = TRUE )
## Build data
X = matrix( stats::rnorm( n = size ) , ncol = 1 )
for( s in sign )
{
X = base::cbind( X , X[,1] + s * base::abs(matrix( stats::rnorm(n = size) , ncol = 1 )) )
}
## PPP
lower = which( sign == 1 ) + 1
upper = which( sign == -1 ) + 1
ppp = SBCK::PPPDiffRef$new( ref = 1 , lower = lower , upper = upper )
Xt = ppp$transform(X)
Xti = ppp$itransform(Xt)
print( base::max( base::abs( X - Xti ) ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.