docs: def fit(self, data, parent_node=None, estimator=None):
          """
          Computes the CPD for each node from a given data in the form of a pandas dataframe.
          If a variable from the data is not present in the model, it adds that node into the model.
  
          Parameters
          ----------
          data : pandas DataFrame object
              A DataFrame object with column names same as the variable names of network
  
          parent_node: any hashable python object (optional)
              Parent node of the model, if not specified it looks for a previously specified
              parent node.
  
          estimator: Estimator class
              Any pgmpy estimator. If nothing is specified, the default ``MaximumLikelihoodEstimator``
              would be used.
  
          Examples
          --------
          >>> import numpy as np
          >>> import pandas as pd
          >>> from pgmpy.models import NaiveBayes
          >>> model = NaiveBayes()
          >>> values = pd.DataFrame(np.random.randint(low=0, high=2, size=(1000, 5)),
          ...                       columns=['A', 'B', 'C', 'D', 'E'])
          >>> model.fit(values, 'A')
          >>> model.get_cpds()
          [<TabularCPD representing P(D:2 | A:2) at 0x4b72870>,
           <TabularCPD representing P(E:2 | A:2) at 0x4bb2150>,
           <TabularCPD representing P(A:2) at 0x4bb23d0>,
           <TabularCPD representing P(B:2 | A:2) at 0x4bb24b0>,
           <TabularCPD representing P(C:2 | A:2) at 0x4bb2750>]
          >>> model.edges()
          [('A', 'D'), ('A', 'E'), ('A', 'B'), ('A', 'C')]
          """
          if not parent_node:
              if not self.parent_node:
                  raise ValueError("parent node must be specified for the model")
              else:
                  parent_node = self.parent_node
          if parent_node not in data.columns:
              raise ValueError("parent node: {node} is not present in the given data".format(node=parent_node))
          for child_node in data.columns:
              if child_node != parent_node:
                  self.add_edge(parent_node, child_node)
          super(NaiveBayes, self).fit(data, estimator)