Computes the cumulative distribution function for the copula

        Args:
            X: `numpy.ndarray` or `pandas.DataFrame`

        Returns:
            np.array: cumulative probability
551194
def cumulative_distribution(self, X):
        
        self.check_fit()

        # Wrapper for pdf to accept vector as args
        def func(*args):
            return self.probability_density(list(args))

        # Lower bound for integral, to split significant part from tail
        lower_bound = self.get_lower_bound()

        ranges = [[lower_bound, val] for val in X]
        return integrate.nquad(func, ranges)[0]
473566
def cumulative_distribution(self, X):
        
        self.check_fit()

        U, V = self.split_matrix(X)

        num = np.multiply(
            np.exp(np.multiply(-self.theta, U)) - 1,
            np.exp(np.multiply(-self.theta, V)) - 1
        )
        den = np.exp(-self.theta) - 1

        return -1.0 / self.theta * np.log(1 + num / den)
76768
def XKX(self):
        
        cov_beta = np.zeros((self.dof,self.dof))
        start_row = 0
        #This is trivially parallelizable:
        for term1 in range(self.len):
            stop_row = start_row + self.A[term1].shape[0] * self.F[term1].shape[1]
            start_col = start_row
            #This is trivially parallelizable:
            for term2 in range(term1,self.len):
                stop_col = start_col + self.A[term2].shape[0] * self.F[term2].shape[1]
                cov_beta[start_row:stop_row, start_col:stop_col] = compute_X1KX2(Y=self.Ystar(), D=self.D, X1=self.Fstar[term1], X2=self.Fstar[term2], A1=self.Astar[term1], A2=self.Astar[term2])
                if term1!=term2:
                    cov_beta[start_col:stop_col, start_row:stop_row] = cov_beta[n_weights1:stop_row, n_weights2:stop_col].T
                start_col = stop_col
            start_row = stop_row
        return cov_beta
942888
def neg_log_likelihood(self, x):
        
        x_reshape = tf.reshape(x, [self.batch_size, self.eq_samples, self.iw_samples, self.num_latent])
        density = tf.nn.sigmoid_cross_entropy_with_logits(self.mu, x_reshape)
        # sum over all importance weights. average over all eq_samples
        return tf.reduce_mean(tf.reduce_sum(-density, axis=2), axis=(1, 2))
925265
def fdf(self, x):
        
        x = self._flatten(x)
        n = 1
        if hasattr(x, "__len__"):
            n = len(x)
        if self._dtype == 0:
            retval = _functional._fdf(self, x)
        else:
            retval = _functional._fdfc(self, x)
        if len(retval) == n:
            return numpy.array(retval)
        return numpy.array(retval).reshape(self.npar() + 1,
                                           n // self.ndim()).transpose()
211215
def generate_cumulative_dist(island_expectations_d, total_length):
    # type: (Dict[int, float], int) -> float
    

    cumulative = [0.0] * (total_length + 1)
    partial_sum = 0.0

    island_expectations = []
    for i in range(len(cumulative)):
        if i in island_expectations_d:
            island_expectations.append(island_expectations_d[i])
        else:
            island_expectations.append(0)

    for index in range(1, len(island_expectations) + 1):
        complimentary = len(island_expectations) - index
        partial_sum += island_expectations[complimentary]
        cumulative[complimentary] = partial_sum

    # move to function call
    for index in range(len(cumulative)):
        if cumulative[index] <= E_VALUE:
            score_threshold = index * BIN_SIZE
            break

    return score_threshold
294067
def cumulative_distribution(self, X):
        
        self.check_fit()

        U, V = self.split_matrix(X)

        if self.theta == 1:
            return np.multiply(U, V)

        else:
            h = np.power(-np.log(U), self.theta) + np.power(-np.log(V), self.theta)
            h = -np.power(h, 1.0 / self.theta)
            cdfs = np.exp(h)
            return cdfs
417687
def _compute_acq(self,x):
        
        means, stds = self.model.predict(x)
        fmins = self.model.get_fmin()
        f_acqu = 0
        for m,s,fmin in zip(means, stds, fmins):
            _, Phi, _ = get_quantiles(self.jitter, fmin, m, s)
            f_acqu += Phi
        return f_acqu/len(means)
580199
public static double cdf(double x, double mu, double sigma, double lambda) {
    if(x == Double.NEGATIVE_INFINITY) {
      return 0.;
    }
    if(x == Double.POSITIVE_INFINITY) {
      return 1.;
    }
    final double u = lambda * (x - mu);
    final double v = lambda * sigma;
    final double v2 = v * v;
    final double logphi = FastMath.log(NormalDistribution.cdf(u, v2, v));
    return NormalDistribution.cdf(u, 0., v) - FastMath.exp(-u + v2 * .5 + logphi);
  }
1313752
def select_copula(cls, X):
        
        frank = Bivariate(CopulaTypes.FRANK)
        frank.fit(X)

        if frank.tau <= 0:
            selected_theta = frank.theta
            selected_copula = CopulaTypes.FRANK
            return selected_copula, selected_theta

        copula_candidates = [frank]
        theta_candidates = [frank.theta]

        try:
            clayton = Bivariate(CopulaTypes.CLAYTON)
            clayton.fit(X)
            copula_candidates.append(clayton)
            theta_candidates.append(clayton.theta)
        except ValueError:
            # Invalid theta, copula ignored
            pass

        try:
            gumbel = Bivariate(CopulaTypes.GUMBEL)
            gumbel.fit(X)
            copula_candidates.append(gumbel)
            theta_candidates.append(gumbel.theta)
        except ValueError:
            # Invalid theta, copula ignored
            pass

        z_left, L, z_right, R = cls.compute_empirical(X)
        left_dependence, right_dependence = cls.get_dependencies(
            copula_candidates, z_left, z_right)

        # compute L2 distance from empirical distribution
        cost_L = [np.sum((L - l) ** 2) for l in left_dependence]
        cost_R = [np.sum((R - r) ** 2) for r in right_dependence]
        cost_LR = np.add(cost_L, cost_R)

        selected_copula = np.argmax(cost_LR)
        selected_theta = theta_candidates[selected_copula]
        return CopulaTypes(selected_copula), selected_theta
1044501
def random( self ):
        
        j = np.searchsorted( self.cumulative_probabilities(), random.random() )
        return self.jumps[ j ]
75055
def pdf(self, x_test):
		
		N,D = self.data.shape
		x_test = np.asfortranarray(x_test)
		x_test = x_test.reshape([-1, D])
		
		pdfs = self._individual_pdfs(x_test)
		#import pdb; pdb.set_trace()
		# combine values based on fully_dimensional!
		if self.fully_dimensional:
			# first the product of the individual pdfs for each point in the data across dimensions and then the average (factorized kernel)
			pdfs = np.sum(np.prod(pdfs, axis=-1)*self.weights[None, :], axis=-1)
		else:
			# first the average over the 1d pdfs and the the product over dimensions (TPE like factorization of the pdf)
			pdfs = np.prod(np.sum(pdfs*self.weights[None,:,None], axis=-2), axis=-1)
		return(pdfs)
954385
def get_X0(X):
    
    if pandas_available and isinstance(X, pd.DataFrame):
        assert len(X) == 1
        x = np.array(X.iloc[0])
    else:
        x, = X
    return x
1311066
def get_likelihood(self, uni_matrix):
        
        if self.parents is None:
            left_u = uni_matrix[:, self.L]
            right_u = uni_matrix[:, self.R]

        else:
            left_ing = list(self.D - self.parents[0].D)[0]
            right_ing = list(self.D - self.parents[1].D)[0]
            left_u = uni_matrix[self.L, left_ing]
            right_u = uni_matrix[self.R, right_ing]

        copula = Bivariate(self.name)
        copula.theta = self.theta

        X_left_right = np.array([[left_u, right_u]])
        X_right_left = np.array([[right_u, left_u]])

        value = np.sum(copula.probability_density(X_left_right))
        left_given_right = copula.partial_derivative(X_left_right)
        right_given_left = copula.partial_derivative(X_right_left)

        return value, left_given_right, right_given_left
736270
def get_p_vals(self, X):
		'''
		

		'''
		z_scores = self.get_scores(X[:, 0], X[:, 1])
		return norm.cdf(z_scores)
780977
public double cumulativeProbability(double x) {
        if (means != null)
            throw new IllegalStateException("Unable to sample from more than one mean");
        final double dev = x - mean;
        if (FastMath.abs(dev) > 40 * standardDeviation) {
            return dev < 0 ? 0.0d : 1.0d;
        }
        return 0.5 * (1 + Erf.erf(dev / (standardDeviation * SQRT2)));
    }
1038395
def _sample_row(self):
        
        unis = np.random.uniform(0, 1, self.n_var)
        # randomly select a node to start with
        first_ind = np.random.randint(0, self.n_var)
        adj = self.trees[0].get_adjacent_matrix()
        visited = []
        explore = [first_ind]

        sampled = np.zeros(self.n_var)
        itr = 0
        while explore:
            current = explore.pop(0)
            neighbors = np.where(adj[current, :] == 1)[0].tolist()
            if itr == 0:
                new_x = self.ppfs[current](unis[current])

            else:
                for i in range(itr - 1, -1, -1):
                    current_ind = -1

                    if i >= self.truncated:
                        continue

                    current_tree = self.trees[i].edges
                    # get index of edge to retrieve
                    for edge in current_tree:
                        if i == 0:
                            if (edge.L == current and edge.R == visited[0]) or\
                               (edge.R == current and edge.L == visited[0]):
                                current_ind = edge.index
                                break
                        else:
                            if edge.L == current or edge.R == current:
                                condition = set(edge.D)
                                condition.add(edge.L)
                                condition.add(edge.R)

                                visit_set = set(visited)
                                visit_set.add(current)

                                if condition.issubset(visit_set):
                                    current_ind = edge.index
                                break

                    if current_ind != -1:
                        # the node is not indepedent contional on visited node
                        copula_type = current_tree[current_ind].name
                        copula = Bivariate(CopulaTypes(copula_type))
                        copula.theta = current_tree[current_ind].theta
                        derivative = copula.partial_derivative_scalar

                        if i == itr - 1:
                            tmp = optimize.fminbound(
                                derivative, EPSILON, 1.0,
                                args=(unis[visited[0]], unis[current])
                            )
                        else:
                            tmp = optimize.fminbound(
                                derivative, EPSILON, 1.0,
                                args=(unis[visited[0]], tmp)
                            )

                        tmp = min(max(tmp, EPSILON), 0.99)

                new_x = self.ppfs[current](tmp)

            sampled[current] = new_x

            for s in neighbors:
                if s not in visited:
                    explore.insert(0, s)

            itr += 1
            visited.insert(0, current)

        return sampled