Class

mimir.models

Model

Related Doc: package models

Permalink

abstract class Model extends Serializable

Root class for Model objects.

Models are one of the primitive building blocks in Mimir. While VGTerms (defined in the mimir.ctables package) serve to create placeholders in relational data, Models serve to dictate how these placeholders are filled in.

Each discrete placeholder value in a relation is associated with a single variable. Variables are identified by an index (idx), and by zero or more argument expressions.

- Indexes allow a single model object to define multiple categories of variables. Indexes are not data-dependent: For any given query there may only ever be a finite number of index values. However, variables with different indexes may follow different typing rules.

- Argument expressions allow variables to be dynamically created based on the data, for example one variable per row. However, variables distinguished only by argument expressions must follow the same typing rules.

In short, the main distinction between indexes and arguments is how the variables interacts with Mimir's typesystem. Arguments can create an arbitrary number of variable instances per query, but must all follow the same typescheme. Meanwhile Indexes can create variables with different types, but there can only be a finite number of indexes in use per query.

Models are left intentionally abstract. For the moment, at least, we do not try to dictate whether the model should be defined using probability theory, fuzzy logic, belief theory, or any other type of principled mechanism. Rather, the interface simply requires the model to be able to generate a most likely bestGuess value, and be able to draw sample values of possible outputs.

That said, there are specific specific classes of model that are intended to fulfil specific roles (see ModelRegistry for more details). Models that follow these patterns are expected to conform to specific conventions in terms of their types, how they use arguments, and how they are constructed.

Annotations
@SerialVersionUID()
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Model
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Model(name: String)

    Permalink

Abstract Value Members

  1. abstract def argTypes(idx: Int): Seq[Type]

    Permalink

    The list of expected arg types (may be TAny)

  2. abstract def bestGuess(idx: Int, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue]): PrimitiveValue

    Permalink

    Generate a best guess for a variable represented by this model.

    Generate a best guess for a variable represented by this model.

    idx

    The index of the variable family to generate a best guess for

    args

    The skolem identifier for the specific variable to generate a best guess for

    returns

    A primitive value representing the best guess value.

  3. abstract def confidence(idx: Int, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue]): Double

    Permalink

    Return confidence on a scale of 0 to 1

    Return confidence on a scale of 0 to 1

    idx

    The index of the variable family to record feedback for

    args

    The skolem identifier for the specific variable to record feedback for

    returns

    The confidence value

  4. abstract def feedback(idx: Int, args: Seq[PrimitiveValue], v: PrimitiveValue): Unit

    Permalink

    Record feedback given as the "correct" value for a variable represented by this model

    Record feedback given as the "correct" value for a variable represented by this model

    idx

    The index of the variable family to record feedback for

    args

    The skolem identifier for the specific variable to record feedback for

    v

    The correct value for the parameter

  5. abstract def hintTypes(idx: Int): Seq[Type]

    Permalink

    The list of expected hint types (may be TAny)

  6. abstract def isAcknowledged(idx: Int, args: Seq[PrimitiveValue]): Boolean

    Permalink

    Determine whether a variable represented by this model has been acknowledged or not

    Determine whether a variable represented by this model has been acknowledged or not

    idx

    The index of the variable family to check acknowledgement of

    args

    The skolem identifier for the specific variable to check acknowledgement of

    returns

    True if the variable has been acknowledged

  7. abstract def reason(idx: Int, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue]): String

    Permalink

    Generate a human-readable explanation for the uncertainty captured by this model.

    Generate a human-readable explanation for the uncertainty captured by this model.

    idx

    The index of the variable family to explain

    args

    The skolem identifier for the specific variable to explain

    returns

    A string reason explaining the uncertainty in this model

  8. abstract def sample(idx: Int, randomness: Random, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue]): PrimitiveValue

    Permalink

    Generate a sample from the distribution of a variable represented by this model.

    Generate a sample from the distribution of a variable represented by this model.

    idx

    The index of the variable family to generate a sample for

    randomness

    A java.util.Random to use when generating the sample (pre-seeded)

    args

    The skolem identifier for the specific variable to generate a sample for

    returns

    A primitive value representing the generated sample

  9. abstract def varType(idx: Int, argTypes: Seq[Type]): Type

    Permalink

    Infer the type of the model from the types of the inputs

    Infer the type of the model from the types of the inputs

    argTypes

    The types of the arguments the the VGTerm

    returns

    The type of the value returned by this model

Concrete 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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

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

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. val name: String

    Permalink
  13. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  16. def sample(idx: Int, seed: Long, args: Seq[PrimitiveValue], hints: Seq[PrimitiveValue]): PrimitiveValue

    Permalink

    Generate a sample from the distribution of a variable represented by this model.

    Generate a sample from the distribution of a variable represented by this model.

    idx

    The index of the variable family to generate a sample for

    seed

    The global world identifier (seed) to sample from

    args

    The skolem identifier for the specific variable to generate a sample for

    returns

    A primitive value representing the generated sample

  17. def serialize(): (Array[Byte], String)

    Permalink

    Encode the model for persistence to disk/the database

    Encode the model for persistence to disk/the database

    returns

    A 2-tuple including the serialized encoding, and the name of a deserializer to use when decoding the encoding.

  18. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink

    A string representation of this model

    A string representation of this model

    Definition Classes
    Model → AnyRef → Any
  20. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped