sporco.dictlrn.onlinecdl¶
Online dictionary learning based on CBPDN sparse coding
Classes
|
Stochastic gradient descent (SGD) based online convolutional dictionary learning, as proposed in [33]. |
|
Stochastic gradient descent (SGD) based online convolutional dictionary learning with a spatial mask, as proposed in [33]. |
Class Descriptions¶
- class sporco.dictlrn.onlinecdl.OnlineConvBPDNDictLearn(*args, **kwargs)[source]¶
Bases:
IterativeSolver
Stochastic gradient descent (SGD) based online convolutional dictionary learning, as proposed in [33].
- Parameters:
- D0array_like
Initial dictionary array
- lmbdafloat
Regularisation parameter
- opt
OnlineConvBPDNDictLearn.Options
objectAlgorithm options
- dimK0, 1, or None, optional (default None)
Number of signal dimensions in signal array passed to
solve
. If there will only be a single input signal (e.g. if S is a 2D array representing a single image) dimK must be set to 0.- dimNint, optional (default 2)
Number of spatial/temporal dimensions
- class Options(opt=None)[source]¶
Bases:
Options
Online CBPDN dictionary learning algorithm options.
Options:
Verbose
: Flag determining whether iteration status is displayed.
StatusHeader
: Flag determining whether status header and separator are displayed.
IterTimer
: Label of the timer to use for iteration times.
DictSize
: Dictionary size vector.
DataType
: Specify data type for solution variables, e.g.np.float32
.
ZeroMean
: Flag indicating whether the solution dictionary \(\{\mathbf{d}_m\}\) should have zero-mean components.
eta_a
,eta_b
: Constants \(a\) and \(b\) used in setting the SGD step size, \(\eta\), which is set to \(a / (b + i)\) where \(i\) is the iteration index. See Sec. 3 (pg. 9) of [33].
CUDA_CBPDN
: Flag indicating whether to use CUDA solver for CBPDN problem (see sporco.cuda package)
CBPDN
: Optionsadmm.cbpdn.ConvBPDN.Options
.
- Parameters:
- optdict or None, optional (default None)
OnlineConvBPDNDictLearn algorithm options
- defaults = {'CBPDN': {'AbsStopTol': 0.0, 'AutoRho': {'AutoScaling': True, 'Enabled': True, 'Period': 1, 'RsdlRatio': 1.2, 'RsdlTarget': None, 'Scaling': 1000.0, 'StdResiduals': False}, 'AuxVarObj': False, 'Callback': None, 'DataType': None, 'FastSolve': False, 'HighMemSolve': False, 'IterTimer': 'solve', 'L1Weight': 1.0, 'LinSolveCheck': False, 'MaxMainIter': 1000, 'NoBndryCross': False, 'NonNegCoef': False, 'RelStopTol': 0.001, 'RelaxParam': 1.8, 'ReturnX': False, 'StatusHeader': True, 'U0': None, 'Verbose': False, 'Y0': None, 'fEvalX': True, 'gEvalY': False, 'rho': None}, 'CUDA_CBPDN': False, 'DataType': None, 'DictSize': None, 'IterTimer': 'solve', 'StatusHeader': True, 'Verbose': False, 'ZeroMean': False, 'eta_a': 10.0, 'eta_b': 5.0}¶
Default content and allowed dict keys
- fwiter = 4¶
Field width for iteration count display column
- fpothr = 2¶
Field precision for other display columns
- itstat_fields_objfn = ('ObjFun', 'DFid', 'RegL1')¶
Fields in IterationStats associated with the objective function
- itstat_fields_alg = ('PrimalRsdl', 'DualRsdl', 'Rho', 'Cnstr', 'DeltaD', 'Eta')¶
Fields in IterationStats associated with the specific solver algorithm
- itstat_fields_extra = ()¶
Non-standard fields in IterationStats; see
itstat_extra
- init_vars(S, dimK)[source]¶
Initalise variables required for sparse coding and dictionary update for training data S.
- classmethod hdrval()[source]¶
Construct dictionary mapping display column title to IterationStats entries.
- display_config()[source]¶
Set up status display if option selected. NB: this method assumes that the first entry is the iteration count and the last is the rho value.
- class sporco.dictlrn.onlinecdl.OnlineConvBPDNMaskDictLearn(*args, **kwargs)[source]¶
Bases:
OnlineConvBPDNDictLearn
Stochastic gradient descent (SGD) based online convolutional dictionary learning with a spatial mask, as proposed in [33].
- Parameters:
- D0array_like
Initial dictionary array
- lmbdafloat
Regularisation parameter
- opt
OnlineConvBPDNDictLearn.Options
objectAlgorithm options
- dimK0, 1, or None, optional (default None)
Number of signal dimensions in signal array passed to
solve
. If there will only be a single input signal (e.g. if S is a 2D array representing a single image) dimK must be set to 0.- dimNint, optional (default 2)
Number of spatial/temporal dimensions
- class Options(opt=None)[source]¶
Bases:
Options
Online masked CBPDN dictionary learning algorithm options.
Options are the same as those of
OnlineConvBPDNDictLearn.Options
, except for
CBPDN
: Optionsadmm.cbpdn.ConvBPDNMaskDcpl.Options
.
- Parameters:
- optdict or None, optional (default None)
OnlineConvBPDNMaskDictLearn algorithm options
- defaults = {'CBPDN': {'AbsStopTol': 0.0, 'AutoRho': {'AutoScaling': False, 'Enabled': False, 'Period': 10, 'RsdlRatio': 10.0, 'RsdlTarget': None, 'Scaling': 2.0, 'StdResiduals': False}, 'AuxVarObj': False, 'Callback': None, 'DataType': None, 'FastSolve': False, 'HighMemSolve': False, 'IterTimer': 'solve', 'L1Weight': 1.0, 'LinSolveCheck': False, 'MaxMainIter': 1000, 'NoBndryCross': False, 'NonNegCoef': False, 'RelStopTol': 0.001, 'RelaxParam': 1.8, 'ReturnVar': 'Y1', 'ReturnX': True, 'StatusHeader': True, 'U0': None, 'Verbose': False, 'Y0': None, 'fEvalX': True, 'gEvalY': False, 'rho': 1.0}, 'CUDA_CBPDN': False, 'DataType': None, 'DictSize': None, 'IterTimer': 'solve', 'StatusHeader': True, 'Verbose': False, 'ZeroMean': False, 'eta_a': 10.0, 'eta_b': 5.0}¶
Default content and allowed dict keys