PoisotLab / SimpleSDMLayers.jl

Simple layers for species distribution modeling and bioclimatic data
https://docs.ecojulia.org/SimpleSDMLayers.jl/stable/
MIT License
19 stars 2 forks source link

🐛 thresholding in the BRT vignette may be wrong #127

Closed tpoisot closed 3 years ago

tpoisot commented 3 years ago

Contact Details

No response

What happened?

The adjacency matrix should be calculated this way

obs = y .> 0

for (i, c) in enumerate(cutoff)
    predic = distribution[xy] .>= c
    tp = sum(obs .& predic)
    tn = sum(.!obs .& (.!predic))
    fp = sum(.!obs .& predic)
    fn = sum(obs .& (.!predic))
    J[i] = tp / (tp + fn) + tn / (tn + fp) - 1
    FPR[i] = fp/(fp+tn)
    TPR[i] = tp/(tp+fn)
end

Stacktrace

No response