Пример #1
0
	def estimate_internal(self, input, output):
		pr = Primitives()

		out = tf.reduce_sum(input)
		out += self.rho

		ret = pr.and_diff(pr.geq(out, output[0]), pr.geq(output[1], out))

		return ret
Пример #2
0
    def estimate_internal(self, input, output):
        pr = Primitives()
        count = tf_const(0)
        c = tf_const(self.params.c)
        out = []
        for i in range(self.params.array_size):
            above_threshold = pr.geq(input[i] + self.nu[:, i],
                                     self.params.threshold + self.rho)
            abort = pr.eq(count, c)
            hit = pr.and_diff(above_threshold, pr.not_diff(abort))
            count = pr.ite(hit, count + 1, count)
            out.append(pr.ite(hit, 1, 0))
        ret = 1

        for i in range(self.params.array_size):
            ret = pr.and_diff(ret, pr.eq(out[i], output[i]))

        return ret
Пример #3
0
	def estimate_internal(self, input, output):
		pr = Primitives()
		best = -pr.get_inf()
		best_by_index = tf_const(0)
		for i in range(0, self.array_size):
			d = input[i] + self.noise[:, i]
			hit = pr.eq(tf_const(i), output)
			best = pr.ite(hit, best, tf.maximum(best, d))
			best_by_index = pr.ite(hit, input[i], best_by_index)

		rate = self.params.epsilon / 2
		x = best - best_by_index
		return pr.ite(pr.geq(x, tf_const(0)), exponential_cdf_right(rate, x), tf_const(1))
Пример #4
0
    def estimate_internal(self, input, output):
        pr = Primitives()
        best = -pr.get_inf()
        best_by_index = tf_const(0)
        for i in range(0, self.array_size):
            d = input[i] + self.noise[:, i]
            hit = pr.eq(tf_const(i), output)
            best = pr.ite(hit, best, tf.maximum(best, d))
            best_by_index = pr.ite(hit, input[i], best_by_index)

        scale = 2 / self.params.epsilon
        x = best - best_by_index
        return tf.exp(laplacian_cdf(x, scale)[1])
Пример #5
0
    def estimate_internal(self, input, output):
        pr = Primitives()
        out = []
        for i in range(self.params.array_size):
            above_threshold = pr.geq(input[i],
                                     self.params.threshold + self.rho)
            hit = above_threshold
            out.append(pr.ite(hit, 1, 0))
        ret = 1

        for i in range(self.params.array_size):
            ret = pr.and_diff(ret, pr.eq(out[i], output[i]))

        return ret