class_docstr: Testing the Clarkson Woodruff Transform
class_docstr_tok: ["Testing","the","Clarkson","Woodruff","Transform"]
code: def test_sketch_preserves_frobenius_norm(self):
      # Given the probabilistic nature of the sketches
      # we run the test multiple times and check that
      # we pass all/almost all the tries.
      n_errors = 0
      for A in self.test_matrices:
          if issparse(A):
              true_norm = norm(A)
          else:
              true_norm = np.linalg.norm(A)
          for seed in self.seeds:
              sketch = clarkson_woodruff_transform(
                  A,
                  self.n_sketch_rows,
                  seed=seed,
              )
              if issparse(sketch):
                  sketch_norm = norm(sketch)
              else:
                  sketch_norm = np.linalg.norm(sketch)
  
              if np.abs(true_norm - sketch_norm) > 0.1 * true_norm:
                  n_errors += 1
      assert_(n_errors == 0)
  
file_path: catboost/contrib/python/scipy/py3/scipy/linalg/tests/test_sketches.py
imports: import numpy
  from numpy.testing import assert_, assert_equal
  from scipy.linalg import clarkson_woodruff_transform
  from scipy.linalg._sketches import cwt_matrix
  from scipy.sparse import issparse, rand
  from scipy.sparse.linalg import norm
label_desc: Use image node_id 4 for calling the TestClarksonWoodruffTransform obj's underlying member method code with example usage: obj.test_sketch_preserves_frobenius_norm() without return types