com.eharmony.aloha.models.reg

RegressionModel

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
Learn more about member selection
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])

    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]] = ..., missingOk: Boolean = true) extends Product with Serializable

    Container for information returned by RegressionFeatures.constructFeatures.

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

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

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

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

    Definition Classes
    Any
  6. def andThen[A](g: (B) ⇒ A): (A) ⇒ A

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

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

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

    Definition Classes
    RegressionModelSubmodelBase
  10. val beta: PolynomialEvaluationAlgo

    representation of the regression model parameters.

  11. def clone(): AnyRef

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

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

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  14. final def constructFeatures(a: A): Features[IndexedSeq[Iterable[(String, Double)]]]

    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
  15. def debug(msg: ⇒ Any, t: ⇒ Throwable): Unit

    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
    Definition Classes
    Logging
  16. def debug(msg: ⇒ Any): Unit

    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
    Definition Classes
    Logging
  17. final def eq(arg0: AnyRef): Boolean

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

    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
    Definition Classes
    Logging
  19. def error(msg: ⇒ Any): Unit

    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
    Definition Classes
    Logging
  20. def failure(errorMsgs: ⇒ Seq[String] = Nil, missingVarNames: ⇒ Set[String] = Set.empty, subvalues: Seq[U] = Nil): Subvalue[B, Double]

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

    feature extracting functions.

    feature extracting functions.

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

    feature names (parallel to featureFunctions)

    feature names (parallel to featureFunctions)

    Definition Classes
    RegressionModelRegressionFeatures
  23. def finalize(): Unit

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

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

    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
    Definition Classes
    Logging
  26. def info(msg: ⇒ Any): Unit

    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
    Definition Classes
    Logging
  27. val invLinkFunction: (Double) ⇒ Double

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

  28. def isDebugEnabled: Boolean

    Determine whether debug logging is enabled.

    Determine whether debug logging is enabled.

    Attributes
    protected
    Definition Classes
    Logging
  29. def isErrorEnabled: Boolean

    Determine whether trace logging is enabled.

    Determine whether trace logging is enabled.

    Attributes
    protected
    Definition Classes
    Logging
  30. def isInfoEnabled: Boolean

    Determine whether trace logging is enabled.

    Determine whether trace logging is enabled.

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

    Definition Classes
    Any
  32. def isTraceEnabled: Boolean

    Determine whether trace logging is enabled.

    Determine whether trace logging is enabled.

    Attributes
    protected
    Definition Classes
    Logging
  33. def isWarnEnabled: Boolean

    Determine whether trace logging is enabled.

    Determine whether trace logging is enabled.

    Attributes
    protected
    Definition Classes
    Logging
  34. def logger: Logger

    Get the Logger for the class that mixes this trait in.

    Get the Logger for the class that mixes this trait in. The Logger is created the first time this method is call. The other methods (e.g., error, info, etc.) call this method to get the logger.

    returns

    the Logger

    Attributes
    protected
    Definition Classes
    Logging
  35. def loggerName: String

    Get the name associated with this logger.

    Get the name associated with this logger.

    returns

    the name.

    Attributes
    protected
    Definition Classes
    Logging
  36. val modelId: ModelIdentity

    An identifier for the model.

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

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

    Definition Classes
    AnyRef
  38. final def notify(): Unit

    Definition Classes
    AnyRef
  39. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  40. val numMissingThreshold: Option[Int]

    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
  41. val spline: Option[Spline]

    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

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

    Get the score.

    Get the score.

    a

    the model input value.

    returns

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

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

    Definition Classes
    AnyRef
  45. def toString(): String

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

    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
    Definition Classes
    Logging
  47. def trace(msg: ⇒ Any): Unit

    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
    Definition Classes
    Logging
  48. final def wait(): Unit

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

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

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

    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
    Definition Classes
    Logging
  52. def warn(msg: ⇒ Any): Unit

    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
    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