GithubHelp home page GithubHelp logo

Comments (2)

ZY123-GOOD avatar ZY123-GOOD commented on May 5, 2024

Thank you for raising this good question. The overlapping area in this diagram is estimated using the following method.

Draw the frequency histogram:

n1, bins1, patches1  = plt.hist(IDScore,bins=100,density=True,color='orange',alpha=0.)
plt.fill_between(bins1[:-1], n1, color='orange', alpha=1.0,label="ImageNet")
plt.plot(bins1[:-1],n1,'--',color='coral')

n2, bins2, patches2  = plt.hist(OODScore,bins=100,density=True,color='lightgreen',alpha=0.)
plt.fill_between(bins2[:-1], n2, color='lightgreen', alpha=0.8,label="SUN")
plt.plot(bins2[:-1],n2,'--',color='green')

The estimated overlapping position of the two parts: for example, threshold = 13.5.

Then:

overlap = []
flag1=0
for i in range(100):
    if bins1[i]<threshold :
        flag1=i
for i in range(flag1):
    overlap.append(n1[i])

flag2=0
for i in range(100):
    if bins2[i]<threshold :
        flag2=i
for i in range(99-flag2):
    overlap.append(n2[99-i])      

At last you can get the overlap by: print(sum(overlap)*(bins1[:-1][1]-bins1[:-1][0]))
Of note, this is only an estimated value derived during the plotting process, and there might be better computational methods.

If you have any further questions, please feel free to email me at [email protected] or chat with me on WeChat.

Wishing you all the best!

from easyrobust.

Cverchen avatar Cverchen commented on May 5, 2024

Thanks for your reply!

from easyrobust.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.