Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/devel' into fix/control_allocation
Browse files Browse the repository at this point in the history
* origin/devel:
  tests: remove asserts using zip loops where possible
  tests: replace all unaffected assert np.allclose with np.testing.assert_allclose
  tests: replace assert np.allclose with np.testing.assert_allclose where tolerance fails
  tests: test_gating_with_composition: fix allclose
  tests: test_log: fix allclose shape
  tests: test_rpy.py test_multilayer: fix allclose
  tests: test_reset_run_2darray: fix allclose
  tests: test_transfer_mech_array_var_normal_array_noise: fix allclose
  tests: test_single_array: fix allclose
  tests: test_connect_outer_composition_to_only_input_node_in_inner_comp_option2: fix allclose
  tests: test_AGTUtility_valid: fix allclose
  tests: test_target_dict_spec_single_trial_scalar_and_lists_rl: fix allclose
  tests: test_transfer_mech_func: fix allclose
  tests: test_input_specification_multiple_nested_compositions: fix allclose
  tests: test_input_not_provided_to_run: fix allclose
  tests: test_example_11: fix allclose
  tests: test_buffer_standalone: fix allclose
  tests: test_assign_value: fix allclose
  tests: TestRunInputSpecifications::test_2_mechanisms_input_5: fix allclose
  tests: test_integrator_multiple_input: fix allclose
  tests: tests_output_port_variable_spec_composition: fix allclose
  tests: test_output_ports: fix allclose
  tests: test_LCAMechanism_threshold: fix allclose
  tests: test_user_def_func_numpy: match 2d output to 2d input
  tests: test_linear_combination_function_in_mechanism: fix allclose
  tests: test_connect_compositions_with_simple_states: fix allclose
  tests: TestInputSpecifications test_run_2_mechanisms_reuse_input: fix allclose
  tests: TestRun test_run_2_mechanisms_reuse_input: fix allclose
  tests: TestRunInputSpecifications test_run_2_mechanisms_reuse_input: fix allclose
  tests: test_nested_transfer_mechanism_composition_parallel shape mismatch
  Fix test_ddm_mechanism TestInputPorts
  Fix test_reset_run_array
  Fix TestReduce
  Fix test_reset_state_integrator_mechanism
  Fix more execute tests.
  Fix more composition.run() tests.
  Fix test_four_level_nested_transfer_mechanism_composition_parallel
  Fix test_processing_mechanism_function
  tests: allclose changes
  Fix log tests
  tests: allclose changes
  Fix expected 3D outputs
  Fix test_run_no_inputs
  tests: allclose changes
  tests: allclose changes
  tests: allclose changes
  Fix expected results shape
  tests: test_nested_composition_run_trials_inputs: undo disable test parametrizations
  tests: allclose changes
  tests: test_documentation_models: reenable parametrizations
  github-actions: Add job running --benchmark-enable
  tests/AudodiffComposition: Add helper function to return the first set of learning results
  github-actions: Run all tests with --fp-precision=fp32
  tests/Autodiff: Check for execution mode PyTorch in test_optimizer specs
  tests/control: FP32 should only be used in compiled tests
  tests/xor_training_identicalness: Convert to use autodiff_mode
  tests/MemoryFunction: Prefer np.testing.assert_equal to assert np.all(==)
  test/AutodiffComposition: Use np.testing.assert_equal instead of assert np.all(==)
  requirements: update beartype requirement from <0.13.0 to <0.14.0 (PrincetonUniversity#2625)
  requirements: update pytest requirement from <7.2.3 to <7.3.1 (PrincetonUniversity#2627)
  requirements: Drop grpcio-tools
  requirements: Add protobuf to dependency list
  {dev,tutorial}_requirements: Use sharp inequality for jupyter upper bound
  dev_requirements: Use sharp inequality of pytest-profiling upper bound
  requirements: Sort alphabetically
  requirements: Use sharp inequality for leabra-psyneulink upper bound
  requirements: Fix dill dependency upper bound
  requirements: Use sharp inequality for bear type upper bound
  Tentative learning branch (PrincetonUniversity#2623)
  tests/llvm/multiple_executions: Use np.testing.assert_allclose to check resutls (PrincetonUniversity#2621)
  requirements: update pandas requirement from <1.5.4 to <2.0.1 (PrincetonUniversity#2619)
  Add back rate validation in constructor.
  Add back validation I added for offset.
  Remove validation I added for offset.
  Add validate methods as kmantel suggests
  requirements: update pillow requirement from <9.5.0 to <9.6.0 (PrincetonUniversity#2618)
  Remove typecheck-decorator requirment.
  Fix some annotations.
  requirements: update networkx requirement from <3.1 to <3.2 (PrincetonUniversity#2620)
  Nback (PrincetonUniversity#2617)
  Fix/contentaddressablememory empty entry (PrincetonUniversity#2616)
  Fix some annotations on learning methods.
  Fix some issues with merge of composition.
  Fix type annotation on _get_port_value_labels
  Remove check_user_specified in places.
  Replace typecheck decorator with beartype
  Add typecheck decorator back temporarily
  llvm: Add human readable name to _node_wrapper instances
  llvm: Use WeakRefDictionary for node wrappers
  llvm/builder_context: Use proxy object for _node_wrapper owning composition
  remove redefinition of ENTROPY keyword
  Raise KeyError on MechanismList.__seitem__
  fix some lgtm errors
  remove unused imports
  revert ci testing changes completely for now.
  Fix codestyle errors.
  Revert back to testing on Python 3.9.
  Fix specifcation of Python 3.10 in ci workflow
  Fixes for Python 3.7
  Enable tests for python 3.10 in CI.
  Add beartype for runtime type checking.
  Replace typecheck import with beartype
  Removed all the tc.optional typecheck annotations
  replaced all typecheck enums with Literal
  Replace is_function_type with static type
  Replace is_pref_set with static type
  Replace parameter_spec with static type.
  Remove dead code in parameter_spec
  ran some regexes to replace easy type hints
  fix for some tests that expect runtime type checks
  Comment out all typecheck decorations.
  • Loading branch information
kmantel committed Apr 14, 2023
2 parents 24d92fb + e96bbc8 commit 6d0b3c5
Show file tree
Hide file tree
Showing 198 changed files with 24,910 additions and 2,782 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/pnl-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,25 @@ jobs:
extra-args: ['']
os: [ubuntu, macos, windows]
include:
# add 32-bit build on windows
- python-version: '3.8'
python-architecture: 'x86'
os: windows

# code-coverage build on macos python 3.9
- python-version: '3.9'
os: macos
extra-args: '--cov=psyneulink'

# fp32 compiled run on linux python 3.9
- python-version: '3.9'
# add 32-bit build on windows
- python-version: '3.8'
python-architecture: 'x86'
os: windows

# fp32 run on linux python 3.8
- python-version: '3.8'
os: ubuntu
extra-args: '-m llvm --fp-precision=fp32'
extra-args: '--fp-precision=fp32'

# --benchmark-enable run on macos python 3.8
- python-version: '3.8'
os: macos
extra-args: '--benchmark-enable -m benchmark -n0 --benchmark-min-rounds=2 --benchmark-max-time=0.001 --benchmark-warmup=off'

# add python 3.8 build on macos since 3.7 is broken
# https://github.com/actions/virtual-environments/issues/4230
Expand Down
6 changes: 5 additions & 1 deletion CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ Extensions of Core objects
- arguments_of_constructors, instance_attributes and instance_methods:
lowercase and underscore separator(s) [constructor_arg, method_arg, object_attribute]
- keywords:
all capitals and underscore separator(s) [KEY_WORD]
- all capitals and underscore separator(s) [KEY_WORD]
- assigned values:
- argument of a method or function: lower case [KEY_WORD = 'argument_value']
- names of a Components: upper case [KEY_WORD = 'NAME']

DEPRECATED:
- internal keywords:
prepend kw followed by camelCase [kwKeyword]
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import numpy as np
from psyneulink import *

NUM_TRIALS = 48

stims = np.array([x[0] for x in em.memory])
contexts = np.array([x[1] for x in em.memory])
cos = Distance(metric=COSINE)
dist = Distance(metric=EUCLIDEAN)
diffs = [np.sum([contexts[i + 1] - contexts[1]]) for i in range(NUM_TRIALS)]
diffs_1 = [np.sum([contexts[i + 1] - contexts[i]]) for i in range(NUM_TRIALS)]
diffs_2 = [np.sum([contexts[i + 2] - contexts[i]]) for i in range(NUM_TRIALS - 1)]
dots = [[contexts[i + 1] @ contexts[1]] for i in range(NUM_TRIALS)]
dot_diffs_1 = [[contexts[i + 1] @ contexts[i]] for i in range(NUM_TRIALS)]
dot_diffs_2 = [[contexts[i + 2] @ contexts[i]] for i in range(NUM_TRIALS - 1)]
angle = [cos([contexts[i + 1], contexts[1]]) for i in range(NUM_TRIALS)]
angle_1 = [cos([contexts[i + 1], contexts[i]]) for i in range(NUM_TRIALS)]
angle_2 = [cos([contexts[i + 2], contexts[i]]) for i in range(NUM_TRIALS - 1)]
euclidean = [dist([contexts[i + 1], contexts[1]]) for i in range(NUM_TRIALS)]
euclidean_1 = [dist([contexts[i + 1], contexts[i]]) for i in range(NUM_TRIALS)]
euclidean_2 = [dist([contexts[i + 2], contexts[i]]) for i in range(NUM_TRIALS - 1)]
print("STIMS:", stims, "\n")
print("DIFFS:", diffs, "\n")
print("DIFFS 1:", diffs_1, "\n")
print("DIFFS 2:", diffs_2, "\n")
print("DOT PRODUCTS:", dots, "\n")
print("DOT DIFFS 1:", dot_diffs_1, "\n")
print("DOT DIFFS 2:", dot_diffs_2, "\n")
print("ANGLE: ", angle, "\n")
print("ANGLE_1: ", angle_1, "\n")
print("ANGLE_2: ", angle_2, "\n")
print("EUCILDEAN: ", euclidean, "\n")
print("EUCILDEAN 1: ", euclidean_1, "\n")
print("EUCILDEAN 2: ", euclidean_2, "\n")
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import stim

from .nback import *
from .stim import *
729 changes: 729 additions & 0 deletions Scripts/Models (Under Development)/Beukers_et_al_2022/full_results.csv

Large diffs are not rendered by default.

729 changes: 729 additions & 0 deletions Scripts/Models (Under Development)/Beukers_et_al_2022/high_loss.csv

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
condition,inputs,target,context distance,results,coded response,ce loss
Loading

0 comments on commit 6d0b3c5

Please sign in to comment.