ROCR曲线可通过包装ROCR颠倒产生完美贴标签

时间:2019-01-11 14:32:11

标签: r roc

代码

const connectionString = '[whatever]'
const env = { connection: acquire (connectionString) }

const output = composition (arg0) (argN) (env)
// then, release the connection

// f :: a -> b -> { connection: DbConnection }
const f = x => y => ({ connection }) => 
    doDbStuff (x + y) (connection)

显示曲线

enter image description here

这显然是错误的。我究竟做错了什么?我无法终生解决。目标是“不良”。所以我确定

const withConnection = f => [stuff to acquire the connection, and aftewards, release it]
const env = { withConnection }

const output = composition (arg0) (argN) (env)

// type FnConnection DbConnection c = c -> a
// f :: a -> a -> { connection: FnConnection }
const f = x => y => ({ withConnection }) => 
    withConnection (doDbStuff (x + y))

1 个答案:

答案 0 :(得分:1)

插入符号将第一个级别视为积极类,如使用时所见

confusionMatrix(..., reference=GermanCredit$Class)

ROCR认为以后的级别为肯定级别。逻辑是1是肯定类别,0是否定类别,并且由于0 < 1"Bad" < "Good",因此ROCR认为"Good"是肯定类别。 / p>

解决方案是使用显式排序:

pred = prediction(GermanCredit$perfect_prob, GermanCredit$Class, label.ordering = c("Good", "Bad")
perf = performance(pred, "tpr", "fpr")

"Good" < "Bad"现在将"Bad"prediction视为肯定类别。