case class Distribution[A](domain: Vector[A], notNormDistribution: Vector[BigDecimal]) extends Product with Serializable
A probability distribution over a domain of objects. If the initial distribution does not add up to 1.0, then it will be normalized.
- A
The type of the domain this distribution is defined over.
- domain
A vector of objects that makes up the domain of this distribution.
- notNormDistribution
A (possibly not normalized) distribution.
- Alphabetic
- By Inheritance
- Distribution
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Distribution(domain: Vector[A], notNormDistribution: Vector[BigDecimal])
- domain
A vector of objects that makes up the domain of this distribution.
- notNormDistribution
A (possibly not normalized) distribution.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from Distribution[A] to any2stringadd[Distribution[A]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (Distribution[A], B)
- Implicit
- This member is added by an implicit conversion from Distribution[A] to ArrowAssoc[Distribution[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addNotNorm(that: Distribution[A]): Distribution[A]
Adds two not normalized distributions and returns the resulting distribution.
Adds two not normalized distributions and returns the resulting distribution.
- that
The distribution to add to this one.
-
def
apply(elem: A): Option[BigDecimal]
Request the probability of elem.
Request the probability of elem.
- elem
The element in the domain for which the probability is requested.
- returns
Probability of elem.
-
def
argMax: Option[A]
Returns an index to the vector, pointing to the highest value in the vector.
Returns an index to the vector, pointing to the highest value in the vector. If multiple maxima exist, it returns an index to one of those at random. If the vector distribution is empty, it returns None.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
val
distribution: Vector[BigDecimal]
The (normalized) probability distribution.
- val domain: Vector[A]
-
def
ensuring(cond: (Distribution[A]) ⇒ Boolean, msg: ⇒ Any): Distribution[A]
- Implicit
- This member is added by an implicit conversion from Distribution[A] to Ensuring[Distribution[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (Distribution[A]) ⇒ Boolean): Distribution[A]
- Implicit
- This member is added by an implicit conversion from Distribution[A] to Ensuring[Distribution[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): Distribution[A]
- Implicit
- This member is added by an implicit conversion from Distribution[A] to Ensuring[Distribution[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): Distribution[A]
- Implicit
- This member is added by an implicit conversion from Distribution[A] to Ensuring[Distribution[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
entropy: BigDecimal
Returns the Shannon information entropy of a distribution.
Returns the Shannon information entropy of a distribution.
For distributions that deviate from probability assumptions (i.e., the sum of the values equals 1.0), Shannon information entropy is ill-defined.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Distribution[A] to StringFormat[Distribution[A]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
length: Int
Returns the number of elements in the distribution.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
val
notNormDistribution: Vector[BigDecimal]
- Attributes
- protected
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
prodNotNorm(value: BigDecimal): Distribution[A]
Returns the distribution multiplied by a value.
Returns the distribution multiplied by a value. Note that the normalized distribution will not change.
- value
A number with which the distribution should be multiplied.
-
def
sample(n: Int): List[A]
Draws
Draws
n
samples from the distribution.
n }}}
- n
The number of samples to draw.
- returns
A list of
n
-
def
sample: A
Draws a sample from the distribution, proportionate to the probabilities.
-
def
softArgMax(beta: BigDecimal): Option[A]
Returns an index to the distribution according to soft argMax with parameter beta.
Returns an index to the distribution according to soft argMax with parameter beta. If beta -> Inf, this function is equivalent to argMax. If the vector values is empty, it returns None.
- beta
The beta parameter, >=0. Soft argmax is ill-defined for negative beta values.
- returns
An index pointing to the value in the distribution
- See also
See this Wikipedia page for a mathmatical definition of soft argmax https://en.wikipedia.org/wiki/Softmax_function.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- Distribution → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
→[B](y: B): (Distribution[A], B)
- Implicit
- This member is added by an implicit conversion from Distribution[A] to ArrowAssoc[Distribution[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
Language Agents Simulation framework
For detailed documentation on using the framework please see the README.md file at the Github repository at https://github.com/markblokpoel/lanag-core.