Back to projects
CASE STUDY · APPLIED ML · DEVELOPER TOOLS

AlgoLens.

AI-Assisted Static Code Analysis

Problem: Recognizing an algorithm and estimating its complexity from source code is hard to do by inspection. Solution: A pipeline that extracts structural features from the code and classifies the algorithm with machine learning.

An AI-assisted static code analysis system that parses source code, extracts structural features, and uses machine learning to classify algorithm types and predict time and space complexity.

AlgoLens
TECHNOLOGIES
PythonFastAPIReactTypeScriptAST ParsingRandom ForestMachine Learning
KEY FEATURES
  • Source-code parsing
  • AST analysis
  • Structural feature extraction
  • Algorithm classification
  • Time and space complexity prediction
  • Feature-level explainability
RESULTS
  • 96% classification accuracy across 25 algorithm classes
  • AST-based feature extractor feeding a Random Forest classifier
  • Feature-level explanations show which signals drove each result
UNDER THE HOOD

How it works.

From the problem to the decisions and trade-offs behind the build.

01

Problem

Source code contains structural clues about the algorithm it implements, but recognizing those patterns and estimating complexity from code alone can be difficult. AlgoLens explores how static analysis can extract those signals for further analysis.

02

Solution

AlgoLens combines AST-based structural feature extraction with machine-learning classification and rule-based time and space complexity estimates, then presents the analysis through a React interface.

03

Architecture

Source Code → AST Parsing → Feature Extraction → Machine Learning Model → Prediction → FastAPI → React Interface. The Python pipeline uses a 36-feature extractor and a Random Forest classifier trained on 285 labeled samples across 16 algorithm categories.

04

Key Engineering Challenges

Different implementations can express similar algorithms in different ways. Static structural features are useful signals, but cannot represent every runtime behavior or edge case; the training set also defines the scope of the classifier.

05

Technical Decisions

Parsing into an abstract syntax tree makes it possible to work with code structure rather than surface-level text. Classification and rule-based complexity estimates are separate steps, so an estimate is not presented as a direct guarantee from the model.

06

Implementation

The analysis pipeline parses source code, extracts structural features, classifies an algorithm with a Random Forest model, and estimates time and space complexity with rules. Feature-level explanations expose signals behind the output.

07

What I Learned

Useful ML tooling depends on thoughtful feature design, a clear distinction between model predictions and rule-based estimates, and honest communication about uncertainty.

KEEP EXPLORINGNext projectVoyager
View source on GitHub