When I run your example code unchanged, I get the following output:
========================Evaluation Metrics========================
of classes: 3
Accuracy: 0.6667
Precision: 0.7124 (1 class excluded from average)
Recall: 0.6667
F1 Score: 0.8189 (1 class excluded from average)
Precision, recall & F1: macro-averaged (equally weighted avg. of 3 classes)
Warning: 1 class was never predicted by the model and was excluded from average precision
Classes excluded from average precision: [1]
=========================Confusion Matrix=========================
0 1 2
50 0 0 | 0 = 0
6 0 44 | 1 = 1
0 0 50 | 2 = 2
Confusion matrix format: Actual (rowClass) predicted as (columnClass) N times
Here is my code ( a copy of your with a different namespace and a -main function)
(ns clj-tf2.core
(:require [jutsu.ai.core :as ai]))
;;Example configuration of a simple multilayer feedforward neural network architecture
;;classifying the iris dataset.
(def iris-net-config
[:layers
[[:dense [:n-in 4 :n-out 10 :activation :relu]]
[:dense [:n-in 10 :n-out 10 :activation :relu]]
[:output :negative-log-likelihood [:n-in 10 :n-out 3 :activation :softmax]]]])
(def iris-net
(-> iris-net-config
ai/network
ai/initialize-net))
(defn iris-train []
(let [iris-iterator (ai/classification-csv-iterator "iris.csv" 150 4 3)]
(-> iris-net
(ai/train-net! 200 iris-iterator)
(ai/save-model "iris-model"))
(.reset iris-iterator)
(println (ai/evaluate iris-net iris-iterator))))
(defn -main []
(iris-train))
When I run your example code unchanged, I get the following output:
========================Evaluation Metrics========================
of classes: 3
Accuracy: 0.6667
Precision: 0.7124 (1 class excluded from average)
Recall: 0.6667
F1 Score: 0.8189 (1 class excluded from average)
Precision, recall & F1: macro-averaged (equally weighted avg. of 3 classes)
Warning: 1 class was never predicted by the model and was excluded from average precision
Classes excluded from average precision: [1]
=========================Confusion Matrix=========================
0 1 2
50 0 0 | 0 = 0
6 0 44 | 1 = 1
0 0 50 | 2 = 2
Confusion matrix format: Actual (rowClass) predicted as (columnClass) N times
Here is my code ( a copy of your with a different namespace and a -main function)
(ns clj-tf2.core
(:require [jutsu.ai.core :as ai]))
;;Example configuration of a simple multilayer feedforward neural network architecture
;;classifying the iris dataset.
(def iris-net-config
[:layers
[[:dense [:n-in 4 :n-out 10 :activation :relu]]
[:dense [:n-in 10 :n-out 10 :activation :relu]]
[:output :negative-log-likelihood [:n-in 10 :n-out 3 :activation :softmax]]]])
(def iris-net
(-> iris-net-config
ai/network
ai/initialize-net))
(defn iris-train []
(let [iris-iterator (ai/classification-csv-iterator "iris.csv" 150 4 3)]
(-> iris-net
(ai/train-net! 200 iris-iterator)
(ai/save-model "iris-model"))
(.reset iris-iterator)
(println (ai/evaluate iris-net iris-iterator))))
(defn -main []
(iris-train))