Пример #1
0
import logictensornetworks as ltn
ltn.set_universal_aggreg("min")
ltn.set_existential_aggregator("max")
ltn.set_tnorm("prod")
ltn.LAYERS = 4

from logictensornetworks import And, Not, Or, Forall, Exists, Implies, Equiv
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt


def show_result():
    x0 = data[:, 0]
    x1 = data[:, 1]
    prC = sess.run([C[i](x) for i in clst_ids])
    n = 2
    m = (nr_of_clusters + 1) // n + 1

    fig = plt.figure(figsize=(3 * 3, m * 3))

    fig.add_subplot(m, n, 1)
    plt.title("groundtruth")
    for \
            i in clst_ids:
        plt.scatter(cluster[i][:, 0], cluster[i][:, 1])
    for i in clst_ids:
        fig.add_subplot(m, n, i + 2)
        plt.title("C" + str(i) + "(x)")
        plt.scatter(x0, x1, c=prC[i].T[0])
        plt.scatter(x0[:2], x1[:2], s=0, c=[0, 1])
Пример #2
0
def set_tnorm(tnorm):
    ltn.set_tnorm(tnorm)
def set_tnorm(tnorm):
    CONFIGURATION['tnorm'] = tnorm
    ltn.set_tnorm(tnorm)