code: def informedness_statistic(y_true, y_pred, sample_weight=None):
      """Computes the Informedness also known as the Youden's J statistic for two arrays.
      Youden's J statistic is defined as J = sensitivity + specificity - 1 for a binary output.
      Informedness is its generalization to the multiclass case and estimates the probability of an informed decision.
      Note that in binary classification, we have:
  
          - sensitivity: recall of the positive class.
          - specificity: recall of the negative class.
  
      The index gives equal weight to false positive and false negative values.
      In other words, all algorithms with the same value of the index give the same proportion of total misclassified results.
      Its value ranges from -1 through +1 (inclusive).
      One can interpret this statistic as follows:
  
          - +1 represents that there are no false positives or false negatives, i.e. the algorithm is perfect.
          - 0  respresents when an algorithm gives the same proportion of positive results with and without an anomaly, i.e the test is useless.
          - -1 represents that the classification yields only false positives and false negatives. It's an inverse prediction.
  
      For more information, please consult the `wiki page <https://en.wikipedia.org/wiki/Youden%27s_J_statistic>`_.
  
      Parameters
      ----------
      y_true : array-like, 1-D
          The actual categories.
      y_pred : array-like, 1-D
          The predicted categories.
      sample_weight : array-like, 1-D or None, default None
          The sample weight.
  
      Returns
      -------
      result : `float`
          The informedness statistic.
      """
      return metrics.balanced_accuracy_score(
          y_true=y_true,
          y_pred=y_pred,
          sample_weight=sample_weight,
          adjusted=True,
      )
  
imports: import functools
  import warnings
  from typing import Optional
  from typing import Union
  import numpy
  import pandas
  from sklearn import metrics
  from greykite.detection.common.ad_evaluation_utils import compute_range_based_score
  from greykite.detection.common.ad_evaluation_utils import prepare_anomaly_ranges
label_desc: Use image node_id 6 for calling a global function with example usage: informedness_statistic(y_true, y_pred, sample_weight) and returns: metrics