Credit

State

class whynot.simulators.credit.State[source]

State of the Credit model.

features = array([[-0.0227904 , 0.81170814, -0.10910125, ..., -0.05447654, -0.74176455, 1. ], [-0.02210369, 0.46512671, -0.10910125, ..., 0.23555616, -0.74176455, 1. ], [-0.02173707, -0.71325019, 0.17667678, ..., -0.05447654, -0.74176455, 1. ], ..., [-0.02268837, 0.04922898, -0.10910125, ..., -0.05447654, -0.74176455, 1. ], [-0.02225384, -0.78256647, -0.10910125, ..., -0.05447654, 0.9998099 , 1. ], [-0.02228875, -1.05983163, 0.46245481, ..., -0.05447654, 0.12902268, 1. ]])

//www.kaggle.com/c/GiveMeSomeCredit/data)

Type:Matrix of agent features (e.g. https
labels = array([0, 1, 0, ..., 0, 0, 1])

Vector indicating whether or not the agent experiences financial distress

values()[source]

Return the state as a dictionary of numpy arrays.

Config

class whynot.simulators.credit.Config[source]

Parameterization of Credit simulator dynamics.

Examples

>>> # Configure simulator for run for 10 iterations
>>> config = Config(start_time=0, end_time=10, delta_t=1)
base_state = State(features=array([[-0.0227904 , 0.81170814, -0.10910125, ..., -0.05447654, -0.74176455, 1. ], [-0.02210369, 0.46512671, -0.10910125, ..., 0.23555616, -0.74176455, 1. ], [-0.02173707, -0.71325019, 0.17667678, ..., -0.05447654, -0.74176455, 1. ], ..., [-0.02268837, 0.04922898, -0.10910125, ..., -0.05447654, -0.74176455, 1. ], [-0.02225384, -0.78256647, -0.10910125, ..., -0.05447654, 0.9998099 , 1. ], [-0.02228875, -1.05983163, 0.46245481, ..., -0.05447654, 0.12902268, 1. ]]), labels=array([0, 1, 0, ..., 0, 0, 1]))

State systems resets to if no memory.

changeable_features = array([0, 5, 7])

Subset of the features that can be manipulated by the agent

delta_t = 1

Spacing of the evaluation grid

end_time = 5

End time of the simulator

epsilon = 0.1

Model how much the agent adapt her features in response to a classifier

l2_penalty = 0.0

L2 penalty on the logistic regression loss

memory = False

Whether or not dynamics have memory

start_time = 0

Start time of the simulator

theta = array([[1.], [1.], [1.], [1.], [1.], [1.], [1.], [1.], [1.], [1.], [1.]])

Parameters for logistic regression classifier used by the institution

Interventions

class whynot.simulators.credit.Intervention(time=30, **kwargs)[source]

Parameterization of an intervention in the Credit model.

An intervention changes a subset of the configuration variables in the specified year. The remaining variables are unchanged.

Examples

>>> # Starting at time 25, update the classifier to random chance.
>>> config = Config()
>>> Intervention(time=25, theta=np.zeros_like(config.theta))
__init__(time=30, **kwargs)[source]

Specify an intervention in credit.

Parameters:
  • time (int) – Time of intervention in simulator dynamics.
  • kwargs (dict) – Only valid keyword arguments are parameters of Config.

Experiments