Package

com.eharmony.aloha

models

Permalink

package models

Visibility
  1. Public
  2. All

Type Members

  1. case class CategoricalDistibutionModel[U, N, -A, +B <: U](modelId: ModelIdentity, features: Seq[GenAggFunc[A, Any]], distribution: HashedCategoricalDistribution, labels: IndexedSeq[N], auditor: Auditor[U, N, B], missingOk: Boolean = false) extends SubmodelBase[U, N, A, B] with Product with Serializable

    Permalink

    A model representing a categorical distribution.

    A model representing a categorical distribution. This will return values with the probabilities prescribed by the distribution parameter. For information on categorical distributions, check out Wikipedia's page.

    A

    model input type

    B

    model output type

    modelId

    An id with which to identify this model

    features

    features whose values are fed to the distribution. These features are functions of the input.

    distribution

    A distribution parametrized by a sequence of probabilities, that takes a sequence of values and produces a hash that is used as the randomness with which to choose one of the labels.

    labels

    the values that can returned by this model (with the probabilities described by the distribution)

    missingOk

    Whether to allow missing data defaults to false). When this is set to false and missing data ( scala.None) is produced by one of the features, the model will result in an error.

  2. case class ConstantModel[U, N, +B <: U](constant: Option[N], modelId: ModelIdentity, auditor: Auditor[U, N, B]) extends SubmodelBase[U, N, Any, B] with Product with Serializable

    Permalink
  3. case class ErrorModel[U, +B <: U](modelId: ModelIdentity, errors: Seq[String], auditor: Auditor[U, Nothing, B]) extends SubmodelBase[U, Nothing, Any, B] with Product with Serializable

    Permalink
  4. case class ErrorSwallowingModel[U, N, -A, +B <: U](submodel: Submodel[N, A, U], auditor: Auditor[U, N, B], recordErrorStackTraces: Boolean = true) extends SubmodelBase[U, N, A, B] with Product with Serializable

    Permalink

    A model that swallows exceptions thrown by submodel.

    A model that swallows exceptions thrown by submodel.

    When exceptions are thrown by submodel, then a score containing a ScoreError should be produces where the error list should be either:

    • com.eharmony.aloha.models.ErrorSwallowingModel.errorMsg(ex)
    • [Exception error message ...]
    • [Stack trace here ...]

    when recordErrorStackTraces and the stack trace and message could be retrieved; otherwise, the error list should be:

    • com.eharmony.aloha.models.ErrorSwallowingModel.errorMsg(ex)
    • com.eharmony.aloha.models.ErrorSwallowingModel.ExMsgThrewMsg
    • com.eharmony.aloha.models.ErrorSwallowingModel.StackTraceOmitted

    If the exception that is caught is a com.eharmony.aloha.semantics.SemanticsUdfException, then 3 additional fields are added to the end of the errors list in indices 3, 4, 5:

    • The specification of the feature in error.
    • The feature accessors in the feature that are in err.
    • The feature accessors in the feature that are missing an output value.
    A

    model input type

    B

    model output type

    submodel

    the submodel to which the score calculations are delegated.

    recordErrorStackTraces

    whether stack traces should be recorded.

  5. trait Model[-A, +B] extends (A) ⇒ B with Identifiable[ModelIdentity] with Closeable

    Permalink

    Created by ryan on 1/11/17.

  6. case class SegmentationModel[U, SN, N, A, B <: U](modelId: ModelIdentity, submodel: Submodel[SN, A, U], thresholds: IndexedSeq[SN], labels: IndexedSeq[N], auditor: Auditor[U, N, B])(implicit thresholdOrdering: Ordering[SN]) extends SubmodelBase[U, N, A, B] with Product with Serializable

    Permalink

    A model that runs the subModel and returns the label associated with the segment in which the inner model's score falls.

    A model that runs the subModel and returns the label associated with the segment in which the inner model's score falls. This is done via a linear scan of the thresholds.

    U

    upper type bound for output of model and all submodels.

    SN

    submodel's natural type

    N

    segmentation model's natural type

    A

    the model input type

    B

    the model's ultimate output type

    modelId

    a model identifier

    submodel

    a sub model

    thresholds

    a sequence of ordered thresholds against which

    labels

    a set of labesl to use

    thresholdOrdering

    an implicit ordering

  7. trait Submodel[+N, -A, +B] extends Identifiable[ModelIdentity] with Closeable

    Permalink

    Created by ryan on 1/18/17.

  8. trait SubmodelBase[U, N, -A, +B <: U] extends Submodel[N, A, B] with Model[A, B]

    Permalink

    Created by ryan on 1/18/17.

  9. case class Subvalue[+B, +N](audited: B, natural: Option[N]) extends Product with Serializable

    Permalink

    Created by ryan on 1/18/17.

  10. case class TopLevelModel[-A, +B](model: Model[A, B], fields: Seq[String]) extends Model[A, B] with Product with Serializable

    Permalink
  11. trait TypeCoercion extends AnyRef

    Permalink

    Provides over 200 coercions between types.

    Provides over 200 coercions between types. This works for the following matrix of types:

                                            TO
    
                Bo  C   By  Sh  I   L   F   D   JBy JSh JI  JL  JF  JD  JC  JBo St
              +--------------------------------------------------------------------
          Bo  | I                                                           bB  tS
          C   |     I   A   A   A   A   A   A   A   A   A   A   A   A   A       tS
          By  |     A   I   A   A   A   A   A   A   A   A   A   A   A   A       tS
          Sh  |     A   A   I   A   A   A   A   A   A   A   A   A   A   A       tS
          I   |     A   A   A   I   A   A   A   A   A   A   A   A   A   A       tS
          L   |     A   A   A   A   I   A   A   A   A   A   A   A   A   A       tS
     F    F   |     A   A   A   A   A   I   A   A   A   A   A   A   A   A       tS
     R    D   |     A   A   A   A   A   A   I   A   A   A   A   A   A   A       tS
     O    JBy |     N   N   N   N   N   N   N   I   N   N   N   N   N   N       tS
     M    JSh |     N   N   N   N   N   N   N   N   I   N   N   N   N   N       tS
          JI  |     N   N   N   N   N   N   N   N   N   I   N   N   N   N       tS
          JL  |     N   N   N   N   N   N   N   N   N   N   I   N   N   N       tS
          JF  |     N   N   N   N   N   N   N   N   N   N   N   I   N   N       tS
          JD  |     N   N   N   N   N   N   N   N   N   N   N   N   I   N       tS
          JC  |     uC                                                  I       tS
          JBo | uB                                                          I   tS
          St  |                                                                 I
    

    Where the label abbreviations are:

    • Bo: scala.Boolean
    • C: scala.Char
    • By: scala.Byte
    • Sh: scala.Short
    • I: scala.Int
    • L: scala.Long
    • F: scala.Float
    • D: scala.Double
    • JBy: java.lang.Byte
    • JSh: java.lang.Short
    • JI: java.lang.Integer
    • JL: java.lang.Long
    • JF: java.lang.Float
    • JD: java.lang.Character
    • JC: java.lang.Double
    • JBo: java.lang.Boolean
    • St: java.lang.String

    and value abbreviations are:

    • A: coercion from scala.AnyVal
    • N: coercion from java.lang.Number
    • I: identity function
    • bB: boxing Boolean coercion
    • uB: unboxing Boolean coercion
    • uC: unboxing character coercion
    • tS: toString coercion

    The rationale behind not supplying coercion from Strings is that too many exceptions can be thrown during the coercion process. Coercions from String to character have issues with the empty string. One could call one of the following but they all throw exceptions:

    "".charAt(0) // java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    "".apply(0)  // java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    "".head      // java.util.NoSuchElementException: next on empty iterator

    Conversion to Boolean from Numbers and vice versa is not supported because there are a number of ways to do this:

    • Non-zero numbers are true, 0 is false.
    • One is true, all else is false

Value Members

  1. object CategoricalDistibutionModel extends ParserProviderCompanion with Serializable

    Permalink
  2. object ConstantModel extends ParserProviderCompanion with Serializable

    Permalink
  3. object ErrorModel extends ParserProviderCompanion with Serializable

    Permalink
  4. object ErrorSwallowingModel extends ParserProviderCompanion with Serializable

    Permalink
  5. object SegmentationModel extends ParserProviderCompanion with Serializable

    Permalink
  6. object TransformedModelOps

    Permalink
  7. object TypeCoercion extends TypeCoercion with Logging

    Permalink
  8. package conversion

    Permalink
  9. package exploration

    Permalink
  10. package multilabel

    Permalink

    Created by ryan.deak on 8/31/17.

  11. package reg

    Permalink
  12. package tree

    Permalink

Ungrouped