optpolicy_main.OptimalPolicyVersions.allocate#

OptimalPolicyVersions.allocate(data_df: pandas.DataFrame, data_title: str = '') → dict#

Allocate observations to treatment state.

Parameters:
  • data_df (DataFrame) – Input data with at least features or policy scores (depending on algorithm).

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

Returns:

results – Contains the results. This dictionary has the following structure: ‘allocation_df’ : DataFrame

Allocations to treatment versions, with one row per observation used for allocation and one column per allocation rule. Entries are integer codes starting at zero. Main treatments follow the order of keys in ‘policyscores_dict’; their versions follow the order of the corresponding score names. Codes run consecutively across all main treatments. A main treatment without separate versions occupies one code. The input features and policy scores are not included.

’outpath’Path or None

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

Return type:

Dictionary.