@@ -1463,6 +1463,7 @@ def react( # noqa: C901
1463
1463
details : t .Optional [Mapping ] = None ,
1464
1464
exclude_novel_nominals_from_uniqueness_check : bool = False ,
1465
1465
feature_bounds_map : t .Optional [Mapping ] = None ,
1466
+ feature_post_process_code_map : t .Optional [Mapping ] = None ,
1466
1467
generate_new_cases : GenerateNewCases = "no" ,
1467
1468
goal_features_map : t .Optional [Mapping ] = None ,
1468
1469
initial_batch_size : t .Optional [int ] = None ,
@@ -1932,6 +1933,15 @@ def react( # noqa: C901
1932
1933
"feature_c": {"max": 1}
1933
1934
}
1934
1935
1936
+ feature_post_process_code_map : dict of str, optional
1937
+ A mapping of feature name to custom code strings that will be
1938
+ evaluated to update the value of the feature they are mapped from.
1939
+ The custom code is evaluated just after a feature value is predicted
1940
+ or synthesized to update the value of the feature, meaning that the
1941
+ resulting value will be used as part of the context for following
1942
+ action features. The custom code will have access to all context
1943
+ feature values and previously generated action feature values.
1944
+
1935
1945
generate_new_cases : {"always", "attempt", "no"}, default "no"
1936
1946
(Optional) Whether to generate new cases.
1937
1947
@@ -2158,6 +2168,7 @@ def react( # noqa: C901
2158
2168
"action_features" : action_features ,
2159
2169
"derived_context_features" : derived_context_features ,
2160
2170
"derived_action_features" : derived_action_features ,
2171
+ "feature_post_process_code_map" : feature_post_process_code_map ,
2161
2172
"goal_features_map" : goal_features_map ,
2162
2173
"post_process_features" : post_process_features ,
2163
2174
"post_process_values" : post_process_values ,
@@ -2199,6 +2210,7 @@ def react( # noqa: C901
2199
2210
"action_features" : action_features ,
2200
2211
"derived_context_features" : derived_context_features ,
2201
2212
"derived_action_features" : derived_action_features ,
2213
+ "feature_post_process_code_map" : feature_post_process_code_map ,
2202
2214
"post_process_features" : post_process_features ,
2203
2215
"post_process_values" : post_process_values ,
2204
2216
"use_regional_residuals" : use_regional_residuals ,
@@ -2595,6 +2607,7 @@ def react_series( # noqa: C901
2595
2607
details : t .Optional [Mapping ] = None ,
2596
2608
exclude_novel_nominals_from_uniqueness_check : bool = False ,
2597
2609
feature_bounds_map : t .Optional [Mapping [str , Mapping [str , t .Any ]]] = None ,
2610
+ feature_post_process_code_map : t .Optional [Mapping ] = None ,
2598
2611
final_time_steps : t .Optional [list [t .Any ]] = None ,
2599
2612
generate_new_cases : GenerateNewCases = "no" ,
2600
2613
goal_features_map : t .Optional [Mapping ] = None ,
@@ -2695,6 +2708,16 @@ def react_series( # noqa: C901
2695
2708
If True, will exclude features which have a subtype defined in their feature
2696
2709
attributes from the uniqueness check that happens when ``generate_new_cases``
2697
2710
is True. Only applies to generative reacts.
2711
+ feature_post_process_code_map : dict of str, optional
2712
+ A mapping of feature name to custom code strings that will be
2713
+ evaluated to update the value of the feature they are mapped from.
2714
+ The custom code is evaluated just after a feature value is predicted
2715
+ or synthesized to update the value of the feature, meaning that the
2716
+ resulting value will be used as part of the context for following
2717
+ action features. The custom code will have access to all context
2718
+ feature values and previously generated action feature values of
2719
+ the timestep being generated, as well as the feature values of all
2720
+ previously generated timesteps.
2698
2721
series_context_features : iterable of str, optional
2699
2722
List of context features corresponding to ``series_context_values``.
2700
2723
series_context_values : list of list of list of object or list of DataFrame, optional
@@ -2864,6 +2887,7 @@ def react_series( # noqa: C901
2864
2887
react_params = {
2865
2888
"action_features" : action_features ,
2866
2889
"continue_series" : continue_series ,
2890
+ "feature_post_process_code_map" : feature_post_process_code_map ,
2867
2891
"final_time_steps" : final_time_steps ,
2868
2892
"init_time_steps" : init_time_steps ,
2869
2893
"series_stop_maps" : series_stop_maps ,
@@ -2913,6 +2937,7 @@ def react_series( # noqa: C901
2913
2937
"num_series_to_generate" : num_series_to_generate ,
2914
2938
"action_features" : action_features ,
2915
2939
"continue_series" : continue_series ,
2940
+ "feature_post_process_code_map" : feature_post_process_code_map ,
2916
2941
"final_time_steps" : final_time_steps ,
2917
2942
"init_time_steps" : init_time_steps ,
2918
2943
"series_stop_maps" : series_stop_maps ,
0 commit comments