next up previous [pdf]

Next: sfsort: Sort a float/complex Up: Utilities Previous: Utilities

sfthr: Threshold float/complex inputs given a constant/varying threshold level.

sfthr < in.rsf > out.rsf fthr=fthr.rsf thr= mode=
Methods available:
- soft
- hard
- non-negative Garrote (nng)

Written by: Gilles Hennenfent & Colin Russell, UBC
Created: February 2006

string fthr= varying threshold level (positive number) (auxiliary input file name)
string mode= 'soft', 'hard', 'nng' (default: soft)
float thr= threshold level (positive number)

Consider the vector $ \mathbf{x}:=\{x_i\}_{0\leq i <m}\in\mathbb{R}^m$ . Soft thresholding is defined as

$\displaystyle \mathcal{S}_\gamma(\mathbf{x}):=\{$sign$\displaystyle (x_i)\cdot \max(\vert x_i\vert-\gamma,0)\}_{0\leq i <m},$ (1)

with $ \gamma$ a positive threshold level. Hard thresholding is defined as

$\displaystyle \mathcal{H}_\gamma(\mathbf{x}):=\{\max(\vert x_i\vert-\gamma,0)\cdot x_i\}_{0\leq i <m}.$ (2)

Finally, non-negative Garrote (nng) thresholding is defined as

$\displaystyle \mathcal{T}^{nng}_\gamma(\mathbf{x}):=\{\max(\vert x_i\vert-\gamma,0)\cdot (x_i-\gamma^2/x_i)\}_{0\leq i <m}.$ (3)

data soft hard nng
data,soft,hard,nng
Figure 1.
Thresholding example. Line whose range is symmetric about the origin (a) thresholded using soft (b), hard (c), and NNG (d) methods.
[pdf] [pdf] [pdf] [pdf] [png] [png] [png] [png] [scons]

The extension to positive varying threshold level is straightforward by replacing $ \gamma$ by $ \gamma_i$ in Eq.'s (1),(2), and (3).

In Madagascar, to soft threshold a dataset with a constant, use e.g.

bash$ sfmath n1=100 n2=1 output='1' | sfnoise rep=y >data.rsf
bash$ sfthr <data.rsf thr=2 >res1.rsf
or replace the last command by
bash$ sfthr <data.rsf thr=2 method=soft >res2.rsf
This is also equivalent to soft thresholding data.rsf with a vector of same size mythr.rsf whose entries are all set to 2.
bash$ sfmath n1=100 n2=1 output='2' >mythr.rsf
bash$ sfthr <data.rsf fthr=mythr.rsf method=soft >res3.rsf
If thr=.5 and fthr=mythr.rsf are specified at the same time, the effective threshold level is 1, obtained by multiplying mythr.rsf entries by 0.5
bash$ sfthr <data.rsf thr=.5 fthr=mythr.rsf method=soft >res4.rsf

data1 soft1 hard1 nng1
data1,soft1,hard1,nng1
Figure 2.
Random vector thresholding example.
[pdf] [pdf] [pdf] [pdf] [png] [png] [png] [png] [scons]

Note that thresholding is an element-wise operation. sfthr can thus deal with arbitrarily large datasets.


next up previous [pdf]

Next: sfsort: Sort a float/complex Up: Utilities Previous: Utilities

2016-02-16