docs: def generate_samples(net: BayesNet,
                       sample_from: Iterable[Vertex],
                       sampling_algorithm: PosteriorSamplingAlgorithm = None,
                       drop: int = 0,
                       down_sample_interval: int = 1,
                       live_plot: bool = False,
                       refresh_every: int = 100,
                       ax: Any = None) -> sample_generator_types:
      """
      :param net: Bayesian Network containing latent variables.
      :param sample_from: Vertices to include in the returned samples.
      :param sampling_algorithm: The posterior sampling algorithm to use.
          Options are :class:`keanu.algorithm.MetropolisHastingsSampler` and :class:`keanu.algorithm.NUTSSampler`.
          If not set, :class:`keanu.algorithm.MetropolisHastingsSampler` is chosen with 'prior' as its proposal distribution.
      :param drop: The number of samples to drop before collecting anything.
          If this is zero then no samples will be dropped before collecting.
      :param down_sample_interval: Collect 1 sample for every `down_sample_interval`.
          If this is 1 then there will be no down-sampling.
          If this is 2 then every other sample will be taken.
          If this is 3 then 2 samples will be dropped before one is taken.
      :param live_plot: Flag for plotting the trace while sampling.
          Call `matplotlib.pyplot.show <https://matplotlib.org/api/_as_gen/matplotlib.pyplot.show.html>`_ to display the plot.
      :param refresh_every: Period of plot updates (in sample number).
      :param Axes ax: `matplotlib.axes.Axes <https://matplotlib.org/api/axes_api.html>`_.
          If not set, a new one is created.
  
      :raises ValueError: If `sample_from` contains vertices without labels.
  
      :return: Dictionary of samples at an index (tuple) for each vertex label (str). If all the vertices in `sample_from` are scalar, the dictionary is only keyed by label.
      """
      sample_from = list(sample_from)
      id_to_label = __check_if_vertices_are_labelled(sample_from)
  
      if sampling_algorithm is None:
          sampling_algorithm = MetropolisHastingsSampler(proposal_distribution="prior", latents=sample_from)
  
      vertices_unwrapped: JavaList = k.to_java_object_list(sample_from)
  
      probabilistic_model = ProbabilisticModel(net) if isinstance(
          sampling_algorithm, MetropolisHastingsSampler) else ProbabilisticModelWithGradient(net)
      samples: JavaObject = sampling_algorithm.get_sampler().generatePosteriorSamples(probabilistic_model.unwrap(),
                                                                                      vertices_unwrapped)
      samples = samples.dropCount(drop).downSampleInterval(down_sample_interval)
      sample_iterator: JavaObject = samples.stream().iterator()
  
      all_are_scalar = __all_scalar(sample_from)
  
      return _samples_generator(
          sample_iterator,
          vertices_unwrapped,
          live_plot=live_plot,
          refresh_every=refresh_every,
          ax=ax,
          all_scalar=all_are_scalar,
          id_to_label=id_to_label)