Optimize data processing and improve logging for autoheuristic training#2
Optimize data processing and improve logging for autoheuristic training#2ShashankFC wants to merge 1 commit into
Conversation
Entelligence AI Vulnerability ScannerStatus: No security vulnerabilities found Your code passed our comprehensive security analysis. |
WalkthroughThis PR implements several bug fixes and defensive programming improvements to the decision tree training logic in the autoheuristic module. The changes focus on improving code reliability through better error handling and logical consistency. Key improvements include fixing variable assignment order for logical flow, enhancing error detection with upgraded logging for high standard deviation cases, adding division-by-zero protection in speedup calculations, refactoring dictionary population logic for correctness, and fixing the near-best configurations logic to properly append all new rows. These changes collectively strengthen the robustness of the training pipeline without altering its core functionality. Changes
Sequence DiagramThis diagram shows the interactions between components: sequenceDiagram
participant Trainer as Training System
participant Eval as eval()
participant Stats as calculate_stats()
participant Winner as get_winner_and_speedup()
participant NearBest as add_near_best_configs()
participant Logger as Logging System
Trainer->>Eval: evaluate models
activate Eval
loop for each model
Eval->>Eval: train and test model
Eval->>Eval: calculate num_correct, num_wrong
alt model performs better
Eval->>Eval: update best_model_num_correct
Eval->>Eval: store best_model
Eval->>Eval: store safe_proba & unsafe_leaves
end
end
deactivate Eval
Trainer->>Stats: calculate_stats(group)
activate Stats
Stats->>Stats: compute median, std, relative_std
alt relative_std > 5
Stats->>Logger: log.error(high relative std + group details)
end
Stats-->>Trainer: return statistics
deactivate Stats
Trainer->>Winner: get_winner_and_speedup(group)
activate Winner
Winner->>Winner: sort by median_execution_time
Winner->>Winner: identify winner and second_best
alt winning_time > 0
Winner->>Winner: speedup = second_best / winning_time
else winning_time == 0
Winner->>Winner: speedup = 1.0
end
loop for each row in group
loop find matching choice
Winner->>Winner: build choice2time mapping
end
end
Winner-->>Trainer: return winner, speedup, choice2time
deactivate Winner
Trainer->>NearBest: add_near_best_configs(df)
activate NearBest
loop for each row
loop for each choice in choice2time
NearBest->>NearBest: calculate relative_performance
NearBest->>NearBest: create new_row with actual_winner
NearBest->>NearBest: append to new_rows
Note over NearBest: All near-best configs added,<br/>not just those >= 0.98
end
end
NearBest-->>Trainer: return augmented DataFrame
deactivate NearBest
🔗 Cross-Repository Impact AnalysisEnable automatic detection of breaking changes across your dependent repositories. → Set up now Learn more about Cross-Repository AnalysisWhat It Does
How to Enable
Benefits
Note for WindsurfPlease change the default marketplace provider to the following in the windsurf settings:Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts belowEmoji Descriptions:
Interact with the Bot:
Also you can trigger various commands with the bot by doing The current supported commands are
More commands to be added soon. |
EntelligenceAI PR Summary
This PR fixes multiple bugs and adds defensive programming improvements to the decision tree training logic in the autoheuristic module.
best_model_num_correctnow set beforebest_modelfor logical consistencywinning_timeis 0choice2timedictionary population with nested loop and break statement for correct mappingadd_near_best_configslogic to append all new rows unconditionally, making 0.98 threshold check a no-op