This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

WaveletBestBasis

WaveletBestBasis[dwd]
computes a best basis representation in the DiscreteWaveletData object dwd.
WaveletBestBasis
computes a best basis representation using the cost specification cspec.
  • Properties related to best basis include:
"BasisIndex"wavelet indices used for inverse transform
"BestBasisBlockView"block grid view of best basis
"BestBasisCostValues"cost value for each wavelet coefficient
"TreeView"tree view of decomposition with best basis highlighted
  • Possible cspec values include:
"ShannonEntropy"Shannon entropy
"LogEnergy"log energy
{"Norm",p}norm like for and for
{"Threshold",}number of elements above
fnapply fn to each coefficient array to get a cost value
  • A cost function fn must satisfy and .
  • The best basis is a complete basis for the wavelet decomposition giving the least total cost.
Compute an optimal wavelet basis:
Compare default basis with best basis in a tree plot of all coefficients:
Compute an optimal wavelet basis:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
Compare default basis with best basis in a tree plot of all coefficients:
In[3]:=
Click for copyable input
Out[3]=
Compute an optimal wavelet basis for vector data:
The best basis is stored in the resulting DiscreteWaveletData object:
Show the coefficient array corresponding to each index in the basis:
Wavelet packet transforms give a DiscreteWaveletData object that includes a default basis:
The basis includes all coefficients at the highest level of refinement:
WaveletBestBasis gives a new DiscreteWaveletData object with a different, optimal basis:
Compute best basis for packet transforms with any number of levels of refinement:
Compute wavelet basis, minimizing log-energy for an image:
Compare default basis with best basis in a hierarchical grid layout of coefficient images:
Compute best basis with custom cost function:
Choose basis with fewest coefficients lying between -1 and 1:
Count values lying between -1 and 1 in default basis:
Best basis:
WaveletBestBasis gives the optimal basis among all possible wavelet bases:
Recursively enumerate all possible wavelet bases for levels of refinement:
Show the 5 possible wavelet bases for 2 levels of refinement:
The number of possible bases grows extremely quickly as a function of refinement level:
Cost value of optimal basis:
Distribution of cost values of a random sample of 1000 bases:
Apply cost functions to coefficients with fixed total energy:
Plot cost as a function of first component energy for :
:
:
:
In general, each cost function can lead to a different best basis:
Plot distribution of energy among best basis coefficient values for each cost function:
Different cost functions often lead to similar best bases:
Define a custom cost function that favors coefficients that are nearer to integers:
Best basis for list data using custom cost function:
The computed cost value for the coefficient is the custom cost value of the original data:
Cost value of the best basis coefficients:
The best basis coefficients are clustered around integers:
Reproduce the built-in cost functions as custom ones:
:
:
:
:
Explicitly specify the full wavelet basis:
The specified basis is taken to be the best basis:
Select a basis containing the specified wavelet indexes:
The smallest full basis containing the specified indexes is chosen:
Use WaveletBestBasis to choose a wavelet basis for threshold-based data compression:
Use a hard threshold of 0.1:
Count nonzero values in thresholded coefficients as a measure of compression:
Compare with compression by thresholding original data:
Plot original and reconstructed data:
Compare threshold-based compression for various threshold values :
Use the same threshold value for best basis selection and thresholding:
Show reconstructed data along with the number of nonzero values as a measure of compression:
Length of uncompressed original data:
Simple lossy image compression for various threshold values :
Show reconstructed data along with the number of nonzero values as a measure of compression:
Total number of pixel values in all channels of original image:
The best basis coefficients typically contain fewer, larger nonzero values than the original data:
Compare default basis for wavelet packet transforms with best basis:
Compare with the basis for non-packet wavelet transforms:
Non-packet transforms give a DiscreteWaveletData object with a permanently fixed basis:
The basis includes the detail coefficients and the last coarse coefficient :
The result of WaveletBestBasis[dwd] has exactly the same wavelet coefficients as dwd:
Only the wavelet basis is different:
The coefficient of is the cost value of the original data:
Directly compute log-energy from the data:
The log-energy of the best basis is lower than that of the data:
DiscreteWaveletTransform does not compute the full tree of wavelet coefficients:
Use DiscreteWaveletPacketTransform to get the full tree:
The cost function must be additive with respect to Join:
The specified function is not additive:
Modify the cost function to be additive:
The cost function must be zero for zero-valued coefficients:
Modify the cost function to be compatible:
The best basis algorithm requires numeric coefficients:
Use specific numerical values:
An explicit basis specification wind needs to be consistent:
A basis cannot include both and since can be computed from :
Select a basis using a consistent wind specification:
New in 8