docstr: Direct quote from Gries (2019)
  The final measure to be discussed here is one that, as far as I can tell, has never
  been proposed as a measure of dispersion, but seems to me to be ideally suited to be
  one, namely the Kullback-Leibler (or KL-) divergence, a non-symmetric measure
  that quantifies how different one probability distribution (e.g., the distribution of
  all the occurrences of a across all corpus parts, i.e. v/f) is from another (e.g., the
  corpus part sizes s); the KL-divergence is computed as shown in (14) (with log2s of 167
  0 defined as 0):
docstr_tok: ["Direct","quote","from","Gries","(","2019",")","The","final","measure","to","be","discussed","here","is","one","that",",","as","far","as","I","can","tell",",","has","never","been","proposed","as","a","measure","of","dispersion",",","but","seems","to","me","to","be","ideally","suited","to","be","one",",","namely","the","Kullback-Leibler","(","or","KL-",")","divergence",",","a","non-symmetric","measure","that","quantifies","how","different","one","probability","distribution","(","e.g.",",","the","distribution","of","all","the","occurrences","of","a","across","all","corpus","parts",",","i.e",".","v\/f",")","is","from","another","(","e.g.",",","the","corpus","part","sizes","s",")",";","the","KL-divergence","is","computed","as","shown","in","(","14",")","(","with","log2s","of","167","0","defined","as","0",")",":"]
code: def kl_divergence(self):
      """
      Direct quote from Gries (2019)
      The final measure to be discussed here is one that, as far as I can tell, has never
      been proposed as a measure of dispersion, but seems to me to be ideally suited to be
      one, namely the Kullback-Leibler (or KL-) divergence, a non-symmetric measure
      that quantifies how different one probability distribution (e.g., the distribution of
      all the occurrences of a across all corpus parts, i.e. v/f) is from another (e.g., the
      corpus part sizes s); the KL-divergence is computed as shown in (14) (with log2s of 167
      0 defined as 0):"""
      vf = self.v.multiply(1.0 / self.f)
      vfs = vf.multiply(1.0 / self.s)
      vfs.data = np.log(vfs.data) / np.log(2)
      return np.sum(vf.multiply(vfs), axis=0).A1
  
imports: from typing import Optional, Callable, List
  import numpy
  import pandas
  from scattertext.termranking import AbsoluteFrequencyRanker
  from scipy.sparse import csc_matrix, csr_matrix
  from sklearn.preprocessing import StandardScaler
  from scattertext.smoothing.lowess import Lowess
  from scattertext.termranking.TermRanker import TermRanker
  from scattertext.TermDocMatrix import TermDocMatrix
label_desc: Use image node_id 10 for calling the Dispersion obj's underlying member method code with example usage: obj.kl_divergence() and returns: np