code: def non_uniform_approx_nearest(points, values):
      """Approximate derivatives using nearest points in non-uniform grid."""
      ndim = points.shape[-1]
      k = triangular(ndim + 1)
      diffs = np.expand_dims(points, axis=0) - np.expand_dims(
          points, axis=1
      )
      norms = np.linalg.norm(diffs, axis=-1)
      nearest_k = np.argpartition(norms, k)[..., :k]
      return taylor_approx(points, points[nearest_k], values[nearest_k])
  
file_path: tf-quant-finance/tf_quant_finance/experimental/finite_difference/methods.py
imports: from autograd import elementwise_grad
  import autograd.numpy
  import pandas
  import sobol_seq
label_desc: Use image node_id 9 for calling a global function with example usage: non_uniform_approx_nearest(points, values) and returns: taylor_approx