Skip to content

Commit

Permalink
Feat/timermechanism (#3149)
Browse files Browse the repository at this point in the history
* • recurrenttransfermechanism.py
  - _instantiate_attributes_after_function():  fix assignment of StabilityFunction, and force update of default_variable for output_port

* • recurrenttransfermechanism.py
  _instantiate_attributes_after_function:
  revise call to _update_default_variable to use energy.variable instead of value

* • recurrenttransfermechanism.py
  _instantiate_attributes_after_function:
  revise call to _update_default_variable to use energy.variable instead of value

* • composition.py
  - reset():  add clear_results arg

• timerfunctions.py
  - functions all written for python and pytorch... need llvm versions

• timerfunctions.py
  - Desmos plots updated

* Add Mechanism and Functions to support progression of integration along a trajectory

• timermechanism.py: sublass of IntegratorMechanism
• timerfunctions.py: subclass of TransferFunction
  - LinearTimer, AcceleratingTimer, DeceleratingTimer, AsymptoticTimer
• test_timer_mechanism.py

---------

Co-authored-by: jdcpni <pniintel55>
  • Loading branch information
jdcpni authored Dec 19, 2024
1 parent eb5ff88 commit 786a698
Show file tree
Hide file tree
Showing 21 changed files with 1,867 additions and 393 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def calc_prob(em_preds, test_ys):
normalize_field_weights = True, # whether to normalize the field weights during memory retrieval
normalize_memories = False, # whether to normalize the memory during memory retrieval
# normalize_memories = True, # whether to normalize the memory during memory retrieval
normalize_memories = False, # whether to normalize the memory vectors
# softmax_temperature = None, # temperature of the softmax used during memory retrieval (smaller means more argmax-like
softmax_temperature = .1, # temperature of the softmax used during memory retrieval (smaller means more argmax-like
# softmax_temperature = ADAPTIVE, # temperature of the softmax used during memory retrieval (smaller means more argmax-like
Expand Down
2 changes: 2 additions & 0 deletions docs/source/Core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Core

- `TransferFunctions`

- `TimerFunctions`

- `TransformFunctions`

- `StatefulFunctions`
Expand Down
1 change: 1 addition & 0 deletions docs/source/IntegratorMechanisms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ IntegratorMechanisms

DDM
EpisodicMemoryMechanism
TimerMechanism
1 change: 1 addition & 0 deletions docs/source/NonStatefulFunctions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Functions that do *not* depend on a previous value.
OptimizationFunctions
SelectionFunctions
TransferFunctions
TimerFunctions
TransformFunctions
10 changes: 10 additions & 0 deletions docs/source/TimerFunctions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
TimerFunctions
==============

.. toctree::
:maxdepth: 3

.. automodule:: psyneulink.core.components.functions.nonstateful.timerfunctions
:members: TimerFunction, LinearTimer, AcceleratingTimer, DeceleratingTimer, AsymptoticTimer
:private-members:
:exclude-members: Parameters
7 changes: 7 additions & 0 deletions docs/source/TimerMechanism.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TimerMechanism
==============

.. automodule:: psyneulink.library.components.mechanisms.processing.integrator.timermechanism
:members:
:private-members:
:exclude-members: random, Parameters
5 changes: 3 additions & 2 deletions docs/source/TransferFunctions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ TransferFunctions
.. toctree::
:maxdepth: 3

.. automodule:: psyneulink.core.components.functions.transferfunctions
:members: TransferFunction, Identity, Linear, Exponential, Logistic, Tanh, ReLU, Angle, Gaussian, GaussianDistort, BinomialDistort, Dropout, SoftMax, LinearMatrix, TransferWithCosts, CostFunctions
.. automodule:: psyneulink.core.components.functions.nonstateful.transferfunctions
:members: TransferFunction, Identity, Linear, Exponential, Logistic, Tanh,ReLU, Angle, Gaussian, GaussianDistort, BinomialDistort, Dropout, SoftMax, LinearMatrix, TransferWithCosts,
CostFunctions
:private-members:
:exclude-members: Parameters
8 changes: 5 additions & 3 deletions psyneulink/core/components/functions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from . import function
from .nonstateful import selectionfunctions, objectivefunctions, optimizationfunctions, transformfunctions, \
learningfunctions, transferfunctions, distributionfunctions, fitfunctions
learningfunctions, timerfunctions, transferfunctions, distributionfunctions, fitfunctions
from . import stateful
from .stateful import integratorfunctions, memoryfunctions
from . import userdefinedfunction

from .function import *
from psyneulink.core.components.functions.nonstateful.transformfunctions import *
from psyneulink.core.components.functions.nonstateful.transferfunctions import *
from psyneulink.core.components.functions.nonstateful.timerfunctions import *
from psyneulink.core.components.functions.nonstateful.transformfunctions import *
from psyneulink.core.components.functions.nonstateful.selectionfunctions import *
from psyneulink.core.components.functions.nonstateful.distributionfunctions import *
from psyneulink.core.components.functions.nonstateful.objectivefunctions import *
Expand All @@ -21,8 +22,9 @@

__all__ = list(function.__all__)
__all__.extend(userdefinedfunction.__all__)
__all__.extend(transformfunctions.__all__)
__all__.extend(transferfunctions.__all__)
__all__.extend(timerfunctions.__all__)
__all__.extend(transformfunctions.__all__)
__all__.extend(selectionfunctions.__all__)
__all__.extend(stateful.__all__)
__all__.extend(distributionfunctions.__all__)
Expand Down
7 changes: 5 additions & 2 deletions psyneulink/core/components/functions/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,16 @@ class Function_Base(Function):
Attributes
----------
variable: value
variable: number
format and default value can be specified by the :keyword:`variable` argument of the constructor; otherwise,
they are specified by the Function's :keyword:`class_defaults.variable`.
function : function
called by the Function's `owner <Function_Base.owner>` when it is executed.
value : number
the result returned by calling the Function.
COMMENT:
enable_output_type_conversion : Bool : False
specifies whether `function output type conversion <Function_Output_Type_Conversion>` is enabled.
Expand All @@ -554,7 +557,7 @@ class Function_Base(Function):
specifies whether the return value of the function is different than the shape of either is outermost dimension
(axis 0) of its its `variable <Function_Base.variable>`, or any of the items in the next dimension (axis 1).
Used to determine whether the shape of the inputs to the `Component` to which the function is assigned
should be based on the `variable <Function_Base.variable>` of the function or its `value <Function.value>`.
should be based on the `variable <Function_Base.variable>` of the function or its `value <Function_Base.value>`.
COMMENT
owner : Component
Expand Down
Loading

0 comments on commit 786a698

Please sign in to comment.