optpolicy_main.OptimalPolicyVersions.evaluate#

OptimalPolicyVersions.evaluate(allocation_df, data_df, data_title='', seed=12434)#

Evaluate allocation with potential outcome data.

Parameters:
  • allocation_df (DataFrame) – Treatment-version allocations, for example the ‘allocation_df’ returned by solve() or allocate(). Each column represents one allocation rule. Codes run from 0 to K - 1, where K counts all treatment versions. Main treatments follow the order in ‘policyscores_dict’; within each main treatment, follow the order of its version-score names. A main treatment without separate versions occupies one code. Names ‘random’, ‘observed’ and ‘best ATE’ are used for automatic reference allocations. A ValueError is raised if a supplied column name conflicts with a reference generated for this call.

  • data_df (DataFrame) – Evaluation variables for the observations in allocation_df. Both DataFrames must have the same number of rows in the same observation order. Rows are paired by position; index labels and identifier columns are not used to align them.

  • data_title (String, optional) – This string is used as title in outputs. The default is ‘’.

  • seed (Integer, optional) – Seed for random number generators. The default is 12434.

Returns:

results_all_dic –

‘results_dic’: Dictionary with one entry per population and allocation rule.

Keys are ‘All <allocation>’ and, when observed treatments are available, ‘Switchers <allocation>’. Switchers receive a different treatment from their observed treatment; this subset is specific to each allocation rule. Reference allocations are added automatically: ‘random’, ‘observed’ when available, and ‘best ATE’ when welfare scores are available. ‘best ATE’ assigns everyone the treatment with the highest mean policy score minus its treatment cost. Each entry contains ‘treatment share’ and ‘number of observations’. When welfare scores are available, gross mean welfare is stored under the same key as the outer entry, and net mean welfare under ‘welfare net of costs’. Additional score summaries and fairness diagnostics are included when applicable.

’outpath’Path or None

Directory in which output is saved. None if params_optpol sets _int_with_output to False.

Return type:

Dictionary