--襦讌ろ 蠏覿 蟆郁骸襯 螳讌螻...
set ansi_warnings off
set statistics io off
set nocount on
declare
@std float
, @FF float
, @FT float
, @TF float
, @TT float
set @std = 0.5
select
@FF = count(case when is_out = 0 and pred < @std then 1 end)
, @FT = count(case when is_out = 1 and pred < @std then 1 end)
, @TF = count(case when is_out = 0 and pred >= @std then 1 end)
, @TT = count(case when is_out = 1 and pred >= @std then 1 end)
from reader.dbo.result_001
print 'confusion.matrix'
print ' ' + str(0) + ' ' + str(1)
print '0 ' + str(@FF) + ' ' + str(@FT)
print '1 ' + str(@TF) + ' ' + str(@TT)
print ''
print ' = ' + convert(varchar, convert(decimal(18,2), (@FF + @TT) / (@FF + @FT + @TF + @TT) * 100))
print '覩手 = ' + convert(varchar, convert(decimal(18,2), @TT/(@FT+@TT)* 100))
print '轟企 = ' + convert(varchar, convert(decimal(18,2), @FF/(@FF+@TF)* 100))
print 'る = ' + convert(varchar, convert(decimal(18,2), (@FT + @TF)/(@FF + @FT + @TF + @TT)* 100))
/*
confusion.matrix
0 1
0 4426 971
1 2674 6129
= 74.33
覩手 = 86.32
轟企 = 62.34
る = 25.67
*/