Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging - Bug Fixes #223

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/forecastlab/forecast_dash/Build%20and%20deploy%20Python%20app%20-%20staging-forecast-lab/staging?label=Build) ![BlackResults)](https://img.shields.io/github/workflow/status/forecastlab/forecast_dash/CI/master?label=Clean%20Code) ![Check Data Sources](https://img.shields.io/github/workflow/status/forecastlab/forecast_dash/Check%20Data%20Sources/staging?label=Data%20Sources) ![GitHub commit activity](https://img.shields.io/github/commit-activity/y/forecastlab/forecast_dash) ![GitHub contributors](https://img.shields.io/github/contributors/forecastlab/forecast_dash)
![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/forecastlab/forecast_dash/Docker_build_check.yml?branch=staging&label=Build) ![BlackResults)](https://img.shields.io/github/actions/workflow/status/forecastlab/forecast_dash/ci.yml?branch=staging&label=Clean%20Code) ![Check Data Sources](https://img.shields.io/github/actions/workflow/status/forecastlab/forecast_dash/datasources.yml?branch=staging&label=Data%20Sources) ![GitHub commit activity](https://img.shields.io/github/commit-activity/y/forecastlab/forecast_dash) ![GitHub contributors](https://img.shields.io/github/contributors/forecastlab/forecast_dash)

# USYD Forecasting Lab

Expand Down
16 changes: 11 additions & 5 deletions dash/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def select_best_model(data_dict, CV_score_function="MSE"):
def get_thumbnail_figure(data_dict, lg=12):
if data_dict == None:
return {}

watermark_config = (
watermark_information()
) # Grab the watermark text and fontsize information
Expand Down Expand Up @@ -694,10 +694,16 @@ def get_leaderboard_df(series_list, CV_score_function="MSE"):
chosen_methods = []

for series_title, forecast_data in forecast_series_dicts.items():
model_name = select_best_model(
forecast_data, CV_score_function=CV_score_function
)
chosen_methods.append(model_name)
try:
model_name = select_best_model(
forecast_data, CV_score_function=CV_score_function
)
chosen_methods.append(model_name)
except Exception as e:
print(
f"{[series_title]} had the following error: {e}"
) # Usually missing forecasts
pass

stats_raw = pd.DataFrame({"Method": chosen_methods})

Expand Down
20 changes: 15 additions & 5 deletions dash/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def _featured_latest_news(feature_series_title):
dbc.Col(
[
html.H2(
"US " + "inflation shows strong signs of stabilisation".title(),
"US "
+ "inflation shows strong signs of stabilisation".title(),
),
html.A(
html.H4("View all US forecasts"),
Expand All @@ -127,7 +128,9 @@ def _featured_latest_news(feature_series_title):
[
dcc.Graph(
figure=get_thumbnail_figure(
get_forecast_data("US Personal Consumption Expenditures: Chain-type Price Index (% Change, 1 Year)"),
get_forecast_data(
"US Personal Consumption Expenditures: Chain-type Price Index (% Change, 1 Year)"
),
lg=8,
),
config={"displayModeBar": False},
Expand Down Expand Up @@ -223,7 +226,9 @@ def _uk_snapshot():
[
dcc.Graph(
figure=get_thumbnail_figure(
get_forecast_data("UK Inflation (RPI)"),
get_forecast_data(
"UK Inflation (RPI)"
),
lg=8,
),
config={"displayModeBar": False},
Expand Down Expand Up @@ -276,14 +281,17 @@ def _link_search():
]
)


def _au_snapshot():
return [
dbc.Row(
[
dbc.Col(
[
html.H2(
"Have " + "AU" +" house prices reached the bottom?".title()
"Have "
+ "AU"
+ " house prices reached the bottom?".title()
),
html.A(
html.H4("View all Australian forecasts"),
Expand All @@ -300,7 +308,9 @@ def _au_snapshot():
[
dcc.Graph(
figure=get_thumbnail_figure(
get_forecast_data("Australian (Sydney) Change in House Prices"),
get_forecast_data(
"Australian (Sydney) Change in House Prices"
),
lg=8,
),
config={"displayModeBar": False},
Expand Down
3 changes: 3 additions & 0 deletions dash/pages/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def update_leaderboard_df(CV_score):
construct the best model leaderboard based upon user selected scoring function
"""
# Build leaderboard with chosen CV scoring function
data_sources_json_file = open("../shared_config/data_sources.json")
series_list = json.load(data_sources_json_file)

counts = get_leaderboard_df(series_list, CV_score)

win_proportion = (
Expand Down
4 changes: 1 addition & 3 deletions dash/pages/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,7 @@ def filter_results(**kwargs):

for item_title in unique_series_titles[0:show_num]:
try:
series_data = get_forecast_data(
item_title
)
series_data = get_forecast_data(item_title)
if series_data == None:
raise FileNotFoundError

Expand Down
Loading