Class: CohortAnalysis::Strategy::Big

Inherits:
CohortAnalysis::Strategy show all
Defined in:
lib/cohort_analysis/strategy/big.rb

Constant Summary

Constants inherited from CohortAnalysis::Strategy

DEFAULT_STRATEGY

Instance Attribute Summary

Attributes inherited from CohortAnalysis::Strategy

#current, #minimum_size, #original, #select_manager, #table, #table_name

Instance Method Summary collapse

Methods inherited from CohortAnalysis::Strategy

#==, create, #expr, #final, #initialize

Constructor Details

This class inherits a constructor from CohortAnalysis::Strategy

Instance Method Details

#reduce!Object

Reduce characteristics by removing them one by one and counting the results.

The characteristic whose removal leads to the highest record count is removed from the overall characteristic set.



7
8
9
10
11
12
13
14
15
16
# File 'lib/cohort_analysis/strategy/big.rb', line 7

def reduce!
  @current = if current.keys.length < 2
    {}
  else
    most_restrictive = current.keys.max_by do |k|
      count current.except(k)
    end
    current.except most_restrictive
  end
end