Class ProbabilityDistribution<T extends Interpretation<PlBeliefSet,​PlFormula>>

    • Constructor Detail

      • ProbabilityDistribution

        public ProbabilityDistribution​(Signature signature)
        Creates a new probability distribution.
        Parameters:
        signature - the signature
    • Method Detail

      • getSignature

        public Signature getSignature()
        Returns the signature of the underlying language.
        Returns:
        the signature of the underlying language.
      • satisfies

        public boolean satisfies​(ProbabilisticConditional formula)
                          throws java.lang.IllegalArgumentException
        Description copied from interface: Interpretation
        Checks whether this interpretation satisfies the given formula.
        Specified by:
        satisfies in interface Interpretation<PclBeliefSet,​ProbabilisticConditional>
        Parameters:
        formula - a formula .
        Returns:
        "true" if this interpretation satisfies the given formula.
        Throws:
        java.lang.IllegalArgumentException - if the formula does not correspond to the expected language.
      • satisfies

        public boolean satisfies​(PclBeliefSet beliefBase)
                          throws java.lang.IllegalArgumentException
        Description copied from interface: Interpretation
        Checks whether this interpretation satisfies the given knowledge base.
        Specified by:
        satisfies in interface Interpretation<PclBeliefSet,​ProbabilisticConditional>
        Parameters:
        beliefBase - a knowledge base.
        Returns:
        "true" if this interpretation satisfies the given knowledge base.
        Throws:
        java.lang.IllegalArgumentException - IllegalArgumentException if the knowledgebase does not correspond to the expected language.
      • probability

        public Probability probability​(Interpretation<PlBeliefSet,​PlFormula> w)
                                throws java.lang.IllegalArgumentException
        Gets the probability of the given Herbrand interpretation (this is just an alias for get(Object o).
        Parameters:
        w - a Herbrand interpretation.
        Returns:
        the probability of the given Herbrand interpretation.
        Throws:
        java.lang.IllegalArgumentException - if the interpretation has no probability set
      • probability

        public Probability probability​(PlFormula f)
        Returns the probability of the given formula
        Parameters:
        f - a formula
        Returns:
        a probability.
      • conditionalProbability

        public Probability conditionalProbability​(Conditional c)
        Returns the probability of the given conditional
        Parameters:
        c - a conditional
        Returns:
        a probability.
      • normalize

        public static void normalize​(java.util.List<java.lang.Double> probabilities)
        Normalizes the given list of probabilities, i.e. divides each probability by the sum of all probabilities.
        Parameters:
        probabilities - initial list of probabilities
      • entropy

        public double entropy()
        Returns the entropy of this probability distribution.
        Returns:
        the entropy of this probability distribution.
      • convexCombination

        public 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. it returns a P with P(i)=d P1(i) + (1-d) P2(i) for every interpretation i.
        Parameters:
        d - a double
        other - a probability distribution
        Returns:
        the convex combination of this P1 and the given probability distribution P2 with parameter d.
        Throws:
        java.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.
      • linearCombination

        public 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. it returns a P with P(i)=d1 P1(i) + d2 P2(i) for every interpretation i. NOTE: P is normalized after combination.
        Parameters:
        d1 - a double.
        d2 - a double.
        other - a probability distribution.
        Returns:
        a probability distribution.
      • convexCombination

        public static <S extends Interpretation<PlBeliefSet,​PlFormula>> ProbabilityDistribution<S> convexCombination​(double[] factors,
                                                                                                                           ProbabilityDistribution<S>[] creators)
                                                                                                                    throws java.lang.IllegalArgumentException
        Computes the convex combination of the given probability distributions P1,...,PN with parameters factors, i.e. it returns a P with P(i)=d1 P1(i) + d2 P2(i)+ ... + dN PN(i) for every interpretation i (with d1,...,dN=factors).
        Type Parameters:
        S - The interpretation class
        Parameters:
        factors - a vector of doubles.
        creators - a vector of probability distributions.
        Returns:
        the convex combination of the given distributions with parameters factors.
        Throws:
        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.
      • getUniformDistribution

        public static <S extends Interpretation<PlBeliefSet,​PlFormula>> ProbabilityDistribution<S> getUniformDistribution​(java.util.Set<S> interpretations,
                                                                                                                                Signature sig)
        Returns the uniform distribution on the given interpretations.
        Type Parameters:
        S - The interpretation class
        Parameters:
        interpretations - some interpretations.
        sig - a signature
        Returns:
        the uniform distribution on the given interpretations.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object