Giter Club home page Giter Club logo

rocaggregator's Introduction

ROCaggregator

Aggregates multiple Receiver Operating Characteristic (ROC) curves obtained from different sources into one global ROC. Additionally, it’s also possible to calculate the aggregated precision-recall (PR) curve.

Motivation

The ROC and the AUC (Area Under the Curve) can be essential metrics when evaluating a model. In situations where there is a parallelization of the model development, such as federated learning, it becomes relevant to obtain precise measures for these metrics. These approaches usually produce partial results that require aggregation methods to get the complete picture. The ROCaggregator appears in this context, allowing to compute the precise ROC curve from the partial results.

Installation

You can install the released version of ROCaggregator from CRAN with:

install.packages("ROCaggregator")

Example

Check the complete example provided in the vignette.

Obtain the global ROC curve from different sources by providing: - the false positive rate (fpr) - true positive rate (tpr) - thresholds (thresh) - the total number of negative samples/control - the total number of samples from each source

library(ROCaggregator)

y1 <- c(1, 0, 1, 1, 0, 0, 0, ...)
# false positive rate values for each threshold
fpr_1 <- c(0, 0, 0, 0, 0.002, ...)
# true positive rate values for each threshold
tpr_1 <- c(0, 0.004, 0.008, 0.012, 0.016, ...)
# thresholds used
thresh_1 <- c(0.9994038, 0.9986345, 0.99847864, 0.99575908, 0.99567612, ...)
# count the number of negative labels
negative_count_1 <- sum(y1 == 0)
# total number of labels
total_count_1 <- length(y1)
...
# ROC curve
roc <- roc_curve(
  list(fpr_1, fpr_2, ...),
  list(tpr_1, tpr_2, ...),
  list(thresh_1, thresh_2, ...),
  c(negative_count_1, negative_count_2, ...),
  c(total_count_1, total_count_2, ...)
)

# Precision-recall
pre_recall <- precision_recall_curve(
  list(fpr_1, fpr_2, ...),
  list(tpr_1, tpr_2, ...),
  list(thresh_1, thresh_2, ...),
  c(negative_count_1, negative_count_2, ...),
  c(total_count_1, total_count_2, ...)
)

rocaggregator's People

Watchers

 avatar  avatar  avatar  avatar

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.