protected def calculateBounds()

in core/src/main/scala/com/spotify/featran/transformers/QuantileOutlierRejector.scala [82:104]


  protected def calculateBounds(fq: Double, lq: Double): (Double, Double) =
    (fq, lq)

  override def buildFeatures(a: Option[Double], c: C, fb: FeatureBuilder[_]): Unit = {
    // we always skip since we don't care about the actual value, just the rejections
    fb.skip()
    a.foreach { x =>
      val (fq, lq, min, max) = c
      val (l, u) = calculateBounds(fq, lq)
      // all elements can't be the same
      if (x < min || x > max) {
        fb.reject(this, FeatureRejection.Outlier(x))
      } else if (min < max) {
        val r = (rejectLower, rejectUpper) match {
          case (true, true)  => x < l || x > u
          case (true, false) => x < l
          case (false, true) => x > u
          case _             => false
        }
        if (r) fb.reject(this, FeatureRejection.Outlier(x))
      }
    }
  }