def render_plot( result: view_types.EvalResult, slicing_spec: Optional[Union[slicer.SingleSliceSpec, config_pb2.SlicingSpec]] = None, output_name: Optional[Text] = None, class_id: Optional[int] = None, top_k: Optional[int] = None, k: Optional[int] = None, label: Optional[Text] = None, ) -> Optional[visualization.PlotViewer]: # pytype: disable=invalid-annotation """Renders the plot view as widget. Args: result: An tfma.EvalResult. slicing_spec: The tfma.SlicingSpec to identify the slice. Show overall if unset. output_name: A string representing the output name. class_id: A number representing the class id if multi class. top_k: The k used to compute prediction in the top k position. k: The k used to compute prediciton at the kth position. label: A partial label used to match a set of plots in the results. Returns: A PlotViewer object if in Jupyter notebook; None if in Colab. """ if slicing_spec and isinstance(slicing_spec, config_pb2.SlicingSpec): slicing_spec = slicer.SingleSliceSpec(spec=slicing_spec) slice_spec_to_use = slicing_spec if slicing_spec else slicer.SingleSliceSpec( ) data, cfg = util.get_plot_data_and_config(result.plots, slice_spec_to_use, output_name, class_id, top_k, k, label) return visualization.render_plot(data, cfg)
def render_plot(result, slicing_spec=None): """Renders the plot view as widget. Args: result: An tfma.EvalResult. slicing_spec: The slicing spec to identify the slice. Show overall if unset. Returns: A PlotViewer object if in Jupyter notebook; None if in Colab. """ slice_spec_to_use = slicing_spec if slicing_spec else SingleSliceSpec() data, config = util.get_plot_data_and_config(result.plots, slice_spec_to_use) return visualization.render_plot(data, config)
def render_plot( result: model_eval_lib.EvalResult, slicing_spec: Optional[SingleSliceSpec] = None, label: Optional[Text] = None, ) -> Optional[visualization.PlotViewer]: """Renders the plot view as widget. Args: result: An tfma.EvalResult. slicing_spec: The slicing spec to identify the slice. Show overall if unset. label: A partial label used to match a set of plots in the results. Returns: A PlotViewer object if in Jupyter notebook; None if in Colab. """ slice_spec_to_use = slicing_spec if slicing_spec else SingleSliceSpec() data, config = util.get_plot_data_and_config(result.plots, slice_spec_to_use, label) return visualization.render_plot(data, config)