Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code not picking one of the classes #19

Open
dwoodlock opened this issue Nov 14, 2018 · 0 comments
Open

Example code not picking one of the classes #19

dwoodlock opened this issue Nov 14, 2018 · 0 comments

Comments

@dwoodlock
Copy link

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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant