com.eharmony.aloha.models.reg

OptToKv

final class OptToKv[A] extends AnyVal

Provides an extension method toKv to convert Options to Seq[(String, Double)]. This is used to coerce the value to the type that is used in regression models. We don't do an implicit conversion method from Option[A] to Iterable[(String, Double)] because it can negatively impact type inference. So we make the users convert explicitly via:

val option: Option[Int] = Option(1)
val iterable = option.toKv
require(iterable == List(("", 1d)))
A

the type of Option.

Linear Supertypes
AnyVal, NotNull, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. OptToKv
  2. AnyVal
  3. NotNull
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OptToKv(a: Option[A])

    a

    an Option

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  2. final def ##(): Int

    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  4. val a: Option[A]

    an Option

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def getClass(): Class[_ <: AnyVal]

    Definition Classes
    AnyVal → Any
  7. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  8. def toKv(implicit f: (A) ⇒ Double): Seq[(String, Double)]

    Convert to Seq[(String, Double)].

    Convert to Seq[(String, Double)]. If a is None, return Nil. Otherwise, return ("", f(x)) :: Nil.

    f

    function to convert A to Double.

    returns

    a sequence

  9. def toString(): String

    Definition Classes
    Any

Inherited from AnyVal

Inherited from NotNull

Inherited from Any

Ungrouped