 (ns cortex.nn.network-test
   (:require
-    [cortex.nn.core :refer [calc output forward backward input-gradient parameters gradient parameter-count]]
+    [cortex.nn.core :refer [calc output calc-output forward backward input-gradient parameters gradient parameter-count]]
     #?(:cljs
         [cljs.test :refer-macros [deftest is are testing]]
         :clj
         [clojure.test :refer [deftest is are testing]])
     [cortex.optimise :as opt]
-    [clojure.core.matrix :as mat]
+    [clojure.core.matrix :as m]
     [clojure.core.matrix.random :as randm]
     #?(:cljs [thi.ng.ndarray.core :as nd])
     [cortex.util :as util]

  "Define a random dataset and create the labels from some fixed parameters so we know exactly
  what the linear model should learn."
  []
  (let [x-data (into [] (mat/rows (randm/sample-uniform [100 2])))
        y-data (into [] (map vector (mat/array (mat/transpose (mat/add (mat/mmul [0.1 0.2] (mat/transpose x-data)) 0.3)))))
        model (layers/linear-layer 2 1)
        loss (opt/mse-loss)
        optimizer (opt/sgd-optimiser 0.01 0.9)

    [cortex.nn.core :as core]
    [cortex.nn.layers :as layers]))

(m/set-current-implementation #?(:clj :vectorz :cljs :thing-ndarray))

; a	b	| a XOR b
; 1	1	     0
