Class RpclProbabilityDistribution<T extends Interpretation<FolBeliefSet,FolFormula>>
java.lang.Object
org.tweetyproject.commons.AbstractInterpretation<RpclBeliefSet,RelationalProbabilisticConditional>
org.tweetyproject.logics.rpcl.semantics.RpclProbabilityDistribution<T>
- Type Parameters:
T
- the type of interpretations
- All Implemented Interfaces:
Map<T,
,Probability> Interpretation<RpclBeliefSet,
RelationalProbabilisticConditional>
- Direct Known Subclasses:
CondensedProbabilityDistribution
public class RpclProbabilityDistribution<T extends Interpretation<FolBeliefSet,FolFormula>>
extends AbstractInterpretation<RpclBeliefSet,RelationalProbabilisticConditional>
implements Map<T,Probability>
Objects of this class represent probability distributions on the interpretations
of an underlying first-order signature for a relational probabilistic conditional knowledge base.
- Author:
- Matthias Thimm
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionRpclProbabilityDistribution
(RpclSemantics semantics, FolSignature signature) Creates a new probability distribution for the given signature. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) convexCombination
(double d, RpclProbabilityDistribution<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.entrySet()
Returns the semantics of this distribution.Returns the signature of the underlying language.getUniformDistribution
(RpclSemantics semantics, FolSignature signature) Returns the uniform distribution on the given signature.boolean
isEmpty()
keySet()
Gets the probability of the given closed formula, i.e.Gets the probability of the given closed relational conditional "re", i.e.put
(T key, Probability value) void
putAll
(Map<? extends T, ? extends Probability> m) boolean
Checks whether this interpretation satisfies the given formula.boolean
Checks whether this interpretation satisfies the given knowledge base.int
size()
toString()
values()
Methods inherited from class org.tweetyproject.commons.AbstractInterpretation
satisfies
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
RpclProbabilityDistribution
Creates a new probability distribution for the given signature.- Parameters:
semantics
- the used RPCL semanticssignature
- a fol signature.
-
-
Method Details
-
getSemantics
Returns the semantics of this distribution.- Returns:
- the semantics of this distribution.
-
satisfies
public boolean satisfies(RelationalProbabilisticConditional formula) throws IllegalArgumentException Description copied from interface:Interpretation
Checks whether this interpretation satisfies the given formula.- Specified by:
satisfies
in interfaceInterpretation<RpclBeliefSet,
RelationalProbabilisticConditional> - Parameters:
formula
- a formula .- Returns:
- "true" if this interpretation satisfies the given formula.
- Throws:
IllegalArgumentException
- if the formula does not correspond to the expected language.
-
satisfies
Description copied from interface:Interpretation
Checks whether this interpretation satisfies the given knowledge base.- Specified by:
satisfies
in interfaceInterpretation<RpclBeliefSet,
RelationalProbabilisticConditional> - Parameters:
kb
- a knowledge base.- Returns:
- "true" if this interpretation satisfies the given knowledge base.
- Throws:
IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
-
probability
Gets the probability of the given closed formula, i.e. the sum of the probabilities of all interpretations satisfying it.- Parameters:
f
- a closed fol formula.- Returns:
- a probability.
-
probability
Gets the probability of the given closed relational conditional "re", i.e. the probability of the head of "re" given its body.- Parameters:
re
- a closed relational conditional.- Returns:
- a probability.
-
entropy
public double entropy()Returns the entropy of this probability distribution.- Returns:
- the entropy of this probability distribution.
-
convexCombination
public RpclProbabilityDistribution<T> convexCombination(double d, RpclProbabilityDistribution<T> other) Computes the convex combination of this P1 and the given probability distribution P2 with parameter d, i.e. it returns a P with P(i)=d P1(i) + (1-d) P2(i) for every interpretation i.- Parameters:
d
- a doubleother
- a probability distribution- Returns:
- the convex combination of this P1 and the given probability distribution P2 with parameter d.
- Throws:
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.
-
getUniformDistribution
public static RpclProbabilityDistribution<HerbrandInterpretation> getUniformDistribution(RpclSemantics semantics, FolSignature signature) Returns the uniform distribution on the given signature.- Parameters:
semantics
- the semantics for the distribution.signature
- a fol signature- Returns:
- the uniform distribution on the given signature.
-
toString
-
clear
public void clear()- Specified by:
clear
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
containsKey
- Specified by:
containsKey
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
containsValue
- Specified by:
containsValue
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
entrySet
- Specified by:
entrySet
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
get
- Specified by:
get
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
put
- Specified by:
put
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
putAll
- Specified by:
putAll
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
remove
- Specified by:
remove
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
size
public int size()- Specified by:
size
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
values
- Specified by:
values
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
keySet
- Specified by:
keySet
in interfaceMap<T extends Interpretation<FolBeliefSet,
FolFormula>, Probability>
-
getSignature
Returns the signature of the underlying language.- Returns:
- the signature of the underlying language.
-