Skip to content

Commit

Permalink
update to tests and lints in light of upcoming ru-sql
Browse files Browse the repository at this point in the history
  • Loading branch information
rfl-urbaniak committed Mar 13, 2024
1 parent dcc9df9 commit 2acf01a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 53 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/python-app.yml

This file was deleted.

1 change: 1 addition & 0 deletions cities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
Project short description.
"""

__version__ = "0.0.1"
8 changes: 4 additions & 4 deletions cities/queries/causal_insight_slim.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,10 @@ def get_fips_predictions(
difference = (
self.predictions_original["observed"] - self.observed_outcomes_original
)
self.predictions_original[
["observed", "mean", "low", "high"]
] = self.predictions_original[["observed", "mean", "low", "high"]].sub(
difference, axis=0
self.predictions_original[["observed", "mean", "low", "high"]] = (
self.predictions_original[["observed", "mean", "low", "high"]].sub(
difference, axis=0
)
)

def plot_predictions(
Expand Down
12 changes: 6 additions & 6 deletions cities/queries/fips_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ def find_euclidean_kins(self):
if col.endswith(feature)
]
if _selected:
atemporal_aggregated_dict[
feature
] = atemporal_featurewise_contributions_df[_selected].sum(axis=1)
atemporal_aggregated_dict[feature] = (
atemporal_featurewise_contributions_df[_selected].sum(axis=1)
)

aggregated_atemporal_featurewise_contributions_df = pd.DataFrame(
atemporal_aggregated_dict
Expand All @@ -489,9 +489,9 @@ def find_euclidean_kins(self):
axis=1,
)
columns_to_normalize = self.aggregated_featurewise_contributions.iloc[:, 3:]
self.aggregated_featurewise_contributions.iloc[
:, 3:
] = columns_to_normalize.div(columns_to_normalize.sum(axis=1), axis=0)
self.aggregated_featurewise_contributions.iloc[:, 3:] = (
columns_to_normalize.div(columns_to_normalize.sum(axis=1), axis=0)
)

# some sanity checks
count = sum([1 for distance in distances if distance == 0])
Expand Down
12 changes: 8 additions & 4 deletions docs/guides/counterfactual-explained.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
"import seaborn as sns\n",
"\n",
"from cities.queries.causal_insight_slim import CausalInsightSlim\n",
"from cities.utils.data_grabber import (DataGrabber, find_repo_root,\n",
" list_available_features,\n",
" list_interventions, list_outcomes,\n",
" list_tensed_features)\n",
"from cities.utils.data_grabber import (\n",
" DataGrabber,\n",
" find_repo_root,\n",
" list_available_features,\n",
" list_interventions,\n",
" list_outcomes,\n",
" list_tensed_features,\n",
")\n",
"\n",
"root = find_repo_root()"
]
Expand Down
11 changes: 8 additions & 3 deletions docs/guides/similarity_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
"import os\n",
"\n",
"from cities.queries.fips_query import FipsQuery\n",
"\n",
"# proper imports\n",
"from cities.utils.data_grabber import (DataGrabber, list_available_features,\n",
" list_interventions, list_outcomes,\n",
" list_tensed_features)\n",
"from cities.utils.data_grabber import (\n",
" DataGrabber,\n",
" list_available_features,\n",
" list_interventions,\n",
" list_outcomes,\n",
" list_tensed_features,\n",
")\n",
"\n",
"smoke_test = \"CI\" in os.environ\n",
"smoke_test = True\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# @pytest.mark.parametrize("intervention", interventions)
# @pytest.mark.parametrize("outcome", outcomes)
@pytest.mark.parametrize("shift", shifts)
def test_smoke_InteractionsModel(shift): #(intervention, outcome, shift):
def test_smoke_InteractionsModel(shift): # (intervention, outcome, shift):
model = InteractionsModel(
outcome_dataset="unemployment_rate",
intervention_dataset="spending_commerce",
Expand Down

0 comments on commit 2acf01a

Please sign in to comment.