mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-28 16:07:46 +00:00
fix when score is a string (#750)
This commit is contained in:
@@ -200,7 +200,7 @@ output_format:
|
||||
hypothesis: |-
|
||||
For each of the identified problem, you should propose a hypothesis strictly following to the JSON schema. Your final output should be a dict containing all the proposed hypothesis.
|
||||
{
|
||||
"problem name 1": {
|
||||
"problem name 1 (Should be exactly same as the problem name provided)": {
|
||||
"reason": "Provide a clear, logical progression from problem identification to hypothesis formulation, grounded in evidence (e.g., trace history, domain principles, or competition constraints). Refer to the Hypothesis Guidelines for better understanding. Reason should be short with no more than two sentences.",
|
||||
{% if not pipeline %}"component": "The component name that the hypothesis focus on. Must be one of ('DataLoadSpec', 'FeatureEng', 'Model', 'Ensemble', 'Workflow').",
|
||||
{% else %}"component": "The component name that the hypothesis focus on. Must be 'Pipeline'.",
|
||||
|
||||
@@ -326,15 +326,20 @@ class DSProposalV2ExpGen(ExpGen):
|
||||
"feasibility_score": 0.1,
|
||||
"risk_reward_balance_score": 0.1,
|
||||
}
|
||||
scores = pd.DataFrame(
|
||||
{
|
||||
problem_name: {
|
||||
score_key: hypothesis_dict[problem_name]["evaluation"].get(score_key, 0) * weight
|
||||
for score_key, weight in weights.items()
|
||||
}
|
||||
for problem_name in hypothesis_dict
|
||||
}
|
||||
)
|
||||
scores_dict = {}
|
||||
for problem_name in hypothesis_dict:
|
||||
scores_dict[problem_name] = {}
|
||||
for score_key in weights:
|
||||
if score_key not in hypothesis_dict[problem_name]["evaluation"]:
|
||||
scores_dict[problem_name][score_key] = 0
|
||||
else:
|
||||
try:
|
||||
scores_dict[problem_name][score_key] = (
|
||||
float(hypothesis_dict[problem_name]["evaluation"][score_key]) * weights[score_key]
|
||||
)
|
||||
except (ValueError, TypeError):
|
||||
scores_dict[problem_name][score_key] = 0
|
||||
scores = pd.DataFrame(scores_dict)
|
||||
scores_sorted = scores.sum().sort_values(ascending=False)
|
||||
if len(scores_sorted) > 5:
|
||||
scores_sorted = scores_sorted[: len(scores_sorted) // 2]
|
||||
|
||||
Reference in New Issue
Block a user