Skip to content

feat(ml-engine): Train Heuristic Regression Engine for Gas Cost Anomaly Detection - #627

Open
SharifIbrahimDev wants to merge 1 commit into
MDTechLabs:mainfrom
SharifIbrahimDev:feat/heuristic-regression-engine
Open

feat(ml-engine): Train Heuristic Regression Engine for Gas Cost Anomaly Detection#627
SharifIbrahimDev wants to merge 1 commit into
MDTechLabs:mainfrom
SharifIbrahimDev:feat/heuristic-regression-engine

Conversation

@SharifIbrahimDev

Copy link
Copy Markdown
Contributor

Closes #606

Summary of Changes

  • Implemented FeatureExtractor (libs/ml-engine/src/feature-extractor.ts) to extract structural AST metrics (cyclomatic complexity, max loop depth, variable count, storage accesses, memory allocations).
  • Implemented GasPredictor (libs/ml-engine/src/predictor.ts) featuring heuristic regression model weights to compute a GasComplexityIndex.
  • Added baseline comparison against industry averages (25.0 baseline score) and automated anomaly detection for code exceeding 50% baseline deviation.
  • Provides optimization recommendations for high-complexity functions.
  • Added comprehensive unit test coverage in libs/ml-engine/src/predictor.spec.ts.

Files Added

  • libs/ml-engine/src/feature-extractor.ts
  • libs/ml-engine/src/predictor.ts
  • libs/ml-engine/src/index.ts
  • libs/ml-engine/src/predictor.spec.ts

Acceptance Criteria Checklist

  • Successfully outputs complexity index scores for submitted source code.
  • Flags high-complexity functions lacking explicit static rule matches.
  • All 6 unit tests passing.

@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@SharifIbrahimDev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[CORE] Train Heuristic Regression Engine for Gas Cost Anomaly Detection

1 participant