Skip to content

Commit f2729da

Browse files
authored
Changed strategic logistic loss to avoid adding a second gaming stage (#22)
* Changed strategic logistic loss to avoid adding a second gaming stage * Renamed strategic_logistic_loss
1 parent e33e56b commit f2729da

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

whynot/simulators/credit/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
dynamics,
77
Intervention,
88
simulate,
9-
strategic_logistic_loss,
9+
logistic_loss,
1010
State,
1111
)
1212

whynot/simulators/credit/environments.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
Config,
1010
Intervention,
1111
simulate,
12-
strategic_logistic_loss,
12+
logistic_loss,
1313
State,
1414
)
1515

1616

1717
def compute_reward(intervention, state, config):
1818
"""Compute the reward based on the observed state and choosen intervention."""
19-
return strategic_logistic_loss(
19+
return logistic_loss(
2020
config, state.features, state.labels, intervention.updates["theta"],
2121
)
2222

whynot/simulators/credit/simulator.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,14 @@ def __init__(self, time=30, **kwargs):
104104
super(Intervention, self).__init__(Config, time, **kwargs)
105105

106106

107-
def strategic_logistic_loss(config, features, labels, theta):
107+
def logistic_loss(config, features, labels, theta):
108108
"""Evaluate the performative loss for logistic regression classifier."""
109109

110110
config = config.update(Intervention(theta=theta))
111111

112-
# Compute adjusted data
113-
strategic_features = agent_model(features, config)
114-
115112
# compute log likelihood
116-
num_samples = strategic_features.shape[0]
117-
logits = strategic_features @ config.theta
113+
num_samples = features.shape[0]
114+
logits = features @ config.theta
118115
log_likelihood = (1.0 / num_samples) * np.sum(
119116
-1.0 * np.multiply(labels, logits) + np.log(1 + np.exp(logits))
120117
)

0 commit comments

Comments
 (0)