示例#1
0
    def cdf(self, x):
        """
        Computes the cumulative distribution function of the
        distribution at the point(s) x. The cdf is defined as follows (where
        alpha->a beta ->b, Fbetainc is incomplete beta function and Fbeta is the
        complete beta function):
            F(x|a, b) = Fbetainc(a, b, x) / Fbeta(a, b)

        Parameters
        ----------
        x: array, dtype=float, shape=(m x n)
            The value(s) at which the user would like the cdf evaluated.
            If an array is passed in, the cdf is evaluated at every point
            in the array and an array of the same size is returned.

        Returns
        -------
        cdf: array, dtype=float, shape=(m x n)
            The cdf at each point in x.
        """
        alpha = self.alpha
        beta = self.beta
        cdf = btdtr(alpha, beta, x)

        return cdf
示例#2
0
	def _consensus_finder(self):
		"""
		key:
			0 - no consensus
			1 - unAmbigous Zone
			2 - medium ambiguity Zone
			3 - high ambiguity zone
			4 - most ambiguity
		"""
		myPred = self.predicate
		votes_cast = self.num_yes + self.num_no
		larger = max(self.num_yes, self.num_no)
		smaller = min(self.num_yes, self.num_no)

		uncertLevel = 2
		if toggles.BAYES_ENABLED:
			if self.value > 0:
				uncertLevel = btdtr(self.num_yes+1, self.num_no+1, myPred.consensus_decision_threshold)
			else:
				uncertLevel = btdtr(self.num_no+1, self.num_yes+1, myPred.consensus_decision_threshold)


		if votes_cast >= myPred.consensus_max:
			return 4

		elif uncertLevel < myPred.consensus_uncertainty_threshold:
			return 1

		elif larger >= myPred.consensus_max_single:
			if smaller < myPred.consensus_max_single*(1.0/3.0): #TODO un-hard-code this part
				return 1
			elif smaller < myPred.consensus_max_single*(2.0/3.0):
				return 2
			else:
				return 3

		else:
			return 0
示例#3
0
 def _cdf(self, x, a, b):
     return special.btdtr(a, b, x)
示例#4
0
 def _cdf(self, x):
     a, b = np.loadtxt(os.path.join(FILE_DIR, 'distr_par.txt'), delimiter = ',')
     return special.btdtr(a, b, x)