MXFusion
MXFusion copied to clipboard
Implement "FactorGraph.get_component(str)" method
In a few cases (namely, when building models of repeated layers), I've noticed people doing things like:
z = variables[getattr(self.model, 'inducing_inputs_' + str(layer))]
which seems a bit unsafe. A better way of accessing the components here would be to just have a getter function on the FactorGraph that returns the component of that name.
def get_component(self, name):
...
Why it is unsafe? I think it is the python way to call self.model.inducing_inputs_str(layer)
dynamically.