code: def _daal4py_loss_and_grad(beta, objF_instance, X, y, n):
      beta_ = make2d(beta)
      res = objF_instance.compute(X, y, beta_)
      gr = res.gradientIdx.ravel()
      gr = gr * n  # force copy
      v = res.valueIdx[0, 0]
      v *= n
      return (v, gr)
  
file_path: scikit-learn-intelex/daal4py/sklearn/linear_model/logistic_loss.py
imports: import numpy
  import daal4py
  from .._utils import getFPType, make2d
label_desc: Use image node_id 4 for calling a global function with example usage: _daal4py_loss_and_grad(beta, objF_instance, X, y, n) and returns: v,  gr