Specialized Analysis Models
Relevant source files
The following files were used as context for generating this wiki page:
The Specialized Analysis Models within the MarketSage ecosystem comprise a suite of modular detection engines and AI-driven services designed to evaluate product listings, seller reliability, and market trends. These models act as the core intelligence layer, providing weighted risk assessments and predictive insights to protect users from fraudulent activities and optimize their shopping decisions.
At the high level, the system orchestrates multiple specialized engines—ranging from price anomaly detection to advanced threat intelligence—to generate a comprehensive ScamAnalysisResult. Each model is designed to operate independently or as part of a parallel execution flow, allowing for granular analysis of specific data points like review patterns, image quality, and historical price volatility.
Core Analysis Orchestration
The ScamDetectionModel serves as the primary entry point for analyzing product data. It coordinates several specialized engines to produce a unified risk probability.
Analysis Workflow
When a product is analyzed, the model prepares the data and executes enabled heuristics in parallel. The results are then aggregated using a weighted average formula adjusted by a global sensitivity threshold.
The workflow ensures that only heuristics enabled in the user preferences contribute to the final score, though disabled ones may be included in the output with a zero score for transparency.
Sources: src/common/models/scamDetectionModel.ts:31-75, src/common/types/scamDetection.ts:21-33
Risk Levels
The system maps the calculated probability to four distinct risk levels:
| Risk Level | Probability Range | Description |
|---|---|---|
| LOW | < 0.3 | Standard shopping precautions apply. |
| MEDIUM | 0.3 - 0.6 | Moderate risks; additional verification suggested. |
| HIGH | 0.6 - 0.8 | Significant risk factors detected; exercise extreme caution. |
| CRITICAL | > 0.8 | Multiple high-risk indicators; block recommended. |
| Sources: src/common/models/scamDetectionModel.ts:182-187, src/core/security/AdvancedThreatDetection.ts:400-435 |
Specialized Detection Engines
Review Pattern Analysis
The ReviewAnalyzer focuses on identifying synthetic or manipulated feedback patterns. It looks for statistical spikes and content inconsistencies that suggest fraudulent review generation.
Key detection methods include:
- Review Spikes: Identifying an unusual volume of 5-star reviews within a short time frame (e.g., 24 hours).
- Sentiment Inconsistency: Flagging instances where the rating score does not align with the text sentiment.
- Repetitive Text: Detecting identical or highly similar phrasing across multiple reviews.
- Verified Purchase Ratio: Evaluating the percentage of reviews from confirmed buyers.
Sources: src/common/models/scamDetection/reviewAnalyzer.ts:4-31
Price Anomaly and Prediction
The system utilizes two layers for pricing analysis: immediate anomaly detection and AI-powered trend prediction.
The PricePredictionEngine utilizes a TensorFlow.js neural network to forecast future price movements. It processes 15 features, including recent price changes, market volatility, and seasonal factors.
Advanced Threat Detection
The AdvancedThreatDetection service identifies sophisticated threats such as phishing, domain spoofing, and social engineering. It maintains a ThreatIntelligence state that includes blacklisted sellers and known threat signatures.
Data Models and Schemas
Analysis Result Structure
The output of the analysis models is encapsulated in the ScamAnalysisResult interface, providing both a numeric probability and qualitative findings.
| Field | Type | Description |
|---|---|---|
probability | number | 0-1 scale indicating the likelihood of a scam. |
riskFactors | string[] | List of significant issues found (e.g., "Price suspiciously low"). |
detailedResults | object[] | Per-heuristic scores, weights, and specific findings. |
overallRiskLevel | enum | LOW, MEDIUM, HIGH, or CRITICAL. |
| Sources: src/common/types/scamDetection.ts:21-33 |
Heuristic Configuration
Heuristics are configurable entities that allow users to customize analysis sensitivity.
weight: Determines the influence of the heuristic on the final score (0-1).configOptions: Heuristic-specific parameters, such aszScoreThresholdfor price anomalies.
Sources: src/common/types/scamDetection.ts:4-12
Summary
Specialized Analysis Models provide a robust, multi-layered defense mechanism. By combining statistical engines (Review, Price Anomaly) with AI models (Price Prediction) and threat intelligence, MarketSage delivers nuanced security assessments. The orchestration logic in ScamDetectionModel ensures these insights are aggregated into actionable risk levels for the user.