code: def softclass_lgbobj(preds, train_data):
      """Custom LightGBM loss function for soft (probabilistic, vector-valued) class-labels only,
      which have been appended to lgb.Dataset (train_data) as additional ".softlabels" attribute (2D numpy array).
      """
      softlabels = train_data.softlabels
      num_classes = softlabels.shape[1]
      preds = np.reshape(
          preds, (len(softlabels), num_classes), order="F"
      )
      preds = np.exp(preds)
      preds = np.multiply(
          preds, 1 / np.sum(preds, axis=1)[:, np.newaxis]
      )
      grad = preds - softlabels
      hess = 2.0 * preds * (1.0 - preds)
      return grad.flatten("F"), hess.flatten("F")
  
imports: import copy
  import os
  import time
  from typing import List, Optional
  import numpy
  import pandas
  from pandas import DataFrame, Series
  from autogluon.common.utils.try_import import try_import_lightgbm
  from autogluon.core.constants import BINARY, MULTICLASS, QUANTILE, REGRESSION, SOFTCLASS
  from autogluon.core.utils.exceptions import TimeLimitExceeded
label_desc: Use image node_id 3 for calling a global function with example usage: softclass_lgbobj(preds, train_data) and returns: grad,  hess