Contents

1 Confusion Matrix
2 谿瑚: 覩手 轟企
3 t-sql
4 R


confusion_matrix2.xlsx --> 願姥 .

1 Confusion Matrix #

False(れ) True(れ)
False(豸) 4696 2766
True(豸) 304 2234

觜(%)
(Accuracy) (4696 + 2234) / (4696 + 2766 + 304 + 2234) 69.30%
覩手 (sensitivity) 2234 / (2766 + 2234) 44.68%
轟企 (specificity) 4696 / (4696 + 304) 93.92%
る (error) (2766 + 304 ) / (4696 + 2766 + 304 + 2234) 30.70%
confusion_matrix.xlsx

  • : 覈語
  • 覩手: True 觜
  • 轟企: False 觜
  • る: 覈語 る

2 谿瑚: 覩手 轟企 #

轟 讌覲 譟一蟆郁骸..
覩手 (讌覲 れ襦 蟇碁語 蟇碁碁る 蟆 蟆郁骸)螳 99.7%螻 轟企 (讌覲 れ襦 蟇碁語 蟇碁碁る 蟆 蟆郁骸)螳 98.5%. 願 覓伎 襴覃, 1000覈 蟆 覲 磯 り れ覦 3覈願 覲 磯 り れ 15覈 朱 蟇一.


3 t-sql #

--襦讌ろ 蠏覿 蟆郁骸襯 螳讌螻...
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
*/

4 R #

cf <- sqldf ("
select 
    count(case when t1 = 0 and pred < 0.5 then 1 end) FF
,   count(case when t1 = 1 and pred < 0.5 then 1 end) FT
,   count(case when t1 = 0 and pred >= 0.5 then 1 end) TF
,   count(case when t1 = 1 and pred >= 0.5 then 1 end) TT
from x3
")

print (paste(' = ', (cf$FF + cf$TT) / (cf$FF + cf$FT + cf$TF + cf$TT)))
print (paste('覩手 = ', cf$TT/(cf$FT+cf$TT)))
print (paste('轟企 = ', cf$FF/(cf$FF+cf$TF)))
print (paste('る = ', (cf$FT + cf$TF)/(cf$FF + cf$FT + cf$TF + cf$TT)))