code: def matrix_params_calc(
      actual_vector, predict_vector, sample_weight, classes=None
  ):
      """
      Calculate true positive (TP), true negative (TN), false positive (FP), and false negative (FN) for each class.
  
      :param actual_vector: actual values
      :type actual_vector: list
      :param predict_vector: vector of predictions
      :type predict_vector: list
      :param sample_weight: sample weights list
      :type sample_weight: list
      :param classes: ordered labels of classes
      :type classes: list
      :return: [classes_list, table, TP, TN, FP, FN]
      """
      [actual_vector, predict_vector] = vector_filter(
          actual_vector, predict_vector
      )
      if isinstance(sample_weight, numpy.ndarray):
          sample_weight = sample_weight.tolist()
      [actual_vector, predict_vector, classes_list] = classes_filter(
          actual_vector, predict_vector, classes
      )
      map_dict = {k: 0 for k in classes_list}
      table = {k: map_dict.copy() for k in classes_list}
      weight_vector = [1] * len(actual_vector)
      if isinstance(sample_weight, (list, numpy.ndarray)):
          if len(sample_weight) == len(actual_vector):
              weight_vector = sample_weight
      for index, item in enumerate(actual_vector):
          try:
              table[item][predict_vector[index]] += (
                  1 * weight_vector[index]
              )
          except KeyError:
              continue
      [
          _,
          _,
          TP_dict,
          TN_dict,
          FP_dict,
          FN_dict,
      ] = matrix_params_from_table(table, classes_list)
      return [classes_list, table, TP_dict, TN_dict, FP_dict, FN_dict]
  
imports: from __future__ import division
  import sys
  import math
  import numpy
  import re
  from .pycm_param import *
  from .pycm_error import pycmMatrixError
  from warnings import warn
  from functools import wraps
label_desc: Use image node_id 16 for calling a global function with example usage: matrix_params_calc(actual_vector, predict_vector, sample_weight, classes) and returns: list