GithubHelp home page GithubHelp logo

srilakshmi-thota / metrics-roc-and-auc Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 8 KB

Python code to obtain metrics like receiver operating characteristics (ROC) curve and area under the curve (AUC) from scratch without using in-built functions.

Python 100.00%
receiver-operating-characteristic python machine-learning area-under-curve auc roc metrics

metrics-roc-and-auc's Introduction

METRICS-ROC-AND-AUC

Python code to obtain metrics like receiver operating characteristics (ROC) curve and area under the curve (AUC) from scratch without using in-built functions.

Libraries used:
->scipy.io for loading the data from .mat files
->matplotlib.pyplot for plotting the roc curve
->numpy for calculating the area under the curve

Inputs:
actual.mat :data file containning the actuals labels
predicted.mat :data file containning classifier's output(in a range of [0,1])

Outputs:
->Plot displaying the ROC_CURVE
->AUC(the area under the ROC_CURVE is printed

User defined functions:
1.confusion_metrics
Inputs : labels,predictions,threshold
Ouputs : tpf,fpf
This function essentially compares the labels(actual values) and checks whether the predictions(classifier output) is satisfying the condition of threshold and accordingly updates the values of true_positive,false_positive,true_negative,false_negative.

tpf = true_positive / (true_positive + false_negative)
fpf = false_positive / (false_positive + true_negative)

2.results
Inputs : labels,predictions
Outputs : Plot displaying the ROC_CURVE,Printing the AUC value
->This function takes the labels and the predictions and calls the confusion metrics function for all the values of thresholds ranging from 0 to 1 by increementing by a step size of 0.0002.And finally plots the ROC_curve by plotting tpf along Yaxis and fpf along Xaxis.
->Uses the trapz function from numpy library to calculate the area by integrating along the given axis using the composite trapezoidal rule.

metrics-roc-and-auc's People

Contributors

srilakshmi-thota avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

kimberlysama

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.