Exemple #1
0
                temperature(a),
                temperature((a + b) % 10),
                temperature((a + b) // 10)
            ])

x = np.array(x)
y = np.array(y)

test_x = np.array(test_x)
test_y = np.array(test_y)

model = LSTMModel(4, [20, 20], 12, 9)
model.train(x, y, x, y, 10, 5000)

results = model.predict(test_x)
activations_0 = model.getActivations(0, test_x)
activations_1 = model.getActivations(1, test_x)

count = 0

for index, result in enumerate(results):
    right = temperatureToInt(result[2])
    left = temperatureToInt(result[3])
    rightTarget = temperatureToInt(test_y[index][2])
    leftTarget = temperatureToInt(test_y[index][3])

    if left == leftTarget and right == rightTarget:
        count += 1

renderResults("temperature", results, test_x, activations_0, activations_1)
            y.append([
                one_hot(c),
                one_hot(b),
                one_hot(a),
                one_hot((a + b + c) % 10),
                one_hot((a + b + c) // 10)
            ])

x = np.array(x)
y = np.array(y)

model = LSTMModel(5, [10, 10], 12, 12)
model.train(x, y, x, y, 10, 5000)

results = model.predict(x)
activations_0 = model.getActivations(0, x)
activations_1 = model.getActivations(1, x)

count = 0

for index, result in enumerate(results):
    left = argmax(result[3])
    right = argmax(result[4])
    leftTarget = argmax(y[index][3])
    rightTarget = argmax(y[index][4])

    if left == leftTarget and right == rightTarget:
        count += 1

for i in range(10):
    renderResults("symbols-activations-multi-" + str(i),