Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/optim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2013-05-23 23:47:23 +0400
committerClement Farabet <clement.farabet@gmail.com>2013-05-23 23:47:23 +0400
commitfaee21103129bc536b55934c2a2423f4e6c4537d (patch)
tree0f1567cbc57cd1514e34c2cc6b4b08e7b5213816 /ConfusionMatrix.lua
parentcbc20d69113416c1b452766bb7156c61c9a0da35 (diff)
Fixed confusion matrix render.
Diffstat (limited to 'ConfusionMatrix.lua')
-rw-r--r--ConfusionMatrix.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/ConfusionMatrix.lua b/ConfusionMatrix.lua
index cb286ff..81744d9 100644
--- a/ConfusionMatrix.lua
+++ b/ConfusionMatrix.lua
@@ -163,15 +163,15 @@ function ConfusionMatrix:render(sortmode, display, block, legendwidth)
-- sort matrix
if sortmode == 'score' then
- _,order = sort(diag,1,true)
+ _,order = torch.sort(diag,1,true)
elseif sortmode == 'occurrence' then
- _,order = sort(freqs,1,true)
+ _,order = torch.sort(freqs,1,true)
else
error('sort mode must be one of: score | occurrence')
end
-- render matrix
- local render = zeros(#classes*block, #classes*block)
+ local render = torch.zeros(#classes*block, #classes*block)
for target = 1,#classes do
for prediction = 1,#classes do
render[{ { (target-1)*block+1,target*block }, { (prediction-1)*block+1,prediction*block } }] = confusion[order[target]][order[prediction]]
@@ -185,6 +185,7 @@ function ConfusionMatrix:render(sortmode, display, block, legendwidth)
end
-- create rendering
+ require 'image'
require 'qtwidget'
require 'qttorch'
local win1 = qtwidget.newimage( (#render)[2]+legendwidth, (#render)[1] )