Class

com.eharmony.aloha.models.reg

OptToKv

Related Doc: package reg

Permalink

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, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OptToKv
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

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

    Permalink

    a

    an Option

Value Members

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

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

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

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

    Permalink

    an Option

  5. final def asInstanceOf[T0]: T0

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

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

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

    Permalink

    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

    Permalink
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped