Method: EasyML::Data::Preprocessor::SimpleImputer#should_transform_categorical?

Defined in:
lib/easy_ml/data/preprocessor/simple_imputer.rb

#should_transform_categorical?(val) ⇒ Boolean

Returns:

  • (Boolean)


167
168
169
170
171
172
173
# File 'lib/easy_ml/data/preprocessor/simple_imputer.rb', line 167

def should_transform_categorical?(val)
  values = @statistics.dig(:categorical, :value) || {}
  min_ct = options[:categorical_min] || 25
  allowed_values = values.select { |_v, c| c >= min_ct }

  allowed_values.keys.map(&:to_s).exclude?(val)
end