__init__(self,
name,
get_model_prep,
get_data_prep,
get_ll,
optimize,
OnLL,
OnIteration,
OnOptimized)
(Constructor)
| source code
|
@param name: string to identify the algorithm
@param get_model_prep: func(model=None, modeltree=None) -> model_prep
model: qubx.model.QubModel
modeltree: qubx.tree.Node containing QMF (only if no model provided)
model_prep: object derived from model, ready for computation, with fields:
.source: the input QubModel, if provided
.model: a private QubModel copy
.modeltree: QMF tree, even if not provided
since rates change so much more often, my algorithms re-use the rest of the prep when possible, by defining these fields:
.K0, .K1, .K2: numpy.matrix of rate constants
.set_rates(K0, K1): updates .K0, .K1, and .model
.set_rates2(K0, K1, K2): preferred newer form for pressure sensitivity
@param get_data_prep: func(segs, model_prep, wait=True, receiver=lambda dp: None) -> data_prep
segs: list of qubx.data_types.SourceSeg
model_prep: result of get_model_prep, since signal layout may depend on model stimuli
wait: False to return immediately
receiver: if wait, this function is called with data_prep when it's ready (on gobject thread)
data_prep: object with prepared data, ready for computation, with fields:
.segs: input the list of SourceSeg
.model_prep: input prepared model
and whatever else the algorithm needs, e.g. sampled or idealized data
@param get_ll: func(model_prep=None, data_prep=None, wait=True, receiver=lambda LL: None, on_trial, **kw) -> LL
evaluates the score for given model and data; fills them in from onscreen sources if not provided.
wait: False to return immediately
receiver: if wait == False: func(LL) called when computation is done
on_trial: func(model_tree, row_dict) with completed trial info
**kw: other keywords to apply to properties before running; e.g. use_Peq=True
@param optimize: func(model_prep=None, data_prep=None, wait=True, receiver=lambda LL: None, ext_return=False, on_trial, **kw) -> LL
iterates, adjusting parameters to improve LL for given model and data; fills them in from onscreen sources if not provided.
wait: False to return immediately
receiver: if wait == False: func(result--see ext_return) called when computation is done
ext_return: True to return the tuple (LL, iterations, grads, hessian); False to return LL
on_trial: func(model_tree, row_dict) with completed trial info
**kw: other keywords to apply to properties before running; e.g. use_Peq=True
@param OnLL: L{WeakEvent}(LL) when get_ll completes
@param OnIteration: L{WeakEvent}(iterations, LL, grads) each iteration during opt
@param OnOptimized: L{WeakEvent}(iterations, LL, grads, hessian) when optimize completes
- Overrides:
object.__init__
|