class_docstr: Receiving Operating Characteristic Area Under the Curve.
  
  This metric is an approximation of the true ROC AUC. Computing the true ROC AUC would
  require storing all the predictions and ground truths, which isn't desirable. The approximation
  error is not significant as long as the predicted probabilities are well calibrated. In any
  case, this metric can still be used to reliably compare models between each other.
  
  Parameters
  ----------
  n_thresholds
      The number of thresholds used for discretizing the ROC curve. A higher value will lead to
      more accurate results, but will also cost more time and memory.
  pos_val
      Value to treat as "positive".
  
  Examples
  --------
  
  >>> from river import metrics
  
  >>> y_true = [ 0,  0,   1,  1]
  >>> y_pred = [.1, .4, .35, .8]
  
  >>> metric = metrics.ROCAUC()
  
  >>> for yt, yp in zip(y_true, y_pred):
  ...     metric.update(yt, yp)
  
  >>> metric
  ROCAUC: 87.50%
  
  The true ROC AUC is in fact 0.75. We can improve the accuracy by increasing the amount
  of thresholds. This comes at the cost more computation time and more memory usage.
  
  >>> metric = metrics.ROCAUC(n_thresholds=20)
  
  >>> for yt, yp in zip(y_true, y_pred):
  ...     metric.update(yt, yp)
  
  >>> metric
  ROCAUC: 75.00%
class_docstr_tok: ["Receiving","Operating","Characteristic","Area","Under","the","Curve",".","This","metric","is","an","approximation","of","the","true","ROC","AUC",".","Computing","the","true","ROC","AUC","would","require","storing","all","the","predictions","and","ground","truths",",","which","is","n't","desirable",".","The","approximation","error","is","not","significant","as","long","as","the","predicted","probabilities","are","well","calibrated",".","In","any","case",",","this","metric","can","still","be","used","to","reliably","compare","models","between","each","other",".","Parameters","--","--","--","--","--","n_thresholds","The","number","of","thresholds","used","for","discretizing","the","ROC","curve",".","A","higher","value","will","lead","to","more","accurate","results",",","but","will","also","cost","more","time","and","memory",".","pos_val","Value","to","treat","as","``","positive","''",".","Examples","--","--","--","--",">",">",">","from","river","import","metrics",">",">",">","y_true","=","[","0",",","0",",","1",",","1","]",">",">",">","y_pred","=","[",".1",",",".4",",",".35",",",".8","]",">",">",">","metric","=","metrics.ROCAUC","(",")",">",">",">","for","yt",",","yp","in","zip","(","y_true",",","y_pred",")",":","...","metric.update","(","yt",",","yp",")",">",">",">","metric","ROCAUC",":","87.50","%","The","true","ROC","AUC","is","in","fact","0.75",".","We","can","improve","the","accuracy","by","increasing","the","amount","of","thresholds",".","This","comes","at","the","cost","more","computation","time","and","more","memory","usage",".",">",">",">","metric","=","metrics.ROCAUC","(","n_thresholds=20",")",">",">",">","for","yt",",","yp","in","zip","(","y_true",",","y_pred",")",":","...","metric.update","(","yt",",","yp",")",">",">",">","metric","ROCAUC",":","75.00","%"]
code: def update(self, y_true, y_pred, w=1.0):
      p_true = (
          y_pred.get(True, 0.0) if isinstance(y_pred, dict) else y_pred
      )
      for t, cm in zip(self.thresholds, self.cms):
          cm.update(y_true == self.pos_val, p_true > t, w)
  
file_path: river/river/metrics/roc_auc.py
imports: from __future__ import annotations
  from scipy import integrate
  from river import metrics, utils
label_desc: Use image node_id 3 for calling the ROCAUC obj's underlying member method code with example usage: obj.update(y_true, y_pred, w) without return types