Package paramz :: Package core :: Module indexable :: Class Indexable
[hide private]
[frames] | no frames]

Class Indexable

source code


Make an object constrainable with Priors and Transformations.

TODO: Mappings!! (As in ties etc.)

Adding a constraint to a Parameter means to tell the highest parent that the constraint was added and making sure that all parameters covered by this object are indeed conforming to the constraint.

:func:`constrain()` and :func:`unconstrain()` are main methods here

Instance Methods [hide private]
 
__init__(self, name, default_constraint=None, *a, **kw)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__setstate__(self, state) source code
 
add_index_operation(self, name, operations)
Add index operation with name to the operations given.
source code
 
_add_io(self, name, operations) source code
 
remove_index_operation(self, name) source code
 
_disconnect_parent(self, *args, **kw)
From Parentable: disconnect the parent and set the new constraints to constr
source code
 
_offset_for(self, param)
Return the offset of the param inside this parameterized object.
source code
 
_raveled_index_for(self, param)
get the raveled index for a param that is an int array, containing the indexes for the flattened param inside this parameterized logic.
source code
 
_raveled_index_for_transformed(self, param)
get the raveled index for a param for the transformed parameter array (optimizer array).
source code
 
_raveled_index(self)
Flattened array of ints, specifying the index of this object.
source code
 
_parent_changed(self, parent)
From Parentable: Called when the parent changed
source code
 
_add_to_index_operations(self, which, reconstrained, what, warning)
Helper preventing copy code.
source code
 
_remove_from_index_operations(self, which, transforms)
Helper preventing copy code.
source code

Inherited from nameable.Nameable: hierarchy_name

Inherited from gradcheckable.Gradcheckable: checkgrad

Inherited from gradcheckable.Gradcheckable (private): _checkgrad

Inherited from pickleable.Pickleable: __deepcopy__, __getstate__, copy, pickle

Inherited from parentable.Parentable: has_parent

Inherited from parentable.Parentable (private): _notify_parent_change

Inherited from updateable.Updateable: toggle_update, trigger_update, update_model, update_toggle

Inherited from observable.Observable: add_observer, change_priority, notify_observers, remove_observer, set_updates

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from parentable.Parentable: _parent_, _parent_index_

Properties [hide private]

Inherited from nameable.Nameable: name

Inherited from parentable.Parentable: _highest_parent_

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, default_constraint=None, *a, **kw)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__setstate__(self, state)

source code 
Overrides: pickleable.Pickleable.__setstate__

add_index_operation(self, name, operations)

source code 

Add index operation with name to the operations given.

raises: attribute error if operations exist.

_disconnect_parent(self, *args, **kw)

source code 

From Parentable: disconnect the parent and set the new constraints to constr

Overrides: parentable.Parentable._disconnect_parent

_offset_for(self, param)

source code 

Return the offset of the param inside this parameterized object. This does not need to account for shaped parameters, as it basically just sums up the parameter sizes which come before param.

_raveled_index_for(self, param)

source code 

get the raveled index for a param that is an int array, containing the indexes for the flattened param inside this parameterized logic.

!Warning! be sure to call this method on the highest parent of a hierarchy, as it uses the fixes to do its work

_raveled_index_for_transformed(self, param)

source code 

get the raveled index for a param for the transformed parameter array (optimizer array).

that is an int array, containing the indexes for the flattened param inside this parameterized logic.

!Warning! be sure to call this method on the highest parent of a hierarchy, as it uses the fixes to do its work. If you do not know what you are doing, do not use this method, it will have unexpected returns!

_raveled_index(self)

source code 

Flattened array of ints, specifying the index of this object. This has to account for shaped parameters!

_parent_changed(self, parent)

source code 

From Parentable: Called when the parent changed

update the constraints and priors view, so that constraining is automized for the parent.

Overrides: parentable.Parentable._parent_changed

_add_to_index_operations(self, which, reconstrained, what, warning)

source code 

Helper preventing copy code. This adds the given what (transformation, prior etc) to parameter index operations which. reconstrained are reconstrained indices. warn when reconstraining parameters if warning is True. TODO: find out which parameters have changed specifically

_remove_from_index_operations(self, which, transforms)

source code 

Helper preventing copy code. Remove given what (transform prior etc) from which param index ops.