Skip to content

Lazyfying - #239

Open
nikbpetrov wants to merge 6 commits into
forecastingresearch:mainfrom
nikbpetrov:refactor/lazy-imports
Open

nikbpetrov wants to merge 6 commits into
forecastingresearch:mainfrom
nikbpetrov:refactor/lazy-imports

Conversation

@nikbpetrov

@nikbpetrov nikbpetrov commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

meant to be merged as separate commits, just grouped here in the same PR

7de71bd is not lazy-related, sorry for sneaking it in, but it's a 1-line print -> logger.debug, change (preps the testing framework work)

@nikbpetrov
nikbpetrov force-pushed the refactor/lazy-imports branch from 0a2dc33 to d0914f1 Compare June 30, 2026 17:41
@nikbpetrov
nikbpetrov force-pushed the refactor/lazy-imports branch from 7de71bd to ee90d58 Compare September 10, 2026 02:04
Comment thread src/helpers/keys.py
"API_KEY_TOGETHERAI": "API_KEY_TOGETHERAI",
"API_KEY_GOOGLE": "API_KEY_GEMINI",
"API_KEY_MISTRAL": "API_KEY_MISTRAL",
"API_KEY_XAI": "API_KEY_XAI",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these were removed in the llm forecaster rewrite, added back here. Why?

Comment thread src/leaderboard/main.py
df_bs = (
df.groupby(["forecast_due_date", "source"])
.apply(question_level_bootstrap, include_groups=False)
.apply(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: from the docs so can you just drop the lambda and do .apply(question_level_bootstrap, include_groups=False, random_state=random_state)

)
HUMAN_QUESTIONS.update(human_questions_of_question_type)

# Optional reproducibility: when QUESTION_SET_SEED is set, thread a single RandomState through

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explicitly mention "for testing"? Claude was confused about this and thought the seed was missing in deployment.

# Optional reproducibility: when QUESTION_SET_SEED is set, thread a single RandomState through
# both sampling passes so the published set is deterministic. Unset (the default) preserves the
# historical unseeded behaviour.
seed_env = os.getenv("QUESTION_SET_SEED")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also check that seed_env is None when we're in prod to ensure it isn't accidentally ever set in deployment?

Comment thread src/helpers/env.py
WORKSPACE_BUCKET = os.environ.get("WORKSPACE_BUCKET")
# Names read as plain strings (``None`` if unset).
_STR_VARS = {
"PROJECT_ID": "CLOUD_PROJECT",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about a commit renaming PROJECT_ID to CLOUD_PROJECT and simplifying this to a set of strings?

)
HUMAN_QUESTIONS.update(human_questions_of_question_type)

# Optional reproducibility: when QUESTION_SET_SEED is set, thread a single RandomState through

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of QUESTION_SET_SEED and the seed in the leaderboard code, what do you think about adding RANDOM_SEED to env.py? It would be an int and None by default and be referred to for any non-deterministic behavior in the codebase. Then the check for seed + prod can also be done in env.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants