class_docstr: A Variation of the DBSCAN algorithm called Checkback DBSCAN (CBDBSCAN).
  
  The algorithm works based on DBSCAN-like parameters 'eps' and 'min_samples' that respectively define how far a
  "nearby" point is, and the minimum number of nearby points needed to label a candidate datapoint a core of a
  cluster. (See https://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html).
  
  The algorithm works as follows:
  
  1. (A)symmetric distance matrix provided at fit-time (called 'amatrix').
     For the sake of example below, assume the there are only five topics (amatrix contains distances with dim 5x5),
     T_1, T_2, T_3, T_4, T_5:
  2. Start by scanning a candidate topic with respect to a parent topic
     (e.g. T_1 with respect to parent None)
  3. Check which topics are nearby the candidate topic using 'self.eps' as a threshold and call them neighbours
     (e.g. assume T_3, T_4, and T_5 are nearby and become neighbours)
  4. If there are more neighbours than 'self.min_samples', the candidate topic becomes a core candidate for a cluster
     (e.g. if 'min_samples'=1, then T_1 becomes the first core of a cluster)
  5. If candidate is a core, CheckBack (CB) to find the fraction of neighbours that are either the parent or the
     parent's neighbours.  If this fraction is more than 75%, give the candidate the same label as its parent.
     (e.g. in the trivial case there is no parent (or neighbours of that parent), a new incremental label is given)
  6. If candidate is a core, recursively scan the next nearby topic (e.g. scan T_3) labeling the previous topic as
     the parent and the previous neighbours as the parent_neighbours - repeat steps 2-6:
  
     2. (e.g. Scan candidate T_3 with respect to parent T_1 that has parent_neighbours T_3, T_4, and T_5)
     3. (e.g. T5 is the only neighbour)
     4. (e.g. number of neighbours is 1, therefore candidate T_3 becomes a core)
     5. (e.g. CheckBack finds that two of the four parent and parent neighbours are neighbours of candidate T_3.
        Therefore the candidate T_3 does NOT get the same label as its parent T_1)
     6. (e.g. Scan candidate T_5 with respect to parent T_3 that has parent_neighbours T_5)
  
  The CB step has the effect that it enforces cluster compactness and allows the model to avoid creating clusters for
  unstable topics made of a composition of multiple stable topics.
class_docstr_tok: ["A","Variation","of","the","DBSCAN","algorithm","called","Checkback","DBSCAN","(","CBDBSCAN",")",".","The","algorithm","works","based","on","DBSCAN-like","parameters","'eps","'","and","'min_samples","'","that","respectively","define","how","far","a","''","nearby","''","point","is",",","and","the","minimum","number","of","nearby","points","needed","to","label","a","candidate","datapoint","a","core","of","a","cluster",".","(","See","https",":","\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.cluster.DBSCAN.html",")",".","The","algorithm","works","as","follows",":","1",".","(","A",")","symmetric","distance","matrix","provided","at","fit-time","(","called","'amatrix","'",")",".","For","the","sake","of","example","below",",","assume","the","there","are","only","five","topics","(","amatrix","contains","distances","with","dim","5x5",")",",","T_1",",","T_2",",","T_3",",","T_4",",","T_5",":","2",".","Start","by","scanning","a","candidate","topic","with","respect","to","a","parent","topic","(","e.g",".","T_1","with","respect","to","parent","None",")","3",".","Check","which","topics","are","nearby","the","candidate","topic","using","'self.eps","'","as","a","threshold","and","call","them","neighbours","(","e.g",".","assume","T_3",",","T_4",",","and","T_5","are","nearby","and","become","neighbours",")","4",".","If","there","are","more","neighbours","than","'self.min_samples","'",",","the","candidate","topic","becomes","a","core","candidate","for","a","cluster","(","e.g",".","if","'min_samples'=1",",","then","T_1","becomes","the","first","core","of","a","cluster",")","5",".","If","candidate","is","a","core",",","CheckBack","(","CB",")","to","find","the","fraction","of","neighbours","that","are","either","the","parent","or","the","parent","'s","neighbours",".","If","this","fraction","is","more","than","75","%",",","give","the","candidate","the","same","label","as","its","parent",".","(","e.g",".","in","the","trivial","case","there","is","no","parent","(","or","neighbours","of","that","parent",")",",","a","new","incremental","label","is","given",")","6",".","If","candidate","is","a","core",",","recursively","scan","the","next","nearby","topic","(","e.g",".","scan","T_3",")","labeling","the","previous","topic","as","the","parent","and","the","previous","neighbours","as","the","parent_neighbours","-","repeat","steps","2-6",":","2",".","(","e.g",".","Scan","candidate","T_3","with","respect","to","parent","T_1","that","has","parent_neighbours","T_3",",","T_4",",","and","T_5",")","3",".","(","e.g",".","T5","is","the","only","neighbour",")","4",".","(","e.g",".","number","of","neighbours","is","1",",","therefore","candidate","T_3","becomes","a","core",")","5",".","(","e.g",".","CheckBack","finds","that","two","of","the","four","parent","and","parent","neighbours","are","neighbours","of","candidate","T_3",".","Therefore","the","candidate","T_3","does","NOT","get","the","same","label","as","its","parent","T_1",")","6",".","(","e.g",".","Scan","candidate","T_5","with","respect","to","parent","T_3","that","has","parent_neighbours","T_5",")","The","CB","step","has","the","effect","that","it","enforces","cluster","compactness","and","allows","the","model","to","avoid","creating","clusters","for","unstable","topics","made","of","a","composition","of","multiple","stable","topics","."]
docstr: Create a new CBDBSCAN object. Call fit in order to train it on an asymmetric distance matrix.
  
  Parameters
  ----------
  eps : float
      epsilon for the CBDBSCAN algorithm, having the same meaning as in classic DBSCAN clustering.
  min_samples : int
      The minimum number of samples in the neighborhood of a topic to be considered a core in CBDBSCAN.
docstr_tok: ["Create","a","new","CBDBSCAN","object",".","Call","fit","in","order","to","train","it","on","an","asymmetric","distance","matrix",".","Parameters","--","--","--","--","--","eps",":","float","epsilon","for","the","CBDBSCAN","algorithm",",","having","the","same","meaning","as","in","classic","DBSCAN","clustering",".","min_samples",":","int","The","minimum","number","of","samples","in","the","neighborhood","of","a","topic","to","be","considered","a","core","in","CBDBSCAN","."]
code: def __init__(self, eps, min_samples):
      """Create a new CBDBSCAN object. Call fit in order to train it on an asymmetric distance matrix.
  
      Parameters
      ----------
      eps : float
          epsilon for the CBDBSCAN algorithm, having the same meaning as in classic DBSCAN clustering.
      min_samples : int
          The minimum number of samples in the neighborhood of a topic to be considered a core in CBDBSCAN.
  
      """
      self.eps = eps
      self.min_samples = min_samples
  
imports: import logging
  import os
  from multiprocessing import Process, Pipe, ProcessError
  import importlib
  from typing import Set, Optional, List
  import numpy
  from scipy.spatial.distance import cosine
  from dataclasses import dataclass
  from gensim import utils
  from gensim.models import ldamodel, ldamulticore, basemodel
  from gensim.utils import SaveLoad
label_desc: Use image node_id 1 to create a new CBDBSCAN object  with example: obj = CBDBSCAN(eps, min_samples)