# typed: strict
# frozen_string_literal: true

module Stats
  # Logarithmic regression specific normalizer
  class LogarithmicNormalizer < TransformedNormalizer
    extend T::Sig

    EPSILON = 1e-8

    # Convert x values to log-transformed matrix for logarithmic regression
    sig { override.returns(T::Array[T::Array[Float]]) }
    def normalized_x_matrix
      @x_values.map { |x| [@x.normalize(x) + EPSILON] }
    end

    protected

    sig { override.returns(T.class_of(Stats::Axis)) }
    def axis_class
      Stats::LogarithmicAxis
    end
  end
end
