Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/ocm/state input ports #2221

Merged
merged 198 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
064d63f
• component.py
jdcpni Apr 30, 2021
614a53a
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Apr 30, 2021
a32f213
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Apr 30, 2021
75cf069
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni May 5, 2021
dff1a37
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Jul 8, 2021
cd5e38e
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Oct 23, 2021
9361857
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Oct 30, 2021
0129ff7
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 4, 2021
bbd20f5
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 4, 2021
f9aba91
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 7, 2021
a3c0f6c
• optimizationcontrolmechanism.py:
jdcpni Nov 7, 2021
7069b3a
• optimizationcontrolmechanism.py:
jdcpni Nov 7, 2021
65b960e
• optimizationcontrolmechanism.py:
jdcpni Nov 7, 2021
5cc58f6
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 8, 2021
bc05b51
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 8, 2021
a8d428b
- modified test_mode_based_num_estimates
jdcpni Nov 8, 2021
1218b6f
-
jdcpni Nov 8, 2021
41567bb
-
jdcpni Nov 8, 2021
b65650f
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 8, 2021
822742f
• optimizationcontrolmechanism.py:
jdcpni Nov 9, 2021
5a3efba
• composition.py
jdcpni Nov 9, 2021
7acdebd
• composition.py:
jdcpni Nov 9, 2021
f81baf5
-
jdcpni Nov 9, 2021
cc1e98e
• composition.py
jdcpni Nov 9, 2021
a00b95f
• composition.py:
jdcpni Nov 10, 2021
ed0a720
-
jdcpni Nov 10, 2021
cb0b930
• optimizationcontrolmechanism.py:
jdcpni Nov 10, 2021
8cadf24
-
jdcpni Nov 10, 2021
1cc216e
• optimizationcontrolmechanism.py:
jdcpni Nov 10, 2021
ba278c1
-
jdcpni Nov 10, 2021
b5f1c66
-
jdcpni Nov 10, 2021
0e38f1b
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 10, 2021
b4a9b82
• optimizationcontrolmechanism.py
jdcpni Nov 10, 2021
2050118
-
Nov 10, 2021
b925dab
• optimizationcontrolmechanism.py
jdcpni Nov 11, 2021
bdb12fb
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 11, 2021
c1b3000
• optimizationcontrolmechanism.py
jdcpni Nov 11, 2021
7ca8a0b
-
jdcpni Nov 11, 2021
d1010fd
-
jdcpni Nov 11, 2021
e57cd2d
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 11, 2021
0ff99ec
Merge branch 'fix/ocm/llvm_num_estimates' into refactor/ocm/state_inp…
jdcpni Nov 11, 2021
3607a9a
-
jdcpni Nov 11, 2021
6017b7b
-
jdcpni Nov 11, 2021
2395f7e
• composition.py
jdcpni Nov 11, 2021
f317567
• composition.py
jdcpni Nov 11, 2021
8edacf6
llvm/struct generation: Make sure num_estimats per trial is always in…
jvesely Nov 11, 2021
8ed5e87
-
jdcpni Nov 11, 2021
bcfbae9
Merge branch 'fix/ocm/llvm_num_estimates' into refactor/ocm/state_inp…
jdcpni Nov 11, 2021
8a564aa
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 11, 2021
883b49d
• composition.py:
jdcpni Nov 12, 2021
d2faa86
-
jdcpni Nov 12, 2021
a632f72
• composition.py
jdcpni Nov 12, 2021
0e1a32e
• test_control.py
jdcpni Nov 12, 2021
1d996fb
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 12, 2021
3856bdd
• optimizationfunctions.py:
jdcpni Nov 12, 2021
0eb6514
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 12, 2021
4b2fe4a
-
jdcpni Nov 13, 2021
d580849
• composition.py
jdcpni Nov 13, 2021
79b6ed6
-
jdcpni Nov 15, 2021
1a5dd50
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 15, 2021
34b179e
• composition.py:
jdcpni Nov 15, 2021
dff750a
• composition.py:
jdcpni Nov 16, 2021
38e5bae
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 16, 2021
d487a4c
• composition.py
jdcpni Nov 16, 2021
779add6
-
jdcpni Nov 16, 2021
5c361e2
• composition.py:
jdcpni Nov 17, 2021
0c2de6a
-
jdcpni Nov 17, 2021
27b2d76
-
jdcpni Nov 17, 2021
0981388
-
jdcpni Nov 17, 2021
698d824
-
jdcpni Nov 17, 2021
900da17
-
jdcpni Nov 17, 2021
aa5a431
-
jdcpni Nov 17, 2021
780be92
-
jdcpni Nov 17, 2021
fa4e038
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 17, 2021
af135d6
-
jdcpni Nov 17, 2021
f13747a
• Passing all test_control tests except test_mode_based_num_estimates
jdcpni Nov 17, 2021
eff7005
• Passing all test_control tests
jdcpni Nov 17, 2021
ea1465e
-
jdcpni Nov 17, 2021
1c39268
• optimizationcontrolmechanism.py
jdcpni Nov 18, 2021
a7f7cf4
-
jdcpni Nov 18, 2021
7a6b5a7
• optimizationcontrolmechanism.py
jdcpni Nov 18, 2021
11cf225
• test_show_graph.py: passes all tests
jdcpni Nov 18, 2021
72b922a
-
jdcpni Nov 18, 2021
b6e697e
• test_report.py: passing all tests
Nov 18, 2021
1609acc
• Passes all tests!
Nov 18, 2021
b889604
-
jdcpni Nov 19, 2021
c4b081e
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 19, 2021
47a757a
-
Nov 19, 2021
78f4ec6
Merge branch 'refactor/ocm/state_input_ports' of https://github.com/P…
jdcpni Nov 19, 2021
faaf256
• composition.py: reorganize with #region and #enregions
jdcpni Nov 19, 2021
fb9c424
• composition.py: reorganize with #region and #enregions
jdcpni Nov 19, 2021
0c96840
• controlmechanism.py, optimizationcontrolmechanism.py:
jdcpni Nov 19, 2021
d40082c
-
jdcpni Nov 19, 2021
1630f87
-
jdcpni Nov 19, 2021
a76a2d0
-
jdcpni Nov 19, 2021
b1f9778
• controlmechanism.py, optimizationcontrolmechanism.py:
jdcpni Nov 19, 2021
451abb3
• controlmechanism.py, optimizationcontrolmechanism.py:
jdcpni Nov 19, 2021
304174e
-
jdcpni Nov 20, 2021
428eed8
• composition.py:
Nov 20, 2021
5c71808
-
jdcpni Nov 20, 2021
3733ea9
- test_control: only test_hanging_control_spec_outer_controller not p…
jdcpni Nov 20, 2021
5851949
-
Nov 20, 2021
e8909b7
-
Nov 20, 2021
2018260
-
Nov 20, 2021
98be7a0
-
jdcpni Nov 20, 2021
636b7c7
-
jdcpni Nov 20, 2021
f3a857a
-
jdcpni Nov 20, 2021
2552f73
• composition.py:
jdcpni Nov 20, 2021
c02735e
• test_paremtercomposition.py:
jdcpni Nov 20, 2021
8568b47
ª Attempt to fix problem with partially overlapping local and ocm con…
jdcpni Nov 21, 2021
1aadd6d
see later commit
jdcpni Nov 21, 2021
da80ad6
see later commit
jdcpni Nov 21, 2021
fa1683f
see later commit
jdcpni Nov 21, 2021
8dee921
see later commit
jdcpni Nov 21, 2021
d17b5cd
- This branch passes all tests except:
jdcpni Nov 21, 2021
2503dfc
- small mods; don't impact anything relevant to prior commit message
jdcpni Nov 21, 2021
6cf4609
- small mods; don't impact anything relevant to prior commit message
jdcpni Nov 21, 2021
cdb6399
- small mods; don't impact anything relevant to prior commit message
jdcpni Nov 21, 2021
5cf0bc2
- finished adding formatting regions to composition.py
jdcpni Nov 21, 2021
46ccc47
-
jdcpni Nov 21, 2021
2b3b857
• composition.py:
jdcpni Nov 21, 2021
bd5cd10
• show_graph.py: addressed bug associated with ocm.allow_direct_probe
jdcpni Nov 22, 2021
6d894a7
• show_graph.py: addressed bug associated with ocm.allow_direct_probe
jdcpni Nov 22, 2021
689d7b6
-
jdcpni Nov 22, 2021
bcddef5
Composition: add_controller: set METHOD as context source early
kmantel Nov 23, 2021
7fd49c6
-
jdcpni Nov 23, 2021
35c97d3
Merge branch 'refactor/ocm/state_input_ports_PROBE_FIX' of https://gi…
jdcpni Nov 23, 2021
79cb012
• composition.py
jdcpni Nov 24, 2021
9bc7b18
• composition.py
jdcpni Nov 24, 2021
0f93f47
• test_partially_overlapping_local_and_control_mech_control_specs_in_…
Nov 25, 2021
81f1112
• composition.py
jdcpni Nov 25, 2021
0cd9db3
• composition.py
jdcpni Nov 25, 2021
c808664
• composition.py
jdcpni Nov 25, 2021
0cb21ab
-
jdcpni Nov 25, 2021
28289a0
- confirm that it passes all tests exception test_composition/test_pa…
Nov 25, 2021
1cf9602
• composition.py: some more fixed to add_controller that now fail on…
jdcpni Nov 25, 2021
72c4c41
• Passes *all* current tests
jdcpni Nov 25, 2021
45b25eb
• composition.py:
Nov 25, 2021
a79723b
-
Nov 25, 2021
49350a1
-
jdcpni Nov 26, 2021
7a6682a
-
jdcpni Nov 26, 2021
8858ab5
• controlmechanism.py:
jdcpni Nov 26, 2021
d1ac2da
-
jdcpni Nov 26, 2021
dbdc2d1
• composition.py: in progress fix of bug in instantiating shadow pro…
jdcpni Nov 27, 2021
6b00fbd
• composition.py:
jdcpni Nov 27, 2021
179e7d0
• optimizationcontrolmechanism.py
jdcpni Nov 27, 2021
88ce1a6
-
jdcpni Nov 27, 2021
5089cf3
• composition.py
jdcpni Nov 27, 2021
97a71c4
• test_show_graph.py: update for fixes
Nov 27, 2021
3bc799e
-
Nov 27, 2021
6a27e4a
• tests: passes all in test_show_graph.py and test_report.py
Nov 27, 2021
8cdad10
Passes all tests
Nov 27, 2021
2d15f6d
- comment clean-up
Nov 27, 2021
787856b
• composition.py
jdcpni Nov 27, 2021
3ed598e
• composition.py, optimizationcontrolmechanism.py:
Nov 28, 2021
38e5f99
• show_graph.py: fixed bug causing extra projections to OCM
jdcpni Nov 28, 2021
658c161
• composition.py:
jdcpni Nov 28, 2021
7396806
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Nov 28, 2021
8b54f03
• optimizationcontrolmechanism.py: add agent_rep_type property
jdcpni Nov 28, 2021
1ecf0fa
• optimizationcontrolmechanism.py:
jdcpni Nov 28, 2021
24a03f3
• optimizationcontrolmechanism.py:
jdcpni Nov 29, 2021
6713df9
-
jdcpni Nov 29, 2021
8b3bdf0
-
jdcpni Nov 29, 2021
d001991
• Passes all tests except test_json with 'model_with_control'
jdcpni Nov 29, 2021
888863a
-
jdcpni Nov 30, 2021
6fb5cf6
• composition.py
jdcpni Nov 30, 2021
c1fd334
• composition.py
jdcpni Nov 30, 2021
00e7da9
• composition.py
jdcpni Nov 30, 2021
77ae108
-
jdcpni Nov 30, 2021
774f6b3
• test_two_origins_two_input_ports: crashes on failure of C->B to up…
jdcpni Nov 30, 2021
c4fedbe
-
jdcpni Nov 30, 2021
e29f618
• composition.py
Dec 1, 2021
d551e9d
• optimizationcontrolmechanism.py
jdcpni Dec 1, 2021
66c05f7
• optimizationcontrolmechanism.py
jdcpni Dec 1, 2021
a401857
• composition.py
jdcpni Dec 1, 2021
a91695e
• composition.py
jdcpni Dec 1, 2021
48012a3
Port: _remove_projection_to_port: don't reduce variable below length 1
kmantel Dec 1, 2021
cb828c8
• composition.py
jdcpni Dec 1, 2021
c6853b6
• show_graph.py
jdcpni Dec 2, 2021
d11e117
• composition.py:
jdcpni Dec 2, 2021
756c076
• show_graph.py
jdcpni Dec 2, 2021
f9924f3
• composition.py
jdcpni Dec 2, 2021
944d214
• composition.py
jdcpni Dec 2, 2021
546378b
• composition.py:
jdcpni Dec 2, 2021
67dd8c7
Merge branch 'refactor/ocm/state_input_ports_PROBE_STATE_FEAT_FCT' of…
jdcpni Dec 2, 2021
7de2c62
• show_graph.py
jdcpni Dec 2, 2021
d4ee355
Merge branch 'refactor/ocm/state_input_ports_PROBE_STATE_FEAT_FCT' of…
jdcpni Dec 2, 2021
be76389
-
jdcpni Dec 2, 2021
399d1f7
• composition.py
jdcpni Dec 2, 2021
bc47b76
-
jdcpni Dec 2, 2021
4afdf0a
-
jdcpni Dec 2, 2021
7423d37
• test_composition.py
jdcpni Dec 2, 2021
4134cde
Merge branch 'refactor/ocm/state_input_ports_PROBE_STATE_FEAT_FCT' of…
jdcpni Dec 2, 2021
de80376
Merge branch 'devel' of https://github.com/PrincetonUniversity/PsyNeu…
jdcpni Dec 2, 2021
4e63090
-
jdcpni Dec 2, 2021
552fc04
-
jdcpni Dec 3, 2021
24a7340
-
jdcpni Dec 3, 2021
1cca7d6
-
jdcpni Dec 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def get_stroop_model(unit_noise_std=.01, dec_noise_std=.1):
inp_task.input_port,
reward.input_port,
punish.input_port],
state_feature_function=pnl.AdaptiveIntegrator(rate=0.1),
state_feature_functions=pnl.AdaptiveIntegrator(rate=0.1),
objective_mechanism=objective_mech,
function=pnl.GridSearch(),
control_signals=[driftrate_control_signal,
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/Predator-Prey Sebastian REDUCED.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_new_episode_flag():

ocm = OptimizationControlMechanism(name='EVC',
state_features=[trial_type_input_mech],
# state_feature_function=FEATURE_FUNCTION,
# state_feature_functions=FEATURE_FUNCTION,
agent_rep=RegressionCFA(
name='RegressionCFA',
update_weights=BayesGLM(mu_0=0.5, sigma_0=0.1),
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/Predator-Prey Sebastian.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get_action(variable=[[0,0],[0,0],[0,0]]):

ocm = OptimizationControlMechanism(name='EVC',
state_features=[trial_type_input_mech],
# state_feature_function=FEATURE_FUNCTION,
# state_feature_functions=FEATURE_FUNCTION,
agent_rep=RegressionCFA(
name='RegressionCFA',
update_weights=BayesGLM(mu_0=0.5, sigma_0=0.1),
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/Umemoto_Feb.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

Umemoto_comp.add_model_based_optimizer(optimizer=pnl.OptimizationControlMechanism(agent_rep=Umemoto_comp,
state_features=[Target_Stim.input_port, Distractor_Stim.input_port, Reward.input_port],
state_feature_function=pnl.AdaptiveIntegrator(rate=1.0),
state_feature_functions=pnl.AdaptiveIntegrator(rate=1.0),
objective_mechanism=pnl.ObjectiveMechanism(monitor_for_control=[Reward,
(Decision.output_ports[pnl.PROBABILITY_UPPER_THRESHOLD], 1, -1)],
),
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/Umemoto_Feb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
state_features=[Target_Stim.input_port,
Distractor_Stim.input_port,
Reward.input_port],
state_feature_function=pnl.AdaptiveIntegrator(rate=1.0),
state_feature_functions=pnl.AdaptiveIntegrator(rate=1.0),
objective_mechanism=pnl.ObjectiveMechanism(
monitor_for_control=[Reward,
(Decision.output_ports[pnl.PROBABILITY_UPPER_THRESHOLD], 1, -1)],
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/new_umemoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

Umemoto_comp.add_model_based_optimizer(optimizer=pnl.OptimizationControlMechanism(agent_rep=Umemoto_comp,
state_features={pnl.SHADOW_EXTERNAL_INPUTS: [Target_Stim, Distractor_Stim, Reward]},
state_feature_function=pnl.AdaptiveIntegrator(rate=1.0),
state_feature_functions=pnl.AdaptiveIntegrator(rate=1.0),
objective_mechanism=pnl.ObjectiveMechanism(monitor_for_control=[Reward,
(Decision.output_ports[pnl.PROBABILITY_UPPER_THRESHOLD], 1, -1)],
),
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/predator_prey_opt/predator_prey_dmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def get_action(variable=[[0, 0], [0, 0], [0, 0]]):
# ************************************** CONOTROL APPARATUS ***********************************************************
self.ocm = OptimizationControlMechanism(name='EVC',
state_features=[self.prey_pred_trial_input_mech, self.single_prey_trial_input_mech, self.double_prey_trial_input_mech],
# state_feature_function=FEATURE_FUNCTION,
# state_feature_functions=FEATURE_FUNCTION,
agent_rep=RegressionCFA(
update_weights=BayesGLM(mu_0=-0.0, sigma_0=0.0001),
prediction_terms=[PV.F, PV.C, PV.COST]
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/stability_flexibility_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def computeAccuracy(variable):

meta_controller = pnl.OptimizationControlMechanism(agent_rep=stabilityFlexibility,
state_features=[inputLayer.input_port, stimulusInfo.input_port],
state_feature_function=pnl.Buffer(history=100),
state_feature_functions=pnl.Buffer(history=100),
objective_mechanism=objective_mech,
function=pnl.GridSearch(),
control_signals=[signal])
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Examples/EVC OCM.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
comp.add_model_based_optimizer(optimizer=OptimizationControlMechanism(name='OCM',
agent_rep=comp,
state_features=[Input.input_port, reward.input_port],
state_feature_function=AdaptiveIntegrator(rate=0.5),
state_feature_functions=AdaptiveIntegrator(rate=0.5),
objective_mechanism=ObjectiveMechanism(
name='OCM Objective Mechanism',
function=LinearCombination(operation=PRODUCT),
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Examples/EVC-Gratton Composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
state_features=[target_stim.input_port,
flanker_stim.input_port,
reward.input_port],
state_feature_function=pnl.AdaptiveIntegrator(
state_feature_functions=pnl.AdaptiveIntegrator(
rate=1.0),
objective_mechanism=objective_mech,
function=pnl.GridSearch(),
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Examples/EVC-Gratton-GaussianProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
comp.add_linear_processing_pathway(task_execution_pathway)

ocm = pnl.OptimizationControlMechanism(state_features=[Input, Reward],
state_feature_function=pnl.AdaptiveIntegrator(rate=0.5),
state_feature_functions=pnl.AdaptiveIntegrator(rate=0.5),
agent_rep=comp,
# function=pnl.GaussianProcessOptimization,
function=pnl.GridSearch,
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Examples/StabilityFlexibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def computeAccuracy(variable):

meta_controller = pnl.OptimizationControlMechanism(agent_rep=stabilityFlexibility,
state_features=[inputLayer.input_port, stimulusInfo.input_port],
state_feature_function=pnl.Buffer(history=3),
state_feature_functions=pnl.Buffer(history=3),
objective_mechanism=objective_mech,
function=pnl.GridSearch(),
control_signals=[signal])
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Examples/Tutorial/Stroop Model - EVC.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
evc = OptimizationControlMechanism(name='EVC',
agent_rep=Stroop_model,
state_features=[color_input.input_port, word_input.input_port, reward.input_port],
state_feature_function=AdaptiveIntegrator(rate=1.0),
# state_feature_function=AdaptiveIntegrator,
state_feature_functions=AdaptiveIntegrator(rate=1.0),
# state_feature_functions=AdaptiveIntegrator,
objective_mechanism= \
ObjectiveMechanism(
name='EVC Objective Mechanism',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def get_action(variable=[[0,0],[0,0],[0,0]]):

ocm = OptimizationControlMechanism(name='EVC',
state_features=trial_type_input_mech,
state_feature_function=FEATURE_FUNCTION,
state_feature_functions=FEATURE_FUNCTION,
agent_rep=RegressionCFA(
update_weights=BayesGLM(mu_0=0.5, sigma_0=0.1),
prediction_terms=[PV.F, PV.C, PV.COST]
Expand Down
7 changes: 3 additions & 4 deletions psyneulink/core/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ def _get_compilation_params(self):
# Invalid types
"input_port_variables", "results", "simulation_results",
"monitor_for_control", "state_feature_values", "simulation_ids",
"input_labels_dict", "output_labels_dict",
"input_labels_dict", "output_labels_dict", "num_estimates",
"modulated_mechanisms", "grid", "control_signal_params",
"activation_derivative_fct", "input_specification",
# Reference to other components
Expand Down Expand Up @@ -1448,9 +1448,8 @@ def _get_values(p):
# Modulated parameters change shape to array
if np.ndim(param) == 0 and self._is_param_modulated(p):
return (param,)
elif p.name == 'num_estimates':
return 0 if param is None else param
# FIX: ADD num_trials_per_estimate HERE 11/3/21
elif p.name == 'num_trials_per_estimate': # Should always be int
return 0 if param is None else int(param)
elif p.name == 'matrix': # Flatten matrix
return tuple(np.asfarray(param).flatten())
return _convert(param)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ def __init__(self, error_value):
self.error_value = error_value


def _num_estimates_getter(owning_component, context):
if owning_component.parameters.randomization_dimension._get(context) is None:
return 1
else:
return owning_component.parameters.search_space._get(context)[owning_component.randomization_dimension].num


class OptimizationFunction(Function_Base):
"""
OptimizationFunction( \
Expand Down Expand Up @@ -308,6 +315,12 @@ class Parameters(Function_Base.Parameters):
:default value: None
:type:

num_estimates
see `num_estimates <OptimizationFunction.num_estimates>`

:default value: None
:type: ``int``

objective_function
see `objective_function <OptimizationFunction.objective_function>`

Expand Down Expand Up @@ -371,6 +384,9 @@ class Parameters(Function_Base.Parameters):
search_termination_function = Parameter(lambda x, y, z: True, stateful=False, loggable=False)
search_space = Parameter([SampleIterator([0])], stateful=False, loggable=False)
randomization_dimension = Parameter(None, stateful=False, loggable=False)
num_estimates = Parameter(None, stateful=True, loggable=True, read_only=True,
dependencies=[randomization_dimension, search_space],
getter=_num_estimates_getter)

save_samples = Parameter(False, pnl_internal=True)
save_values = Parameter(False, pnl_internal=True)
Expand Down Expand Up @@ -642,12 +658,6 @@ def _report_value(self, new_value):
"""Report value returned by `objective_function <OptimizationFunction.objective_function>` for sample."""
pass

@property
def num_estimates(self):
if self.randomization_dimension is None:
return 1
else:
return self.search_space[self.randomization_dimension].num

class GridBasedOptimizationFunction(OptimizationFunction):
"""Implement helper method for parallelizing instantiation for evaluating samples from search space."""
Expand Down
Loading