Example #1
0
 def plot(self) -> None:
     """Plot averaged Bar chart"""
     plotter.FrequencyBars(
         x=[k for k in self.features.keys()],
         y=[v / self.instance_counter for v in self.features.values()],
         plot_name=self.set_name,
         path=self.cache_path,
         title=self.set_name,
         x_name=self.set_name,
     )
Example #2
0
 def plot(self):
     sorted_dict = sorted(self.sample_counter.items(), key=lambda x: x[0])
     plotter.FrequencyBars(
         x=[x for (x, _) in sorted_dict],
         y=[y for (_, y) in sorted_dict],
         plot_name=self.set_name,
         path=self.log_path,
         title=self.set_name,
         x_name=self.set_name,
     )
     return
Example #3
0
 def plot(self) -> None:
     """
 Plot distribution.
 """
     plotter.FrequencyBars(
         x=[idx + self.min_idx for idx, _ in enumerate(self.distribution)],
         y=[v for v in self.distribution],
         plot_name="pmf_{}".format(self.set_name),
         path=self.log_path,
         title="pmf_{}".format(self.set_name),
         x_name=self.set_name,
     )
     plotter.FrequencyBars(
         x=[idx + self.min_idx for idx, _ in enumerate(self.pdf)],
         y=[v for v in self.pdf],
         plot_name="pdf_{}".format(self.set_name),
         path=self.log_path,
         title="pdf_{}".format(self.set_name),
         x_name=self.set_name,
     )
     return
Example #4
0
 def plot(self) -> None:
     """Plot bars of number of occurences."""
     sorted_dict = sorted(self.sample_counter.items(), key=lambda x: x[0])
     plotter.FrequencyBars(
         x=[x for (x, _) in sorted_dict],
         y=[y for (_, y) in sorted_dict],
         plot_name=self.set_name,
         path=self.cache_path,
         title=self.set_name,
         x_name=self.set_name,
     )
     return
Example #5
0
def rel_length_distribution(data) -> None:
    # 2) Relative hole length distribution.
    rhl_dist = {}
    for dp in data:
        rhl = dp.rel_hole_lengths
        try:
            rounded = int(100 * float(rhl))
            if rounded not in rhl_dist:
                rhl_dist[rounded] = 1
            else:
                rhl_dist[rounded] += 1
        except Exception:
            continue
    plt.FrequencyBars(
        x=list(rhl_dist.keys()),
        y=list(rhl_dist.values()),
        plot_name="perc_hole_length_distribution",
        path=pathlib.Path(FLAGS.eval_cand_db).absolute().parent,
        title="% hole length distribution",
        x_name="percentile",
    )
    return