File: deepboof.lua

package info (click to toggle)
deepboof 0.4%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,892 kB
  • sloc: java: 14,256; python: 50; makefile: 7; sh: 3
file content (34 lines) | stat: -rw-r--r-- 835 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
deepboof = {}

local function log10(n)
   if math.log10 then
      return math.log10(n)
   else
      return math.log(n) / math.log(10)
   end
end

-- Converts the confusion matrix into an easy to parse string
function deepboof.confusionToString( confusion )
   confusion:updateValids()
   local str = {''}
   local nclasses = confusion.nclasses

   -- Print all the classes on the first line
   for t = 1,nclasses do
       if t == nclasses then
           table.insert(str,confusion.classes[t] .. '\n')
       else
           table.insert(str,confusion.classes[t] .. ' ')
       end
   end

   -- Now print the actual table
   for t = 1,nclasses do
      for p = 1,nclasses do
         table.insert(str, string.format('%d', confusion.mat[t][p]) .. ' ')
      end
         table.insert(str,'\n')
   end
   return table.concat(str)
end