Skip to content

Commit

Permalink
Merge pull request #29 from marimeireles/feat/fix-versioning
Browse files Browse the repository at this point in the history
Feat/fix versioning
  • Loading branch information
mrtzh authored Jun 29, 2023
2 parents 86fd234 + a3caaf5 commit 6cd6b06
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
install_requires=[
"autograd",
"dataclasses; python_version<'3.7'",
"gym",
"mesa",
"gym==0.23.0",
"mesa<=0.8.7",
"numpy",
"networkx",
"pandas",
"pyomo",
"py_mini_racer",
"pyomo",
"scipy",
"sklearn",
"scikit-learn",
"statsmodels",
"tqdm",
],
Expand All @@ -29,5 +29,5 @@
"Operating System :: MacOS",
"Operating System :: POSIX",
],
python_requires=">=3.6",
python_requires=">=3.8.10, <=3.10.11",
)
1 change: 1 addition & 0 deletions tests/test_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class State(wn.dynamics.BaseState):
state1: float = 0
state2: float = 1
state3: float = 3
num_features: np.ndarray = dataclasses.field(default_factory=lambda: np.array([]))

assert State.num_variables() == 3
assert State.variable_names() == ["state1", "state2", "state3"]
Expand Down
2 changes: 1 addition & 1 deletion whynot/causal_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Allow tracing to use ints and bools (since we only care about the forward
# pass and not derivatives).
for type_ in [bool, np.bool, np.bool_, int, np.int32, np.int64]:
for type_ in [bool, np.bool_, np.bool_, int, np.int32, np.int64]:
ArrayBox.register(type_)


Expand Down
11 changes: 6 additions & 5 deletions whynot/simulators/credit/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ class State(BaseState):
"""State of the Credit model."""

#: Matrix of agent features (e.g. https://www.kaggle.com/c/GiveMeSomeCredit/data)
features: np.ndarray = CreditData.features
features: np.ndarray = dataclasses.field(default_factory=lambda: np.array([]))
# features: np.ndarray = CreditData.features

#: Vector indicating whether or not the agent experiences financial distress
labels: np.ndarray = CreditData.labels
labels: np.ndarray = dataclasses.field(default_factory=lambda: np.array([]))

def values(self):
"""Return the state as a dictionary of numpy arrays."""
Expand All @@ -49,13 +50,13 @@ class Config(BaseConfig):

# Dynamics parameters
#: Subset of the features that can be manipulated by the agent
changeable_features: np.ndarray = np.array([0, 5, 7])
changeable_features: np.ndarray = dataclasses.field(default_factory=lambda: np.array([0, 5, 7]))

#: Model how much the agent adapt her features in response to a classifier
epsilon: float = 0.1

#: Parameters for logistic regression classifier used by the institution
theta: np.ndarray = np.ones((11, 1))
theta: np.ndarray = dataclasses.field(default_factory=lambda: np.ones((11, 1)))

#: L2 penalty on the logistic regression loss
l2_penalty: float = 0.0
Expand All @@ -64,7 +65,7 @@ class Config(BaseConfig):
memory: bool = False

#: State systems resets to if no memory.
base_state: Any = State()
base_state: Any = dataclasses.field(default_factory=lambda: State())

# Simulator book-keeping
#: Start time of the simulator
Expand Down

0 comments on commit 6cd6b06

Please sign in to comment.