Skip to content

Commit

Permalink
Added three new keys on hypothesis reasoning
Browse files Browse the repository at this point in the history
  • Loading branch information
xisen-w committed Jul 31, 2024
1 parent df0f082 commit 1ad5f5d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rdagent/components/proposal/prompts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ hypothesis_gen:
{{ hypothesis_and_feedback }}
To help you generate new {{targets}}, we have prepared the following information for you:
{{ RAG }}
Please generate the new hypothesis based on the information above.
Please generate the new hypothesis based on the information above. Also generate the relevant keys for the reasoning and the distilled knowledge that follows.
hypothesis2experiment:
system_prompt: |-
Expand Down
8 changes: 7 additions & 1 deletion rdagent/core/proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,21 @@ class Hypothesis:
- Belief
"""

def __init__(self, hypothesis: str, reason: str, concise_reason: str) -> None:
def __init__(self, hypothesis: str, reason: str, concise_reason: str, concise_observation: str, concise_justification: str, concise_knowledge: str) -> None:
self.hypothesis: str = hypothesis
self.reason: str = reason
self.concise_reason: str = concise_reason
self.concise_observation: str = concise_observation
self.concise_justification: str = concise_justification
self.concise_knowledge: str = concise_knowledge

def __str__(self) -> str:
return f"""Hypothesis: {self.hypothesis}
Reason: {self.reason}
Concise Reason & Knowledge: {self.concise_reason}
Concise Observation: {self.concise_observation}
Concise Justification: {self.concise_justification}
Concise Knowledge: {self.concise_knowledge}
"""

# source: data_ana | model_nan = None
Expand Down
7 changes: 5 additions & 2 deletions rdagent/scenarios/qlib/prompts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ hypothesis_output_format: |-
The output should follow JSON format. The schema is as follows:
{
"hypothesis": "The new hypothesis generated based on the information provided.", Note that this should focus on model architecture, not training process or feature engineering or anything else
"reason": "The reason why you generate this hypothesis.",
"concise_reason": Two line summary. First line focuses on the a concise justification for the change. 2nd Line learns from first line and previous experiences (hypothesis & experiments & code & feedbacks) to generalise a knowledge statement (use tend to/because/if/generally/etc. ).
"reason": "The reason why you generate this hypothesis. It should be comprehensive and logical. It should cover the other keys below and extend them.",
"concise_reason": Two line summary. First line focuses on the a concise justification for the change. 2nd Line learns from first line and previous experiences (hypothesis & experiments & code & feedbacks) to generalise a knowledge statement (use tend to/because/if/generally/etc. ). This is the summary of the three keys below.
"concise_observation": One line summary. It focuses on the observation of the given scenario, data characteristics, or previous experiences (failures & succeses).
"concise_justification": One line summary. It focuses on the justification for the change in new hypothesis and the route of exploration supporting the growth of the hypothesis, based on the observation.
"concise_knowledge": One line summary. It focuses on a transferable knowledege that comes with the new hypothesis. Use conditional grammar. eg. "If...., ..; When..., .; and etc"
}
model_hypothesis_specification: |-
Expand Down
3 changes: 3 additions & 0 deletions rdagent/scenarios/qlib/proposal/model_proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def convert_response(self, response: str) -> ModelHypothesis:
hypothesis=response_dict["hypothesis"],
reason=response_dict["reason"],
concise_reason=response_dict["concise_reason"],
concise_observation=response_dict["concise_observation"],
concise_justification=response_dict["concise_justification"],
concise_knowledge=response_dict["concise_knowledge"],
)
return hypothesis

Expand Down

0 comments on commit 1ad5f5d

Please sign in to comment.