code: def decision_boundary_plot(
      svm, features, vectors, labels, kernel, fileName=None, **args
  ):
      title = None
      if "title" in args:
          title = args["title"]
      xlabel = None
      if "xlabel" in args:
          xlabel = args["xlabel"]
      ylabel = None
      if "ylabel" in args:
          ylabel = args["ylabel"]
      fontsize = "medium"
      if "fontsize" in args:
          fontsize = args["fontsize"]
      contourFontsize = 10
      if "contourFontsize" in args:
          contourFontsize = args["contourFontsize"]
      showColorbar = True
      if "showColorbar" in args:
          showColorbar = args["showColorbar"]
      show = True
      if fileName is not None:
          show = False
      if "show" in args:
          show = args["show"]
  
      # setting up the grid
      delta = 0.005
      x = arange(xmin, xmax, delta)
      y = arange(ymin, ymax, delta)
  
      Z = numpy.zeros((len(x), len(y)), numpy.float_)
      gridX = numpy.zeros((len(x) * len(y), 2), numpy.float_)
      n = 0
      for i in range(len(x)):
          for j in range(len(y)):
              gridX[n][0] = x[i]
              gridX[n][1] = y[j]
              n += 1
  
      if kernel.get_name() == "Linear" and "customwandb" in args:
          kernel.init_optimization_svm(svm)
          b = svm.get_bias()
          w = kernel.get_w()
          kernel.set_w(args["customwandb"][0])
          svm.set_bias(args["customwandb"][1])
  
      if kernel.get_name() == "Linear" and "drawarrow" in args:
          kernel.init_optimization_svm(svm)
          b = svm.get_bias()
          w = kernel.get_w()
          s = 1.0 / numpy.dot(w, w) / 1.17
          pylab.arrow(
              0,
              -b / w[1],
              w[0] * s,
              s * w[1],
              width=0.01,
              fc="#dddddd",
              ec="k",
          )
      grid_features = RealFeatures(numpy.transpose(gridX))
      results = svm_test(svm, kernel, features, grid_features)
  
      n = 0
      for i in range(len(x)):
          for j in range(len(y)):
              Z[i][j] = results[n]
              n += 1
  
      cdict = {
          "red": ((0.0, 0.6, 0.6), (0.5, 0.8, 0.8), (1.0, 1.0, 1.0)),
          "green": ((0.0, 0.6, 0.6), (0.5, 0.8, 0.8), (1.0, 1.0, 1.0)),
          "blue": ((0.0, 0.6, 0.6), (0.5, 0.8, 0.8), (1.0, 1.0, 1.0)),
      }
      my_cmap = matplotlib.colors.LinearSegmentedColormap(
          "lightgray", cdict, 256
      )
      im = pylab.imshow(
          numpy.transpose(Z),
          interpolation="bilinear",
          origin="lower",
          cmap=my_cmap,
          extent=(xmin, xmax, ymin, ymax),
      )
  
      if "decisionboundaryonly" in args:
          C1 = pylab.contour(
              numpy.transpose(Z),
              [0],
              origin="lower",
              linewidths=(3),
              colors=["k"],
              extent=(xmin, xmax, ymin, ymax),
          )
      else:
          C1 = pylab.contour(
              numpy.transpose(Z),
              [-1, 0, 1],
              origin="lower",
              linewidths=(1, 3, 1),
              colors=["k", "k"],
              extent=(xmin, xmax, ymin, ymax),
          )
  
          pylab.clabel(
              C1, inline=1, fmt="%1.1f", fontsize=contourFontsize
          )
  
      # plot the data
      lab = labels.get_labels()
      vec = numpy.array(vectors)
      idx = numpy.where(lab == -1)[0]
      pylab.scatter(
          vec[idx, 0],
          vec[idx, 1],
          s=300,
          c="#4444ff",
          marker="o",
          alpha=0.8,
          zorder=100,
      )
      idx = numpy.where(lab == +1)[0]
      pylab.scatter(
          vec[idx, 0],
          vec[idx, 1],
          s=500,
          c="#ff4444",
          marker="s",
          alpha=0.8,
          zorder=100,
      )
  
      # plot SVs
      if not "decisionboundaryonly" in args:
          training_outputs = svm_test(svm, kernel, features, features)
          sv_idx = numpy.where(abs(training_outputs) <= 1.01)[0]
          pylab.scatter(
              vec[sv_idx, 0],
              vec[sv_idx, 1],
              s=100,
              c="k",
              marker="o",
              alpha=0.8,
              zorder=100,
          )
  
      if "showmovedpoint" in args:
          x = -0.779838709677
          y = -0.1375
          pylab.scatter(
              [x],
              [y],
              s=300,
              c="#4e4e61",
              marker="o",
              alpha=1,
              zorder=100,
              edgecolor="#454548",
          )
          pylab.arrow(
              x,
              y - 0.1,
              0,
              -0.8 / 1.5,
              width=0.01,
              fc="#dddddd",
              ec="k",
          )
          # pylab.show()
  
      if title is not None:
          pylab.title(title, fontsize=fontsize)
      if ylabel:
          pylab.ylabel(ylabel, fontsize=fontsize)
      if xlabel:
          pylab.xlabel(xlabel, fontsize=fontsize)
      if showColorbar:
          pylab.colorbar(im)
  
      # colormap:
      pylab.hot()
      if fileName is not None:
          pylab.savefig(fileName)
      if show:
          pylab.show()
  
file_path: shogun/applications/easysvm/tutpaper/svm_params.py
imports: import sys, os
  import numpy
  import shogun
  from shogun import GaussianKernel, LinearKernel, PolyKernel
  from shogun import RealFeatures, BinaryLabels
  from shogun import LibSVM
  from numpy import arange
  import matplotlib
  from matplotlib import pylab
label_desc: Use image node_id 5 for calling a global function with example usage: decision_boundary_plot(svm, features, vectors, labels, kernel, fileName) without return types