#lang racket

(require "Clases-neuron-capa-red.rkt")

;;;;;;;;;;;;;;INSTANCIAS
;;;NEURONAS
(define n_1 (make-object neuron_entrada% 'n_1))
(define n_2 (make-object neuron_entrada% 'n_2))

(define n_3 
  (make-object neurona% 'n_3
    1 propagacion_lineal lineal escalon_1))
(define n_4 
  (make-object neurona% 'n_4
    1 propagacion_lineal lineal escalon_1))

(define n_5 
  (make-object neurona% 'n_5
    1 propagacion_lineal lineal escalon_1))
;;;CAPAS
(define capa_1 
  (make-object capa_entrada% 'c_1
    (list n_1 n_2) ))
(define capa_2 
  (make-object capa% 'c_2
    (list n_3 n_4) (list '(1 -1) '(-1 1))))
(define capa_3 
  (make-object capa% 'c_3
    (list n_5) (list '(1 1))))
;;;RED
(define bicondicional (make-object red% (list capa_1 capa_2 capa_3)))


;;;;
(define estimulos->red
  (lambda (red estimulos);estimulos : training_set
    (printf "(_ _) ==>  Deseada ==>   Real~n")
    (let go ((i 0)
             (j (length estimulos))
             )
      (if (= i j)
          #t
          (let* ((input (car (list-ref estimulos i)))
                 (deseada (second (list-ref estimulos i)))
                 (resp (first (send red proceso! input))) )
;            (printf "~a ==> ~a ==> ~a~n" input deseada resp)
            (if (equal? deseada resp)
                (printf "~a ==>    ~a     ==>    ~a~n" input deseada resp)
                (printf "~a -->    ~a     -->    ~a**~n" input deseada resp)       
                )
            (go (add1 i) j)
            )
          )
      )
    )
  )

(provide red% capa% capa_entrada% neurona% neuron_entrada%
         bicondicional estimulos->red)

