code: def matthews_corrcoef(y_true, y_pred, sample_weight=None):
      """Computes the Matthews correlation coefficient for two arrays.
      The statistic is also known as the phi coefficient.
      The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications.
      It takes into account true and false positives and negatives and is generally regarded as a balanced measure
      which can be used even if the classes are of very different sizes.
      The MCC is in essence a correlation coefficient value between -1 and +1 (inclusive).
      One can interpret this coefficient as follows:
  
          - +1 represents a perfect prediction.
          - 0 represents an average random prediction.
          - -1 represents an inverse prediction.
  
      For more information, please consult the `wiki page <https://en.wikipedia.org/wiki/Phi_coefficient>`_.
  
      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 Matthews correlation coefficient.
      """
      return metrics.matthews_corrcoef(
          y_true=y_true, y_pred=y_pred, sample_weight=sample_weight
      )
  
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 5 for calling a global function with example usage: matthews_corrcoef(y_true, y_pred, sample_weight) and returns: metrics