Raxol.Core.ErrorPatternLearner (Raxol v2.0.1)

View Source

Error Pattern Learning System - Phase 4.3 Error Experience

Machine learning-inspired system that learns from error patterns to:

  • Predict likely errors before they occur
  • Improve fix suggestions based on success rates
  • Identify emerging error patterns in Phase 3 optimizations
  • Automatically update error templates with learned knowledge

Features

  • Pattern recognition using frequency analysis
  • Success rate tracking for fix suggestions
  • Phase 3 optimization correlation analysis
  • Predictive error detection
  • Automatic template enhancement

Summary

Functions

Returns a specification to start this module under a supervisor.

Get enhanced suggestions based on learned patterns.

Export learned patterns for analysis or backup.

Get the most common error patterns.

Get learning statistics and insights.

Get patterns correlated with Phase 3 optimizations.

Import previously learned patterns.

Get predictions for potential errors based on current context.

Record a new error occurrence for learning.

Record the success or failure of a fix suggestion.

Types

error_pattern()

@type error_pattern() :: %{
  signature: String.t(),
  frequency: integer(),
  contexts: [map()],
  successful_fixes: [String.t()],
  failure_modes: [String.t()],
  phase3_correlation: float(),
  prediction_confidence: float(),
  first_seen: DateTime.t(),
  last_seen: DateTime.t()
}

learning_state()

@type learning_state() :: %Raxol.Core.ErrorPatternLearner{
  last_cleanup: DateTime.t(),
  learning_enabled: boolean(),
  patterns: %{required(String.t()) => error_pattern()},
  phase3_correlations: %{required(atom()) => float()},
  prediction_models: map(),
  suggestion_success_rates: %{required(String.t()) => float()}
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

enhance_suggestions(error, base_suggestions, context \\ %{})

Get enhanced suggestions based on learned patterns.

export_patterns(format \\ :json)

Export learned patterns for analysis or backup.

get_common_patterns(limit \\ 10)

Get the most common error patterns.

get_learning_stats()

Get learning statistics and insights.

get_phase3_correlations()

Get patterns correlated with Phase 3 optimizations.

import_patterns(patterns_data)

Import previously learned patterns.

predict_errors(context)

Get predictions for potential errors based on current context.

record_error(error, context \\ %{})

Record a new error occurrence for learning.

record_fix_outcome(error_signature, fix_description, outcome)

Record the success or failure of a fix suggestion.

start_link(init_opts \\ [])