seldonian.RL.Agents.Policies.SimglucosePolicyFixedArea.SigmoidPolicyFixedArea

class SigmoidPolicyFixedArea(bb_crmin, bb_crmax, bb_cfmin, bb_cfmax, cr_shrink_factor, cf_shrink_factor)

Bases: Policy

__init__(bb_crmin, bb_crmax, bb_cfmin, bb_cfmax, cr_shrink_factor, cf_shrink_factor)

A policy used for the simglucose problem studied in this example: https://seldonian.cs.umass.edu/Tutorials/examples/diabetes/

Parameters:
  • bb_crmin (float) – The bounding box minimum value in CR space.

  • bb_crmax (float) – The bounding box maximum value in CR space.

  • bb_cfmin (float) – The bounding box minimum value in CF space.

  • bb_cfmax (float) – The bounding box maximum value in CF space.

  • cr_shrink_factor – How much to shrink the CR size by

  • cf_shrink_factor – How much to shrink the CF size by

__repr__()

Return repr(self).

Methods

choose_action(obs)

Defines how to select an action given an observation, obs

get_params()

Get the current parameters (weights) of the agent

Returns:

array of weights

get_prob_this_action(obs, action)

Get probability of taking an action given an observation. Does not necessarily need to be overridden, but is often called from self.get_probs_from_observations_and_actions()

get_probs_from_observations_and_actions(observations, actions, behavior_action_probs)

Get probabilities for each observation and action in the input arrays

set_new_params(new_params)

Set the parameters of the agent

Parameters:

new_params – array of weights

theta2crcf(theta)

Take theta and return cr_center,cf_center Keeping in mind that they must be capped so that when the fixed width of the box is added, it doesn’t exceed the original bounds.