code: def scalable_frobenius_norm_discrepancy(X, U, s, V):
      if not sp.sparse.issparse(X) or (
          X.shape[0] * X.shape[1] * X.dtype.itemsize < MAX_MEMORY
      ):
          # if the input is not sparse or sparse but not too big,
          # U.dot(np.diag(s).dot(V)) will fit in RAM
          A = X - U.dot(np.diag(s).dot(V))
          return norm_diff(A, norm="fro")
  
      print("... computing fro norm by batches...")
      batch_size = 1000
      Vhat = np.diag(s).dot(V)
      cum_norm = 0.0
      for batch in gen_batches(X.shape[0], batch_size):
          M = X[batch, :] - U[batch, :].dot(Vhat)
          cum_norm += norm_diff(M, norm="fro", msg=False)
      return np.sqrt(cum_norm)
  
imports: import gc
  import os.path
  import pickle
  from collections import defaultdict
  from time import time
  import matplotlib.pyplot
  import numpy
  import scipy
  from sklearn.datasets import fetch_20newsgroups_vectorized, fetch_lfw_people, fetch_olivetti_faces, fetch_openml, fetch_rcv1, make_low_rank_matrix, make_sparse_uncorrelated
  from sklearn.utils import gen_batches
  from sklearn.utils._arpack import _init_arpack_v0
  from sklearn.utils.extmath import randomized_svd
  from sklearn.utils.validation import check_random_state
label_desc: Use image node_id 9 for calling a global function with example usage: scalable_frobenius_norm_discrepancy(X, U, s, V) and returns: np, norm_diff