You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What follows is mostly mental notes re: specific implementation details of network api.
Contrary to nupic.engine.Network, which is a subclass and wrapper for the swig-generated nupic.bindings.engine_internal.Network, nupic.engine.Region is a standalone class with its own properties and behaviors independent of nupiclbindings.engine_internal.Region. Consider the following example:
You might infer from the signature of Network.addRegion() that region and region1 would be the very same instance. However, region is an instance of nupic.engine.Region whereas region1 is an instance of nupic.bindings.engine_internal.Region. The reason for this is Network.addRegion() as it is implemented at https://github.com/numenta/nupic/blob/bfa052f3d5740b3934c2dcefc566ab0906f9af2e/src/nupic/engine/__init__.py#L641-L646 calls addRegion() on the internal implementation, but then separately returns the result of self._getRegions()[name]. Network._getRegions() wraps the result of engine_internal.Network.getRegions() such that the return value is another wrapper that implements a dict-like interface.
It seems like some of the complexity can be mitigated by implementing Network.addRegion() as something like the following:
Now that the Python classes in nupic are subclasses of the SWIG classes, we can probably safely integrate them so that the SWIG interface provides the API we want and there is only one Python class per component.
What follows is mostly mental notes re: specific implementation details of network api.
Contrary to
nupic.engine.Network
, which is a subclass and wrapper for the swig-generatednupic.bindings.engine_internal.Network
,nupic.engine.Region
is a standalone class with its own properties and behaviors independent ofnupiclbindings.engine_internal.Region
. Consider the following example:You might infer from the signature of
Network.addRegion()
thatregion
andregion1
would be the very same instance. However,region
is an instance ofnupic.engine.Region
whereasregion1
is an instance ofnupic.bindings.engine_internal.Region
. The reason for this isNetwork.addRegion()
as it is implemented at https://github.com/numenta/nupic/blob/bfa052f3d5740b3934c2dcefc566ab0906f9af2e/src/nupic/engine/__init__.py#L641-L646 callsaddRegion()
on the internal implementation, but then separately returns the result ofself._getRegions()[name]
.Network._getRegions()
wraps the result ofengine_internal.Network.getRegions()
such that the return value is another wrapper that implements a dict-like interface.It seems like some of the complexity can be mitigated by implementing
Network.addRegion()
as something like the following:Or:
The text was updated successfully, but these errors were encountered: