code: def test_equivalence(self):
      # compare plain penalty with included weights or restriction
      pen = self.pen
      x = self.params
      k = x.shape[1]
  
      pen2 = smpen.L2ConstraintsPenalty(weights=np.ones(k))
      pen3 = smpen.L2ConstraintsPenalty(restriction=np.eye(k))
      f = pen.func(x.T)
      d = pen.deriv(x.T)
      d2 = np.array([pen.deriv2(np.atleast_1d(xi)) for xi in x])
      for pen_ in [pen2, pen3]:
          assert_allclose(pen_.func(x.T), f, rtol=1e-7, atol=1e-8)
          assert_allclose(pen_.deriv(x.T), d, rtol=1e-7, atol=1e-8)
          d2_ = np.array([pen.deriv2(np.atleast_1d(xi)) for xi in x])
          assert_allclose(d2_, d2, rtol=1e-10, atol=1e-8)
  
imports: import numpy
  from numpy.testing import assert_allclose, assert_equal
  import statsmodels.base._penalties
  from statsmodels.tools.numdiff import approx_fprime, approx_hess
label_desc: Use image node_id 2 for calling the TestL2Constraints0 obj's underlying member method code with example usage: obj.test_equivalence() without return types