Exemplo n.º 1
0
def handleOnKeyPress(event):
    if event.key == "enter":  # inicializamos y ejecutamos el algoritmo de entrenamiento
        if len(neuronas) > 0:
            algoritmo = Training(neuronas, ETA, TOLERANCIA, LIMITE_EPOCAS)
            algoritmo.run()
        else:
            print("[!] ERROR: no hay patrones en la lista.\n")

    elif event.key == "backspace":  # limpiamos el gráfico y la lista de patrones
        neuronas.clear()
        plt.cla()
        plt.title("Adaline")
        plt.grid(True)
        plt.xlim([-1, 4])
        plt.ylim([-1, 4])
        plt.draw()
Exemplo n.º 2
0
def RunTraining(patterns):
    if len(patterns) > 0:
        algoritmo = Training(patterns)
        algoritmo.run()
    else:
        print("[!] ERROR. No hay patrones en la lista.\n")