T
- The actual interpretation class used for this distribution.public class ProbabilityDistribution<T extends Interpretation> extends AbstractInterpretation implements java.util.Map<T,Probability>
Modifier and Type | Field and Description |
---|---|
private java.util.Map<T,Probability> |
probabilities
The probabilities of the interpretations.
|
private Signature |
signature
The signature of the underlying language.
|
Constructor and Description |
---|
ProbabilityDistribution(Signature signature)
Creates a new probability distribution.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Probability |
conditionalProbability(Conditional c)
Returns the probability of the given conditional
|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
static <S extends Interpretation> |
convexCombination(double[] factors,
ProbabilityDistribution<S>[] creators)
Computes the convex combination of the
given probability distributions P1,...,PN with parameters factors, i.e.
|
ProbabilityDistribution<T> |
convexCombination(double d,
ProbabilityDistribution<T> other)
Computes the convex combination of this P1 and the
given probability distribution P2 with parameter d, i.e.
|
double |
entropy()
Returns the entropy of this probability distribution.
|
java.util.Set<java.util.Map.Entry<T,Probability>> |
entrySet() |
Probability |
get(java.lang.Object key) |
Signature |
getSignature()
Returns the signature of the underlying language.
|
static <S extends Interpretation> |
getUniformDistribution(java.util.Set<S> interpretations,
Signature sig)
Returns the uniform distribution on the given interpretations.
|
boolean |
isEmpty() |
java.util.Set<T> |
keySet() |
ProbabilityDistribution<T> |
linearCombination(double d1,
double d2,
ProbabilityDistribution<T> other)
Makes a linear combination of this distribution "p1" and the given distribution "other" and
the given parameters, i.e.
|
protected static void |
normalize(java.util.List<java.lang.Double> probabilities)
Normalizes the given list of probabilities, i.e.
|
Probability |
probability(Formula f)
Returns the probability of the given formula
|
Probability |
probability(Interpretation w)
Gets the probability of the given Herbrand interpretation (this is just an
alias for get(Object o).
|
Probability |
put(T key,
Probability value) |
void |
putAll(java.util.Map<? extends T,? extends Probability> m) |
Probability |
remove(java.lang.Object key) |
boolean |
satisfies(BeliefBase beliefBase)
Checks whether this interpretation satisfies the given knowledge base.
|
boolean |
satisfies(Formula formula)
Checks whether this interpretation satisfies the given formula.
|
int |
size() |
java.lang.String |
toString() |
java.util.Collection<Probability> |
values() |
satisfies
private java.util.Map<T extends Interpretation,Probability> probabilities
private Signature signature
public ProbabilityDistribution(Signature signature)
public Signature getSignature()
public boolean satisfies(Formula formula) throws java.lang.IllegalArgumentException
Interpretation
satisfies
in interface Interpretation
formula
- a formula .java.lang.IllegalArgumentException
- if the formula does not correspond
to the expected language.public boolean satisfies(BeliefBase beliefBase) throws java.lang.IllegalArgumentException
Interpretation
satisfies
in interface Interpretation
beliefBase
- a knowledge base.java.lang.IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond
to the expected language.public Probability probability(Interpretation w) throws java.lang.IllegalArgumentException
w
- a Herbrand interpretation.java.lang.IllegalArgumentException
public Probability probability(Formula f)
f
- a formulapublic Probability conditionalProbability(Conditional c)
c
- a conditionalprotected static void normalize(java.util.List<java.lang.Double> probabilities)
public double entropy()
public ProbabilityDistribution<T> convexCombination(double d, ProbabilityDistribution<T> other)
d
- a doubleother
- a probability distributionjava.lang.IllegalArgumentException
- if either d is not in [0,1] or this and
the given probability distribution are not defined on the same set of interpretations.public ProbabilityDistribution<T> linearCombination(double d1, double d2, ProbabilityDistribution<T> other)
d1
- a double.d2
- a double.other
- a probability distribution.public static <S extends Interpretation> ProbabilityDistribution<S> convexCombination(double[] factors, ProbabilityDistribution<S>[] creators) throws java.lang.IllegalArgumentException
S
- The interpretation classfactors
- a vector of doubles.creators
- a vector of probability distributions.java.lang.IllegalArgumentException
- if either the sum of factors d is not in 1, or this and
the given probability distributions are not defined on the same set of interpretations, or
the lengths of creators and factors differ.public static <S extends Interpretation> ProbabilityDistribution<S> getUniformDistribution(java.util.Set<S> interpretations, Signature sig)
S
- The interpretation classinterpretations
- some interpretations.sig
- a signaturepublic java.lang.String toString()
toString
in class java.lang.Object
public void clear()
clear
in interface java.util.Map<T extends Interpretation,Probability>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<T extends Interpretation,Probability>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<T extends Interpretation,Probability>
public java.util.Set<java.util.Map.Entry<T,Probability>> entrySet()
entrySet
in interface java.util.Map<T extends Interpretation,Probability>
public Probability get(java.lang.Object key)
get
in interface java.util.Map<T extends Interpretation,Probability>
public boolean isEmpty()
isEmpty
in interface java.util.Map<T extends Interpretation,Probability>
public Probability put(T key, Probability value)
put
in interface java.util.Map<T extends Interpretation,Probability>
public void putAll(java.util.Map<? extends T,? extends Probability> m)
putAll
in interface java.util.Map<T extends Interpretation,Probability>
public Probability remove(java.lang.Object key)
remove
in interface java.util.Map<T extends Interpretation,Probability>
public int size()
size
in interface java.util.Map<T extends Interpretation,Probability>
public java.util.Collection<Probability> values()
values
in interface java.util.Map<T extends Interpretation,Probability>
public java.util.Set<T> keySet()
keySet
in interface java.util.Map<T extends Interpretation,Probability>