code: def test_estimator(kernel_arg, arrays, gamma, degree, coef0):
      kernel, args = kernel_arg
      X, y, X_test, alpha, sample_weight, dtype = arrays
      model = cuKernelRidge(
          kernel=kernel,
          alpha=alpha,
          gamma=gamma,
          degree=degree,
          coef0=coef0,
          kernel_params=args,
      )
      skl_kernel = (
          kernel.py_func if hasattr(kernel, "py_func") else kernel
      )
      skl_model = sklKernelRidge(
          kernel=skl_kernel,
          alpha=as_type("numpy", alpha),
          gamma=gamma,
          degree=degree,
          coef0=coef0,
          kernel_params=args,
      )
      if kernel == "chi2" or kernel == "additive_chi2":
          # X must be positive
          X = (X - as_type("numpy", X).min()) + 1.0
  
      model.fit(X, y, sample_weight)
      pred = model.predict(X_test).get()
      if dtype == np.float64:
          # For a convex optimisation problem we should arrive at gradient norm 0
          # If the solution has converged correctly
          K = model._get_kernel(X)
          grad_norm = gradient_norm(
              model, *as_type("cupy", X, y, K, sample_weight)
          )
          assert grad_norm < 0.1
          try:
              skl_model.fit(*as_type("numpy", X, y, sample_weight))
          except np.linalg.LinAlgError:
              # sklearn can fail to fit multiclass models
              # with singular kernel matrices
              assume(False)
  
          skl_pred = skl_model.predict(as_type("numpy", X_test))
          assert np.allclose(
              as_type("numpy", pred), skl_pred, atol=1e-2, rtol=1e-2
          )
  
imports: from cuml.testing.utils import as_type
  from hypothesis.extra.numpy import arrays
  from hypothesis import given, settings, assume, strategies
  from sklearn.kernel_ridge import KernelRidge
  import inspect
  import math
  import pytest
  from sklearn.metrics.pairwise import pairwise_kernels
  from cuml.metrics import pairwise_kernels, PAIRWISE_KERNEL_FUNCTIONS
  from cuml import KernelRidge
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 8 for calling a global function with example usage: test_estimator(kernel_arg, arrays, gamma, degree, coef0) without return types