Skip to content

Commit f12f9f6

Browse files
authored
Merge pull request #1224 from cmu-delphi/release/indicators_v0.1.13_utils_v0.1.10
Release covidcast-indicators 0.1.13
2 parents 9f67b79 + 64c8158 commit f12f9f6

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.1.12
2+
current_version = 0.1.13
33
commit = True
44
message = chore: bump covidcast-indicators to {new_version}
55
tag = False

ansible/templates/sir_complainsalot-params-prod.json.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"fb-survey": {
3838
"max_age": 3,
3939
"maintainers": ["U01069KCRS7"],
40-
"retired-signals": ["smoothed_anxious_5d", "smoothed_wanxious_5d", "smoothed_depressed_5d", "smoothed_wdepressed_5d", "smoothed_felt_isolated_5d", "smoothed_wfelt_isolated_5d", "smoothed_large_event_1d", "smoothed_wlarge_event_1d", "smoothed_restaurant_1d", "smoothed_wrestaurant_1d", "smoothed_shop_1d", "smoothed_wshop_1d", "smoothed_spent_time_1d", "smoothed_wspent_time_1d", "smoothed_travel_outside_state_5d", "smoothed_wtravel_outside_state_5d", "smoothed_work_outside_home_1d", "smoothed_wwork_outside_home_1d", "smoothed_wearing_mask", "smoothed_wwearing_mask", "smoothed_vaccine_likely_local_health", "smoothed_wvaccine_likely_local_health", "smoothed_others_masked", "smoothed_wothers_masked", "smoothed_wanted_test_14d", "smoothed_wwanted_test_14d", "smoothed_covid_vaccinated_or_accept", "smoothed_wcovid_vaccinated_or_accept", "smoothed_accept_covid_vaccine", "smoothed_waccept_covid_vaccine", "smoothed_hesitancy_reason_allergic", "smoothed_whesitancy_reason_allergic", "smoothed_hesitancy_reason_not_recommended", "smoothed_whesitancy_reason_not_recommended", "smoothed_hesitancy_reason_distrust_vaccines", "smoothed_whesitancy_reason_distrust_vaccines", "smoothed_hesitancy_reason_health_condition", "smoothed_whesitancy_reason_health_condition", "smoothed_hesitancy_reason_pregnant", "smoothed_whesitancy_reason_pregnant", "smoothed_vaccine_likely_friends", "smoothed_wvaccine_likely_friends", "smoothed_vaccine_likely_who", "smoothed_wvaccine_likely_who", "smoothed_vaccine_likely_govt_health", "smoothed_wvaccine_likely_govt_health", "smoothed_vaccine_likely_politicians", "smoothed_wvaccine_likely_politicians", "smoothed_vaccine_likely_doctors", "smoothed_wvaccine_likely_doctors", "smoothed_felt_isolated_7d", "smoothed_wfelt_isolated_7d", "smoothed_worried_become_ill", "smoothed_wworried_become_ill"]
40+
"retired-signals": ["smoothed_anxious_5d", "smoothed_wanxious_5d", "smoothed_depressed_5d", "smoothed_wdepressed_5d", "smoothed_felt_isolated_5d", "smoothed_wfelt_isolated_5d", "smoothed_large_event_1d", "smoothed_wlarge_event_1d", "smoothed_restaurant_1d", "smoothed_wrestaurant_1d", "smoothed_shop_1d", "smoothed_wshop_1d", "smoothed_spent_time_1d", "smoothed_wspent_time_1d", "smoothed_travel_outside_state_5d", "smoothed_wtravel_outside_state_5d", "smoothed_work_outside_home_1d", "smoothed_wwork_outside_home_1d", "smoothed_wearing_mask", "smoothed_wwearing_mask", "smoothed_vaccine_likely_local_health", "smoothed_wvaccine_likely_local_health", "smoothed_others_masked", "smoothed_wothers_masked", "smoothed_wanted_test_14d", "smoothed_wwanted_test_14d", "smoothed_covid_vaccinated_or_accept", "smoothed_wcovid_vaccinated_or_accept", "smoothed_accept_covid_vaccine", "smoothed_waccept_covid_vaccine", "smoothed_hesitancy_reason_allergic", "smoothed_whesitancy_reason_allergic", "smoothed_hesitancy_reason_not_recommended", "smoothed_whesitancy_reason_not_recommended", "smoothed_hesitancy_reason_distrust_vaccines", "smoothed_whesitancy_reason_distrust_vaccines", "smoothed_hesitancy_reason_health_condition", "smoothed_whesitancy_reason_health_condition", "smoothed_hesitancy_reason_pregnant", "smoothed_whesitancy_reason_pregnant", "smoothed_vaccine_likely_friends", "smoothed_wvaccine_likely_friends", "smoothed_vaccine_likely_who", "smoothed_wvaccine_likely_who", "smoothed_vaccine_likely_govt_health", "smoothed_wvaccine_likely_govt_health", "smoothed_vaccine_likely_politicians", "smoothed_wvaccine_likely_politicians", "smoothed_vaccine_likely_doctors", "smoothed_wvaccine_likely_doctors", "smoothed_felt_isolated_7d", "smoothed_wfelt_isolated_7d", "smoothed_worried_become_ill", "smoothed_wworried_become_ill", "smoothed_inperson_school_fulltime", "smoothed_winperson_school_fulltime", "smoothed_inperson_school_parttime", "smoothed_winperson_school_parttime"]
4141
},
4242
"indicator-combination": {
4343
"max_age": 4,

doctor_visits/delphi_doctor_visits/run.py

+3
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ def run_module(params):
9595
weekday=weekday,
9696
se=params["indicator"]["se"]
9797
)
98+
if sensor is None:
99+
logging.error("No sensors calculated, no output will be produced")
100+
continue
98101
# write out results
99102
out_name = "smoothed_adj_cli" if weekday else "smoothed_cli"
100103
if params["indicator"]["se"]:

doctor_visits/delphi_doctor_visits/update_sensor.py

+3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ def update_sensor(
126126

127127
# handle if we need to adjust by weekday
128128
params = Weekday.get_params(data) if weekday else None
129+
if weekday and np.any(np.all(params == 0,axis=1)):
130+
# Weekday correction failed for at least one count type
131+
return None
129132

130133
# handle explicitly if we need to use Jeffreys estimate for binomial proportions
131134
jeffreys = bool(se)

doctor_visits/delphi_doctor_visits/weekday.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
Created: 2020-05-06
55
"""
66

7+
# standard packages
8+
import logging
9+
710
# third party
811
import cvxpy as cp
912
import numpy as np
@@ -82,15 +85,20 @@ def get_params(data):
8285
penalty = (
8386
lmbda * cp.norm(cp.diff(b[6:], 3), 1) / (X.shape[0] - 2)
8487
) # L-1 Norm of third differences, rewards smoothness
85-
try:
86-
prob = cp.Problem(cp.Minimize(-ll + lmbda * penalty))
87-
_ = prob.solve()
88-
except:
89-
# If the magnitude of the objective function is too large, an error is
90-
# thrown; Rescale the objective function
91-
prob = cp.Problem(cp.Minimize((-ll + lmbda * penalty) / 1e5))
92-
_ = prob.solve()
93-
params[i, :] = b.value
88+
scales = [1, 1e5, 1e10, 1e15]
89+
for scale in scales:
90+
try:
91+
prob = cp.Problem(cp.Minimize((-ll + lmbda * penalty) / scale))
92+
_ = prob.solve()
93+
params[i,:] = b.value
94+
break
95+
except:
96+
# If the magnitude of the objective function is too large, an error is
97+
# thrown; Rescale the objective function by going through loop
98+
pass
99+
else:
100+
# Leaving params[i,:] = 0 is equivalent to not performing weekday correction
101+
logging.error("Unable to calculate weekday correction")
94102

95103
return params
96104

0 commit comments

Comments
 (0)