Class: AiRootShield::Enterprise::FalsePositiveReducer
- Inherits:
-
Object
- Object
- AiRootShield::Enterprise::FalsePositiveReducer
- Defined in:
- lib/ai_root_shield/enterprise/performance_optimizer.rb
Overview
False positive reduction using machine learning
Instance Attribute Summary collapse
-
#current_rate ⇒ Object
readonly
Returns the value of attribute current_rate.
-
#last_update ⇒ Object
readonly
Returns the value of attribute last_update.
Instance Method Summary collapse
-
#initialize(config) ⇒ FalsePositiveReducer
constructor
A new instance of FalsePositiveReducer.
- #process(analysis_result) ⇒ Object
- #reconfigure(optimization_level) ⇒ Object
- #update_models ⇒ Object
Constructor Details
#initialize(config) ⇒ FalsePositiveReducer
Returns a new instance of FalsePositiveReducer.
402 403 404 405 406 407 408 |
# File 'lib/ai_root_shield/enterprise/performance_optimizer.rb', line 402 def initialize(config) @config = config @current_rate = 0.0 @last_update = Time.now @model_accuracy = 0.92 @learning_buffer = [] end |
Instance Attribute Details
#current_rate ⇒ Object (readonly)
Returns the value of attribute current_rate.
400 401 402 |
# File 'lib/ai_root_shield/enterprise/performance_optimizer.rb', line 400 def current_rate @current_rate end |
#last_update ⇒ Object (readonly)
Returns the value of attribute last_update.
400 401 402 |
# File 'lib/ai_root_shield/enterprise/performance_optimizer.rb', line 400 def last_update @last_update end |
Instance Method Details
#process(analysis_result) ⇒ Object
410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/ai_root_shield/enterprise/performance_optimizer.rb', line 410 def process(analysis_result) return analysis_result unless @config[:enabled] confidence = calculate_confidence(analysis_result) if confidence < @config[:threshold] # Likely false positive adjusted_result = adjust_for_false_positive(analysis_result, confidence) adjusted_result[:false_positive_reduced] = true return adjusted_result end analysis_result end |
#reconfigure(optimization_level) ⇒ Object
425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/ai_root_shield/enterprise/performance_optimizer.rb', line 425 def reconfigure(optimization_level) case optimization_level when :conservative @config[:threshold] = 0.1 when :balanced @config[:threshold] = 0.15 when :aggressive @config[:threshold] = 0.25 when :maximum @config[:threshold] = 0.35 end end |
#update_models ⇒ Object
438 439 440 441 |
# File 'lib/ai_root_shield/enterprise/performance_optimizer.rb', line 438 def update_models @last_update = Time.now @model_accuracy = [@model_accuracy + 0.01, 0.98].min end |