Best Basis
WaveletsExt.BestBasis.BB
WaveletsExt.BestBasis.BBCost
WaveletsExt.BestBasis.BestBasisType
WaveletsExt.BestBasis.CostFunction
WaveletsExt.BestBasis.DifferentialEntropyCost
WaveletsExt.BestBasis.JBB
WaveletsExt.BestBasis.JBBCost
WaveletsExt.BestBasis.LSDB
WaveletsExt.BestBasis.LSDBCost
WaveletsExt.BestBasis.LogEnergyEntropyCost
WaveletsExt.BestBasis.LoglpCost
WaveletsExt.BestBasis.NormCost
WaveletsExt.BestBasis.ShannonEntropyCost
WaveletsExt.BestBasis.bestbasis_treeselection
WaveletsExt.BestBasis.bestbasistreeall
WaveletsExt.BestBasis.coefcost
WaveletsExt.BestBasis.delete_subtree!
WaveletsExt.BestBasis.tree_costs
Cost functions and computations
Public API
WaveletsExt.BestBasis.CostFunction
— TypeWaveletsExt.BestBasis.LSDBCost
— TypeLSDBCost <: CostFunction
Cost function abstract type specifically for LSDB.
See also: CostFunction
, JBBCost
, BBCost
WaveletsExt.BestBasis.JBBCost
— TypeJBBCost <: CostFunction
Cost function abstract type specifically for JBB.
See also: CostFunction
, LSDBCost
, BBCost
WaveletsExt.BestBasis.BBCost
— TypeBBCost <: CostFunction
Cost function abstract type specifically for BB.
See also: CostFunction
, LSDBCost
, JBBCost
WaveletsExt.BestBasis.LoglpCost
— TypeLoglpCost <: JBBCost
$\log \ell^p$ information cost used for JBB. Typically, we set p=2
as in Wickerhauser's original algorithm.
See also: CostFunction
, JBBCost
, NormCost
WaveletsExt.BestBasis.NormCost
— TypeNormCost <: JBBCost
$p$-norm information cost used for JBB.
See also: CostFunction
, JBBCost
, LoglpCost
WaveletsExt.BestBasis.DifferentialEntropyCost
— TypeDifferentialEntropyCost <: LSDBCost
Differential entropy cost used for LSDB.
See also: CostFunction
, LSDBCost
WaveletsExt.BestBasis.ShannonEntropyCost
— TypeShannonEntropyCost <: LSDBCost
Shannon entropy cost used for BB.
See also: CostFunction
, BBCost
, LogEnergyEntropyCost
WaveletsExt.BestBasis.LogEnergyEntropyCost
— TypeLogEnergyEntropyCost <: LSDBCost
Log energy entropy cost used for BB.
See also: CostFunction
, BBCost
, ShannonEntropyCost
WaveletsExt.BestBasis.tree_costs
— Functiontree_costs(X, method)
Returns the cost of each node in a binary tree in order to find the best basis.
Arguments
X::AbstractArray{T} where T<:AbstractFloat
: A set of decomposed signals, of sizes(n,L,k)
for 1D signals or(n,m,L,k)
for 2D signals, where:n
: Length of signal (1D) or vertical length of signal (2D).m
: Horizontal length of signal (2D).L
: Number of decomposition levels plus 1 (for standard wavelet decomposition) or number of nodes in the tree (for redundant transforms such as ACWT and SWT).k
: Number of signals.
method::BestBasisType
: Type of best basis, ie.BB()
,JBB()
orLSDB()
.
For standard best basis (BB()
), only one signal is processed each time, and therefore the inputs X
should have dimensions (n,L)
or (n,m,L)
instead.
Returns
Vector{T}
: A vector containing the costs at each node.
Examples
using Wavelets, WaveletsExt
X = generatesignals(:heavisine, 6) |> x -> duplicatesignals(x, 5, 2, true)
wt = wavelet(WT.db4)
Xw = wpdall(X, wt)
tree_costs(Xw, JBB())
tree_costs(Xw, LSDB())
See also: bestbasistree
, bestbasis_treeselection
Private API
WaveletsExt.BestBasis.coefcost
— Functioncoefcost(x, et[, nrm])
Arguments
x::AbstractArray{T} where T<:AbstractFloat
: An array of values to compute the cost.et::CostFunction
: Type of cost function.nrm::T where T<:AbstractFloat
: The norm of thex
. Only applicable whenet
is aBBCost
.
Returns
::T
: Cost ofx
.
See also: bestbasistree
Best Basis Tree Selection
Private API
WaveletsExt.BestBasis.bestbasis_treeselection
— Functionbestbasis_treeselection(costs, n[, type])
bestbasis_treeselection(costs, n, m[, type])
Computes the best basis tree based on the given cost vector.
Arguments
costs::AbstractVector{T}
: Vector containing costs for each node.n::Integer
: Length of signals (for 1D cases) or vertical length of signals (for 2D cases).m::Integer
: Horizontal length of signals (for 2D cases).type::Symbol
: (Default::min
) Criterion used to select the best tree. Supported types are:min
and:max
. Eg. Settingtype = :min
results in a basis tree with the lowest cost to be selected.
Returns
::BitVector
: Best basis tree selected based on cost.
See also: bestbasistree
, tree_costs
WaveletsExt.BestBasis.delete_subtree!
— Functiondelete_subtree!(bt, i, tree_type)
Deletes a subtree of the entire tree due to children's inferior costs.
Arguments
bt::BitVector
: Tree.i::Integer
: Root of the subtree to be deleted.tree_type::Symbol
: Type of tree (:binary
or:quad
).
Returns
bt::BitVector
: Tree with deleted subtree.
See also: bestbasistree
, bestbasis_treeselection
Best basis computation
Public API
WaveletsExt.BestBasis.BestBasisType
— TypeWaveletsExt.BestBasis.LSDB
— TypeLSDB([; cost, redundant])
Least Statistically Dependent Basis (LSDB).
Keyword Arguments
cost::LSDBCost
: (Default:DifferentialEntropyCost()
) Cost function for LSDB.redundant::Bool
: (Default:false
) Whether the performed wavelet transform is redundant. Setredundant=true
when running LSDB with redundant wavelet transforms such as SWT or ACWT.
See also: BestBasisType
, JBB
, BB
WaveletsExt.BestBasis.JBB
— TypeJBB([; cost, redundant])
Joint Best Basis (JBB).
Keyword Arguments
cost::JBBCost
: (Default:LoglpCost(2)
) Cost function for JBB.redundant::Bool
: (Default:false
) Whether the performed wavelet transform is redundant. Setredundant=true
when running LSDB with redundant wavelet transforms such as SWT or ACWT.
See also: BestBasisType
, LSDB
, BB
WaveletsExt.BestBasis.BB
— TypeBB([; cost, redundant])
Standard Best Basis (BB).
Keyword Arguments
cost::BBCost
: (Default:ShannonEntropyCost()
) Cost function for BB.redundant::Bool
: (Default:false
) Whether the performed wavelet transform is redundant. Setredundant=true
when running LSDB with redundant wavelet transforms such as SWT or ACWT.
See also: BestBasisType
, LSDB
, JBB
Wavelets.Threshold.bestbasistree
— Functionbestbasistree(X[, method])
Extension to the best basis tree function from Wavelets.jl. Given a set of decomposed signals, returns different types of best basis trees based on the methods specified. Available methods are the joint best basis (JBB
), least statistically dependent basis (LSDB
), and individual regular best basis (BB
).
Arguments
X::AbstractArray{T} where T<:AbstractFloat
: A set of decomposed signals, of sizes(n,L,k)
for 1D signals or(n,m,L,k)
for 2D signals, where:n
: Length of signal (1D) or vertical length of signal (2D).m
: Horizontal length of signal (2D).L
: Number of decomposition levels plus 1 (for standard wavelet decomposition) or number of nodes in the tree (for redundant transforms such as ACWT and SWT).k
: Number of signals.
method::BestBasisType
: Type of best basis, ie.BB()
,JBB()
orLSDB()
.
For standard best basis (BB()
), this current function can only process one signal at a time, ie. the input X
should have dimensions (n,L)
or (n,m,L)
. To process multiple signals using one function, see bestbasistreeall
.
Returns
::BitVector
: Best basis tree.
Examples
using Wavelets, WaveletsExt
X = generatesignals(:heavisine, 6) |> x -> duplicatesignals(x, 5, 2, true)
wt = wavelet(WT.db4)
Xw = wpdall(X, wt)
bestbasistree(Xw, JBB())
bestbasistree(Xw, LSDB())
See also: getbasiscoef
, getbasiscoefall
, tree_costs
, delete_subtree!
WaveletsExt.BestBasis.bestbasistreeall
— Functionbestbasistreeall(X, method)
Compute the standard best basis tree of a set of signals.
Arguments
X::AbstractArray{T} where T<:AbstractFloat
: A set of decomposed signals, of sizes(n,L,k)
for 1D signals or(n,m,L,k)
for 2D signals, where:n
: Length of signal (1D) or vertical length of signal (2D).m
: Horizontal length of signal (2D).L
: Number of decomposition levels plus 1 (for standard wavelet decomposition) or number of nodes in the tree (for redundant transforms such as ACWT and SWT).k
: Number of signals.
method::BB
: Standard best basis method, eg.BB()
.
Returns
::BitMatrix
:(nₜ,k)
matrix where each column corresponds to a tree.
Examples
using Wavelets, WaveletsExt
X = generatesignals(:heavisine, 6) |> x -> duplicatesignals(x, 5, 2, true)
wt = wavelet(WT.db4)
Xw = wpdall(X, wt)
bestbasistreeall(Xw, BB())
Xw = swpdall(X, wt)
bestbasistree(Xw, BB(redundant=true))
See also: bestbasistree