PPPDiffRef {SBCK} | R Documentation |
PPPDiffRef
Description
Apply the diff w.r.t. a ref transformation.
Details
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'.
Super class
SBCK::PrePostProcessing
-> PPPDiffRef
Public fields
ref
[integer] The reference column
lower
[vector integer] Dimensions lower than ref
upper
[vector integer] Dimensions upper than ref
Methods
Public methods
Inherited methods
Method new()
Create a new PPPDiffRef object.
Usage
PPPDiffRef$new(ref, lower = NULL, upper = NULL, ...)
Arguments
ref
The reference column
lower
Dimensions lower than ref
upper
Dimensions upper than ref
...
Others arguments are passed to PrePostProcessing
Returns
A new 'PPPDiffRef' object.
Method transform()
Apply the DiffRef transform.
Usage
PPPDiffRef$transform(X)
Arguments
X
Data to transform
Returns
Xt a transformed matrix
Method itransform()
Apply the DiffRef inverse transform.
Usage
PPPDiffRef$itransform(Xt)
Arguments
Xt
Data to transform
Returns
X a transformed matrix
Method clone()
The objects of this class are cloneable with this method.
Usage
PPPDiffRef$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
## 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 ) ) )