code: function vectorize(fun) {
    return function(x) {
      if (!isArray(x)) {
        return fun(x);
      }
      return x.map(function(x) {
        return fun(x);
      });
    };
  }
docs: calculates weight for i-th obs when p > 1 function weight_vectors(kernel, bandwidth, x_0, x_i) { const arg = enclideanDistance(x_i, x_0) / bandwidth; return kernel(arg); }