Class RpclProbabilityDistribution<T extends net.sf.tweety.commons.Interpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula>>
- java.lang.Object
-
- net.sf.tweety.commons.AbstractInterpretation<RpclBeliefSet,RelationalProbabilisticConditional>
-
- net.sf.tweety.logics.rpcl.semantics.RpclProbabilityDistribution<T>
-
- Type Parameters:
T- the type of interpretations
- All Implemented Interfaces:
Map<T,net.sf.tweety.math.probability.Probability>,net.sf.tweety.commons.Interpretation<RpclBeliefSet,RelationalProbabilisticConditional>
- Direct Known Subclasses:
CondensedProbabilityDistribution
public class RpclProbabilityDistribution<T extends net.sf.tweety.commons.Interpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula>> extends net.sf.tweety.commons.AbstractInterpretation<RpclBeliefSet,RelationalProbabilisticConditional> implements Map<T,net.sf.tweety.math.probability.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
-
-
Constructor Summary
Constructors Constructor Description RpclProbabilityDistribution(RpclSemantics semantics, net.sf.tweety.logics.fol.syntax.FolSignature signature)Creates a new probability distribution for the given signature.
-
Method Summary
Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)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.doubleentropy()Returns the entropy of this probability distribution.Set<Map.Entry<T,net.sf.tweety.math.probability.Probability>>entrySet()net.sf.tweety.math.probability.Probabilityget(Object key)RpclSemanticsgetSemantics()Returns the semantics of this distribution.net.sf.tweety.commons.SignaturegetSignature()Returns the signature of the underlying language.static RpclProbabilityDistribution<net.sf.tweety.logics.fol.semantics.HerbrandInterpretation>getUniformDistribution(RpclSemantics semantics, net.sf.tweety.logics.fol.syntax.FolSignature signature)Returns the uniform distribution on the given signature.booleanisEmpty()Set<T>keySet()net.sf.tweety.math.probability.Probabilityprobability(net.sf.tweety.logics.fol.syntax.FolFormula f)Gets the probability of the given closed formula, i.e.net.sf.tweety.math.probability.Probabilityprobability(net.sf.tweety.logics.rcl.syntax.RelationalConditional re)Gets the probability of the given closed relational conditional "re", i.e.net.sf.tweety.math.probability.Probabilityput(T key, net.sf.tweety.math.probability.Probability value)voidputAll(Map<? extends T,? extends net.sf.tweety.math.probability.Probability> m)net.sf.tweety.math.probability.Probabilityremove(Object key)booleansatisfies(RelationalProbabilisticConditional formula)booleansatisfies(RpclBeliefSet kb)intsize()StringtoString()Collection<net.sf.tweety.math.probability.Probability>values()-
Methods inherited from class java.lang.Object
clone, equals, finalize, 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 Detail
-
RpclProbabilityDistribution
public RpclProbabilityDistribution(RpclSemantics semantics, net.sf.tweety.logics.fol.syntax.FolSignature signature)
Creates a new probability distribution for the given signature.- Parameters:
semantics- the used RPCL semanticssignature- a fol signature.
-
-
Method Detail
-
getSemantics
public RpclSemantics getSemantics()
Returns the semantics of this distribution.- Returns:
- the semantics of this distribution.
-
satisfies
public boolean satisfies(RelationalProbabilisticConditional formula) throws IllegalArgumentException
- Specified by:
satisfiesin interfacenet.sf.tweety.commons.Interpretation<RpclBeliefSet,RelationalProbabilisticConditional>- Throws:
IllegalArgumentException
-
satisfies
public boolean satisfies(RpclBeliefSet kb) throws IllegalArgumentException
- Specified by:
satisfiesin interfacenet.sf.tweety.commons.Interpretation<RpclBeliefSet,RelationalProbabilisticConditional>- Throws:
IllegalArgumentException
-
probability
public net.sf.tweety.math.probability.Probability probability(net.sf.tweety.logics.fol.syntax.FolFormula f)
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
public net.sf.tweety.math.probability.Probability probability(net.sf.tweety.logics.rcl.syntax.RelationalConditional re)
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<net.sf.tweety.logics.fol.semantics.HerbrandInterpretation> getUniformDistribution(RpclSemantics semantics, net.sf.tweety.logics.fol.syntax.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.
-
clear
public void clear()
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<T extends net.sf.tweety.commons.Interpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula>,net.sf.tweety.math.probability.Probability>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<T extends net.sf.tweety.commons.Interpretation<net.sf.tweety.logics.fol.syntax.FolBeliefSet,net.sf.tweety.logics.fol.syntax.FolFormula>,net.sf.tweety.math.probability.Probability>
-
get
public net.sf.tweety.math.probability.Probability get(Object key)
-
isEmpty
public boolean isEmpty()
-
put
public net.sf.tweety.math.probability.Probability put(T key, net.sf.tweety.math.probability.Probability value)
-
putAll
public void putAll(Map<? extends T,? extends net.sf.tweety.math.probability.Probability> m)
-
remove
public net.sf.tweety.math.probability.Probability remove(Object key)
-
size
public int size()
-
values
public Collection<net.sf.tweety.math.probability.Probability> values()
-
getSignature
public net.sf.tweety.commons.Signature getSignature()
Returns the signature of the underlying language.- Returns:
- the signature of the underlying language.
-
-