Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_box_plot_html(self, base_file_name: str) -> str:
singles = []
for impl in self.impls:
impl_val = self.impls[impl]
data = RunData({self.name: impl_val.run_data}, {"description": "{!r}|{}".format(self.input, impl)})
singles.append(SingleProperty(Single(data), data, self.name))
return self.boxplot_html(base_file_name, singles)
def _full_single_property_comp_table(self, property: str = None) -> '_Table':
header_cells = []
for single in self.stats.singles:
_single = SingleProperty(single, single.rundata, property) if property is not None else single
modal_id = self._short_summary_modal(_single)
header_cells.append(_Cell(self, content=self._obj_description(single), color_class_obj=single,
modal_id=modal_id))
table = _Table(self, header_cells, header_cells, _Cell(self, "vs."))
for i in range(self.stats.number_of_singles()):
for j in range(self.stats.number_of_singles()):
if i == j:
table[i, j] = _Cell(self)
continue
popover = _Popover(self, "Explanation", content="")
cell = None
pair = self.stats.get_pair(i, j)
rel_diff = None
if property is None:
popover.content = r"""
def boxplot_html_for_data(self, name: str, base_file_name: str, data: t.Dict[str, t.List[float]]):
singles = []
for var in data:
run_data = RunData({name: data[var]}, {"description": str(var)})
singles.append(SingleProperty(Single(run_data), run_data, name))
return self.boxplot_html(base_file_name, singles)
self._hist_data = {}
import matplotlib.pyplot as plt
import seaborn as sns
if fig_height is None:
fig_height = self._height_for_width(fig_width)
if self.is_single_valued():
descr = self.description()
if isinstance(self, SingleProperty):
descr += " [" + self.property + "]"
logging.error("Can't plot histogram for {} as it's only single valued.".format(self))
return
df = self.get_data_frame(**kwargs)
if other_objs:
typecheck(self, SingleProperty)
for obj in other_objs:
if obj.is_single_valued() or not isinstance(obj, SingleProperty):
logging.error("Can't additionally plot histogram for {} as it's only single valued.".format(self))
return
series_dict = {}
for (i, name) in enumerate(other_obj_names):
series_dict[name] = pd.Series(other_objs[i].data, name=name)
series_dict[own_name] = self.data
df = pd.DataFrame(series_dict, columns=sorted(list(series_dict.keys())))
df_t = df.T
show_legend = show_legend or (show_legend is None and len(df_t) > 1)
min_xval = min(map(min, df_t.values)) if zoom_in else 0
max_xval = max(map(max, df_t.values))
if type is None:
type = 'bar' if len(df_t) == 1 else 'stepfilled'
bin_count = self._freedman_diaconis_bins(*df_t.values)
bins = np.linspace(min_xval, max_xval, bin_count)
self.reset_plt()
:param y_label: if not None: shows the given y label
:param zoom_in: does the x axis start at the minimum x value?
:param kwargs: optional arguments passed to the get_data_frame method
:param other_objs: addional objects to plot on the same histogram (only SingleProperty objects allowed)
:param other_obj_names: names of the additional objects
:param own_name: used with other_objs option
"""
self.reset_plt()
self._hist_data = {}
import matplotlib.pyplot as plt
import seaborn as sns
if fig_height is None:
fig_height = self._height_for_width(fig_width)
if self.is_single_valued():
descr = self.description()
if isinstance(self, SingleProperty):
descr += " [" + self.property + "]"
logging.error("Can't plot histogram for {} as it's only single valued.".format(self))
return
df = self.get_data_frame(**kwargs)
if other_objs:
typecheck(self, SingleProperty)
for obj in other_objs:
if obj.is_single_valued() or not isinstance(obj, SingleProperty):
logging.error("Can't additionally plot histogram for {} as it's only single valued.".format(self))
return
series_dict = {}
for (i, name) in enumerate(other_obj_names):
series_dict[name] = pd.Series(other_objs[i].data, name=name)
series_dict[own_name] = self.data
df = pd.DataFrame(series_dict, columns=sorted(list(series_dict.keys())))
df_t = df.T
def get_single_property(self) -> SingleProperty:
assert self.run_data is not None
data = RunData({self.name: self.run_data})
return SingleProperty(Single(RunData({self.name: self.run_data})), data, self.name)
"""
self.reset_plt()
self._hist_data = {}
import matplotlib.pyplot as plt
import seaborn as sns
if fig_height is None:
fig_height = self._height_for_width(fig_width)
if self.is_single_valued():
descr = self.description()
if isinstance(self, SingleProperty):
descr += " [" + self.property + "]"
logging.error("Can't plot histogram for {} as it's only single valued.".format(self))
return
df = self.get_data_frame(**kwargs)
if other_objs:
typecheck(self, SingleProperty)
for obj in other_objs:
if obj.is_single_valued() or not isinstance(obj, SingleProperty):
logging.error("Can't additionally plot histogram for {} as it's only single valued.".format(self))
return
series_dict = {}
for (i, name) in enumerate(other_obj_names):
series_dict[name] = pd.Series(other_objs[i].data, name=name)
series_dict[own_name] = self.data
df = pd.DataFrame(series_dict, columns=sorted(list(series_dict.keys())))
df_t = df.T
show_legend = show_legend or (show_legend is None and len(df_t) > 1)
min_xval = min(map(min, df_t.values)) if zoom_in else 0
max_xval = max(map(max, df_t.values))
if type is None:
type = 'bar' if len(df_t) == 1 else 'stepfilled'
bin_count = self._freedman_diaconis_bins(*df_t.values)