code: def ungar_transform(tdm):
      pw = tdm.sum(axis=0).A1 / tdm.sum()  # get prob(word)
      tdmd = tdm.todense()
      tdmdpw = tdmd.T
      # tdmdpw = np.multiply(tdmd, pw) # use word probabilities
      tdmdpwln = (tdmdpw / tdmdpw.sum(axis=1)).T  # length normalized
      print(tdmdpwln.shape, tdm.shape)
      X = 2 * np.sqrt(tdmdpwln + 3.0 / 8)  # Anscombe transformed
      return X.T
  
imports: import logging
  import numpy
  import pandas
  from scattertext.continuous.coefficientbase import CoefficientBase
label_desc: Use image node_id 1 for calling a global function with example usage: ungar_transform(tdm) and returns: X