code: def get_estimators(positions_all, positions_relevant):
      
      samples_all = [
          (position,) for _, positions in positions_all.items() for position in positions]
      samples_relevant = [
          (position,) for _, positions in positions_relevant.items() for position in positions]
      estimators = dict()
      estimators["P(relevant)"] = len(samples_relevant) / len(samples_all)
      LOGGER.info("Fitting prior p(position) density estimator")
      estimators["p(position)"] = KernelDensity(**KERNEL).fit(samples_all)
      LOGGER.info("Fitting conditional p(position | relevant) density estimator")
      estimators["p(position|relevant)"] = KernelDensity(**KERNEL).fit(samples_relevant)
      return (
          estimators["P(relevant)"], estimators["p(position)"], estimators["p(position|relevant)"])
docs: Extracts density estimators from a judged sample of paragraph positions.
  
      Parameters
      ----------
      positions_all : dict of (Path, float)
          A sample of paragraph positions from various datasets in the NTCIR-11
          Math-2, and NTCIR-12 MathIR format.
      positions_relevant : dict of (Path, float)
          A sample of relevant paragraph positions from various datasets in the
          NTCIR-11 A subsample of relevant paragraph positions.
  
      Returns
      -------
      (float, KernelDensity, KernelDensity)
          An estimate of P(relevant), and estimators of p(position), and p(position | relevant).