Raxol.Core.ErrorPatternLearner (Raxol v2.6.0)

View Source

Error Pattern Learning System - 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 performance optimizations
  • Automatically update error templates with learned knowledge

Sub-modules:

  • Predictor -- predictions, confidence, suggestion enhancement
  • Persistence -- load/save/import/export

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 performance 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()],
  optimization_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(),
  optimization_correlations: %{required(atom()) => float()},
  patterns: %{required(String.t()) => error_pattern()},
  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_optimization_correlations()

Get patterns correlated with performance 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 \\ [])