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
ConstructorsConstructorDescriptionRpclProbabilityDistribution(RpclSemantics semantics, FolSignature signature) Creates a new probability distribution for the given signature. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(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.doubleentropy()Returns the entropy of this probability distribution.Set<Map.Entry<T, Probability>> 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.booleanisEmpty()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) voidputAll(Map<? extends T, ? extends Probability> m) booleanChecks whether this interpretation satisfies the given formula.booleanChecks whether this interpretation satisfies the given knowledge base.intsize()toString()values()Methods inherited from class org.tweetyproject.commons.AbstractInterpretation
satisfiesMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:InterpretationChecks whether this interpretation satisfies the given formula.- Specified by:
satisfiesin 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:InterpretationChecks whether this interpretation satisfies the given knowledge base.- Specified by:
satisfiesin 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:
clearin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
containsKey
- Specified by:
containsKeyin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
containsValue
- Specified by:
containsValuein interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
entrySet
- Specified by:
entrySetin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
get
- Specified by:
getin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
put
- Specified by:
putin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
putAll
- Specified by:
putAllin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
remove
- Specified by:
removein interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
size
public int size()- Specified by:
sizein interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
values
- Specified by:
valuesin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
keySet
- Specified by:
keySetin interfaceMap<T extends Interpretation<FolBeliefSet, FolFormula>, Probability>
-
getSignature
Returns the signature of the underlying language.- Returns:
- the signature of the underlying language.
-