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>2012-10-16 06:43:35 +0400
committerClement Farabet <clement.farabet@gmail.com>2012-10-16 06:43:35 +0400
commit907296ae976acb61df07e691d50d8a1b54693e52 (patch)
tree1098cc6de3733e774ddeca985f805ee74333dc35
parentc12e430a890092c83ed950683704b68831a64e6e (diff)
Fixed alloc explostion.
-rw-r--r--ConfusionMatrix.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/ConfusionMatrix.lua b/ConfusionMatrix.lua
index 68e7f44..3026968 100644
--- a/ConfusionMatrix.lua
+++ b/ConfusionMatrix.lua
@@ -81,38 +81,38 @@ end
function ConfusionMatrix:__tostring__()
self:updateValids()
- local str = 'ConfusionMatrix:\n'
+ local str = {'ConfusionMatrix:\n'}
local nclasses = self.nclasses
- str = str .. '['
+ table.insert(str, '[')
for t = 1,nclasses do
local pclass = self.valids[t] * 100
pclass = string.format('%2.3f', pclass)
if t == 1 then
- str = str .. '['
+ table.insert(str, '[')
else
- str = str .. ' ['
+ table.insert(str, ' [')
end
for p = 1,nclasses do
- str = str .. '' .. string.format('%8d', self.mat[t][p])
+ table.insert(str, string.format('%8d', self.mat[t][p]))
end
if self.classes and self.classes[1] then
if t == nclasses then
- str = str .. ']] ' .. pclass .. '% \t[class: ' .. (self.classes[t] or '') .. ']\n'
+ table.insert(str, ']] ' .. pclass .. '% \t[class: ' .. (self.classes[t] or '') .. ']\n')
else
- str = str .. '] ' .. pclass .. '% \t[class: ' .. (self.classes[t] or '') .. ']\n'
+ table.insert(str, '] ' .. pclass .. '% \t[class: ' .. (self.classes[t] or '') .. ']\n')
end
else
if t == nclasses then
- str = str .. ']] ' .. pclass .. '% \n'
+ table.insert(str, ']] ' .. pclass .. '% \n')
else
- str = str .. '] ' .. pclass .. '% \n'
+ table.insert(str, '] ' .. pclass .. '% \n')
end
end
end
- str = str .. ' + average row correct: ' .. (self.averageValid*100) .. '% \n'
- str = str .. ' + average rowUcol correct (VOC measure): ' .. (self.averageUnionValid*100) .. '% \n'
- str = str .. ' + global correct: ' .. (self.totalValid*100) .. '%'
- return str
+ table.insert(str, ' + average row correct: ' .. (self.averageValid*100) .. '% \n')
+ table.insert(str, ' + average rowUcol correct (VOC measure): ' .. (self.averageUnionValid*100) .. '% \n')
+ table.insert(str, ' + global correct: ' .. (self.totalValid*100) .. '%')
+ return table.concat(str)
end
function ConfusionMatrix:render(sortmode, display, block, legendwidth)