From a1661748889045be9f40bd8eed571768fa369fcb Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Mon, 23 Jan 2023 22:07:39 +0100 Subject: [PATCH] [Docs] Add documentation for FeatureSet.plot (#2956) * [Doc] Add documentation for FeatureSet.plot Add missing documentation for FeatureSet.plot * missing one param * solved comments --- mlrun/feature_store/feature_set.py | 23 ++++++++++++++++++++++- mlrun/serving/states.py | 12 ++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/mlrun/feature_store/feature_set.py b/mlrun/feature_store/feature_set.py index bf0bc6df67..4f4274c21d 100644 --- a/mlrun/feature_store/feature_set.py +++ b/mlrun/feature_store/feature_set.py @@ -787,7 +787,28 @@ def __setitem__(self, key, item): self._spec.features.update(item, key) def plot(self, filename=None, format=None, with_targets=False, **kw): - """generate graphviz plot""" + """plot/save graph using graphviz + + example:: + + import mlrun.feature_store as fstore + ... + ticks = fstore.FeatureSet("ticks", + entities=["stock"], + timestamp_key="timestamp") + ticks.add_aggregation(name='priceN', + column='price', + operations=['avg'], + windows=['1d'], + period='1h') + ticks.plot(rankdir="LR", with_targets=True) + + :param filename: target filepath for the graph image (None for the notebook) + :param format: the output format used for rendering (``'pdf'``, ``'png'``, etc.) + :param with_targets: show targets in the graph image + :param kw: kwargs passed to graphviz, e.g. rankdir=”LR” (see https://graphviz.org/doc/info/attrs.html) + :return: graphviz graph object + """ graph = self.spec.graph _, default_final_step, _ = graph.check_and_process_graph(allow_empty=True) targets = None diff --git a/mlrun/serving/states.py b/mlrun/serving/states.py index 56038d0c48..083d5b6284 100644 --- a/mlrun/serving/states.py +++ b/mlrun/serving/states.py @@ -1073,12 +1073,12 @@ def wait_for_completion(self): def plot(self, filename=None, format=None, source=None, targets=None, **kw): """plot/save graph using graphviz - :param filename: target filepath for the image (None for the notebook) - :param format: The output format used for rendering (``'pdf'``, ``'png'``, etc.) - :param source: source step to add to the graph - :param targets: list of target steps to add to the graph - :param kw: kwargs passed to graphviz, e.g. rankdir="LR" (see: https://graphviz.org/doc/info/attrs.html) - :return: graphviz graph object + :param filename: target filepath for the graph image (None for the notebook) + :param format: the output format used for rendering (``'pdf'``, ``'png'``, etc.) + :param source: source step to add to the graph image + :param targets: list of target steps to add to the graph image + :param kw: kwargs passed to graphviz, e.g. rankdir="LR" (see https://graphviz.org/doc/info/attrs.html) + :return: graphviz graph object """ return _generate_graphviz( self,