Class/Object

com.eharmony.aloha.models.reg

RegressionModel

Related Docs: object RegressionModel | package reg

Permalink

case class RegressionModel[U, -A, +B <: U](modelId: ModelIdentity, featureNames: IndexedSeq[String], featureFunctions: IndexedSeq[GenAggFunc[A, Iterable[(String, Double)]]], beta: PolynomialEvaluationAlgo, invLinkFunction: (Double) ⇒ Double, spline: Option[Spline], numMissingThreshold: Option[Int], auditor: Auditor[U, Double, B]) extends SubmodelBase[U, Double, A, B] with RegressionFeatures[A] with Logging with Product with Serializable

A regression model capable of doing not only linear regression but polynomial regression in general.

val regImp = "com.eharmony.aloha.models.reg.RegressionModelValueToTupleConversions._"
val compiler = ...
val plugin = ...
val imports: Seq[String] = ...
val s = CompiledSemantics(compiler, plugin, imports :+ regImp)

This is useful because these conversions allow implicit conversion function from some of the AnyVal types and Options of AnyVal types to Iterable[(String, Double)]. This is useful because specifying features in the JSON spec like:

{
  ...
  "features": {
    "intercept": "-3",
    "income": "${user.profile.income}"
  }
}

into sequences like:

val interceptFeature = Iterable(("intercept", 3.0))  // AND
val incomeFeature = Iterable(("income", [the income value converted to a double]))

For more information, see com.eharmony.aloha.models.reg.RegressionModelValueToTupleConversions.

A

model input type

B

model output type. to convert from B to com.eharmony.aloha.score.Scores.Score

modelId

An identifier for the model. User in score and error reporting.

featureNames

feature names (parallel to featureFunctions)

featureFunctions

feature extracting functions.

beta

representation of the regression model parameters.

invLinkFunction

a function applied to the inner product of the input vector and weight vector.

spline

an optional calibration spline to Obtaining calibrated probability estimates from decision trees and naive Bayesian classifiers, Zadrozny, Elkan (ICML, 2001). This is applied prior to invLinkFunction

numMissingThreshold

if provided, we check whether the threshold is exceeded. If so, return an error instead of the computed score. This is for missing data situations.

Linear Supertypes
Serializable, Serializable, Product, Equals, Logging, RegressionFeatures[A], SubmodelBase[U, Double, A, B], Model[A, B], (A) ⇒ B, Submodel[Double, A, B], Closeable, AutoCloseable, Identifiable[ModelIdentity], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RegressionModel
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Logging
  7. RegressionFeatures
  8. SubmodelBase
  9. Model
  10. Function1
  11. Submodel
  12. Closeable
  13. AutoCloseable
  14. Identifiable
  15. AnyRef
  16. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RegressionModel(modelId: ModelIdentity, featureNames: IndexedSeq[String], featureFunctions: IndexedSeq[GenAggFunc[A, Iterable[(String, Double)]]], beta: PolynomialEvaluationAlgo, invLinkFunction: (Double) ⇒ Double, spline: Option[Spline], numMissingThreshold: Option[Int], auditor: Auditor[U, Double, B])

    Permalink

    modelId

    An identifier for the model. User in score and error reporting.

    featureNames

    feature names (parallel to featureFunctions)

    featureFunctions

    feature extracting functions.

    beta

    representation of the regression model parameters.

    invLinkFunction

    a function applied to the inner product of the input vector and weight vector.

    spline

    an optional calibration spline to Obtaining calibrated probability estimates from decision trees and naive Bayesian classifiers, Zadrozny, Elkan (ICML, 2001). This is applied prior to invLinkFunction

    numMissingThreshold

    if provided, we check whether the threshold is exceeded. If so, return an error instead of the computed score. This is for missing data situations.

Type Members

  1. case class Features[F](features: F, missing: Map[String, Seq[String]] = scm.Map.empty, missingOk: Boolean = true) extends Product with Serializable

    Permalink

    Container for information returned by RegressionFeatures.constructFeatures.

    Container for information returned by RegressionFeatures.constructFeatures. Note that as is, this declaration will cause a compiler warning:

    "The outer reference in this type test cannot be checked at run time."

    This is a known issue and is a scala bug. See: - https://issues.scala-lang.org/browse/SI-4440 - http://stackoverflow.com/questions/16450008/typesafe-swing-events-the-outer-reference-in-this-type-test-cannot-be-checked-a

    A solution that would remove the warning is to make the class not final. Not doing this just to remove a warning.

    features

    features that were extracted from an input value.

    missing

    map from feature name to variables in the feature function that were missing.

    missingOk

    whether the number of

    Attributes
    protected[this]
    Definition Classes
    RegressionFeatures

Value Members

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. def andThen[A](g: (B) ⇒ A): (A) ⇒ A

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  5. final def apply(a: A): B

    Permalink
    Definition Classes
    SubmodelBase → Function1
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. val auditor: Auditor[U, Double, B]

    Permalink
    Definition Classes
    RegressionModelSubmodelBase
  8. val beta: PolynomialEvaluationAlgo

    Permalink

    representation of the regression model parameters.

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def close(): Unit

    Permalink
    Definition Classes
    SubmodelBase → Closeable → AutoCloseable
  11. def compose[A](g: (A) ⇒ A): (A) ⇒ B

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  12. final def constructFeatures(a: A): Features[IndexedSeq[Sparse]]

    Permalink

    Extract the features from the raw data by mapping featureFunctions over the input.

    Extract the features from the raw data by mapping featureFunctions over the input. If numMissingThreshold is not None and the number of resulting empty Iterables exceeds the numMissingThreshold value, then the resulting Features.missingOk value is false; otherwise, it will be true. If Features.missingOk is false, then go back and check all feature functions for missing values and add findings to the Features.missing map. This Features.missing is a mapping from the feature specification to the list of variable names whose associated values are missing from the input.

    a

    raw input data of the model input type.

    returns

    a Features instance with the following: 1 the transformed input vector 1 the map of bad features to the missing values in the raw data that were needed to compute the feature 1 whether the amount of missing data is acceptable to still continue

    Attributes
    protected[this]
    Definition Classes
    RegressionFeatures
  13. final def debug(msg: ⇒ Any, t: ⇒ Throwable): Unit

    Permalink

    Issue a debug logging message, with an exception.

    Issue a debug logging message, with an exception.

    msg

    the message object. toString() is called to convert it to a loggable string.

    t

    the exception to include with the logged message.

    Attributes
    protected[this]
    Definition Classes
    Logging
  14. final def debug(msg: ⇒ Any): Unit

    Permalink

    Issue a debug logging message.

    Issue a debug logging message.

    msg

    the message object. toString() is called to convert it to a loggable string.

    Attributes
    protected[this]
    Definition Classes
    Logging
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def error(msg: ⇒ Any, t: ⇒ Throwable): Unit

    Permalink

    Issue a error logging message, with an exception.

    Issue a error logging message, with an exception.

    msg

    the message object. toString() is called to convert it to a loggable string.

    t

    the exception to include with the logged message.

    Attributes
    protected[this]
    Definition Classes
    Logging
  17. final def error(msg: ⇒ Any): Unit

    Permalink

    Issue a error logging message.

    Issue a error logging message.

    msg

    the message object. toString() is called to convert it to a loggable string.

    Attributes
    protected[this]
    Definition Classes
    Logging
  18. def failure(errorMsgs: ⇒ Seq[String] = Nil, missingVarNames: ⇒ Set[String] = Set.empty, subvalues: Seq[U] = Nil): Subvalue[B, Double]

    Permalink
    Attributes
    protected[this]
    Definition Classes
    SubmodelBase
  19. val featureFunctions: IndexedSeq[GenAggFunc[A, Iterable[(String, Double)]]]

    Permalink

    feature extracting functions.

    feature extracting functions.

    Definition Classes
    RegressionModelRegressionFeatures
  20. val featureNames: IndexedSeq[String]

    Permalink

    feature names (parallel to featureFunctions)

    feature names (parallel to featureFunctions)

    Definition Classes
    RegressionModelRegressionFeatures
  21. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def info(msg: ⇒ Any, t: ⇒ Throwable): Unit

    Permalink

    Issue a info logging message, with an exception.

    Issue a info logging message, with an exception.

    msg

    the message object. toString() is called to convert it to a loggable string.

    t

    the exception to include with the logged message.

    Attributes
    protected[this]
    Definition Classes
    Logging
  24. final def info(msg: ⇒ Any): Unit

    Permalink

    Issue a info logging message.

    Issue a info logging message.

    msg

    the message object. toString() is called to convert it to a loggable string.

    Attributes
    protected[this]
    Definition Classes
    Logging
  25. val invLinkFunction: (Double) ⇒ Double

    Permalink

    a function applied to the inner product of the input vector and weight vector.

  26. final def isDebugEnabled: Boolean

    Permalink

    Determine whether debug logging is enabled.

    Determine whether debug logging is enabled.

    Attributes
    protected[this]
    Definition Classes
    Logging
  27. final def isErrorEnabled: Boolean

    Permalink

    Determine whether error logging is enabled.

    Determine whether error logging is enabled.

    Attributes
    protected[this]
    Definition Classes
    Logging
  28. final def isInfoEnabled: Boolean

    Permalink

    Determine whether info logging is enabled.

    Determine whether info logging is enabled.

    Attributes
    protected[this]
    Definition Classes
    Logging
  29. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  30. final def isTraceEnabled: Boolean

    Permalink

    Determine whether trace logging is enabled.

    Determine whether trace logging is enabled.

    Attributes
    protected[this]
    Definition Classes
    Logging
  31. final def isWarnEnabled: Boolean

    Permalink

    Determine whether warn logging is enabled.

    Determine whether warn logging is enabled.

    Attributes
    protected[this]
    Definition Classes
    Logging
  32. final lazy val logger: Logger

    Permalink

    The logger is a @transient lazy val to enable proper working with Spark.

    The logger is a @transient lazy val to enable proper working with Spark. The logger will not be serialized with the rest of the class with which this trait is mixed-in.

    Attributes
    protected[this]
    Definition Classes
    Logging
  33. def loggerInitName(): String

    Permalink

    The name with which the logger is initialized.

    The name with which the logger is initialized. This can be overridden in a derived class.

    Attributes
    protected
    Definition Classes
    Logging
  34. final def loggerName: String

    Permalink

    Get the name associated with this logger.

    Get the name associated with this logger.

    returns

    the name.

    Attributes
    protected[this]
    Definition Classes
    Logging
  35. val modelId: ModelIdentity

    Permalink

    An identifier for the model.

    An identifier for the model. User in score and error reporting.

    Definition Classes
    RegressionModelIdentifiable
  36. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  37. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  39. val numMissingThreshold: Option[Int]

    Permalink

    if provided, we check whether the threshold is exceeded.

    if provided, we check whether the threshold is exceeded. If so, return an error instead of the computed score. This is for missing data situations.

    Definition Classes
    RegressionModelRegressionFeatures
  40. val spline: Option[Spline]

    Permalink

    an optional calibration spline to Obtaining calibrated probability estimates from decision trees and naive Bayesian classifiers, Zadrozny, Elkan (ICML, 2001).

    an optional calibration spline to Obtaining calibrated probability estimates from decision trees and naive Bayesian classifiers, Zadrozny, Elkan (ICML, 2001). This is applied prior to invLinkFunction

  41. def subvalue(a: A): Subvalue[B, Double]

    Permalink

    Get the score.

    Get the score.

    a

    the model input value.

    Definition Classes
    RegressionModelSubmodel
  42. def success(naturalValue: Double, errorMsgs: ⇒ Seq[String] = Nil, missingVarNames: ⇒ Set[String] = Set.empty, subvalues: Seq[U] = Nil, prob: ⇒ Option[Float] = None): Subvalue[B, Double]

    Permalink
    Attributes
    protected[this]
    Definition Classes
    SubmodelBase
  43. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  44. def toString(): String

    Permalink
    Definition Classes
    Function1 → AnyRef → Any
  45. final def trace(msg: ⇒ Any, t: ⇒ Throwable): Unit

    Permalink

    Issue a trace logging message, with an exception.

    Issue a trace logging message, with an exception.

    msg

    the message object. toString() is called to convert it to a loggable string.

    t

    the exception to include with the logged message.

    Attributes
    protected[this]
    Definition Classes
    Logging
  46. final def trace(msg: ⇒ Any): Unit

    Permalink

    Issue a trace logging message.

    Issue a trace logging message.

    msg

    the message object. toString() is called to convert it to a loggable string.

    Attributes
    protected[this]
    Definition Classes
    Logging
  47. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def warn(msg: ⇒ Any, t: ⇒ Throwable): Unit

    Permalink

    Issue a warn logging message, with an exception.

    Issue a warn logging message, with an exception.

    msg

    the message object. toString() is called to convert it to a loggable string.

    t

    the exception to include with the logged message.

    Attributes
    protected[this]
    Definition Classes
    Logging
  51. final def warn(msg: ⇒ Any): Unit

    Permalink

    Issue a warn logging message.

    Issue a warn logging message.

    msg

    the message object. toString() is called to convert it to a loggable string.

    Attributes
    protected[this]
    Definition Classes
    Logging

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Logging

Inherited from RegressionFeatures[A]

Inherited from SubmodelBase[U, Double, A, B]

Inherited from Model[A, B]

Inherited from (A) ⇒ B

Inherited from Submodel[Double, A, B]

Inherited from Closeable

Inherited from AutoCloseable

Inherited from Identifiable[ModelIdentity]

Inherited from AnyRef

Inherited from Any

Ungrouped