Skip to content

Commit

Permalink
[Docs] Add documentation for FeatureSet.plot (mlrun#2956)
Browse files Browse the repository at this point in the history
* [Doc] Add documentation for FeatureSet.plot

Add missing documentation for FeatureSet.plot

* missing one param

* solved comments
  • Loading branch information
george0st authored Jan 23, 2023
1 parent aa902ad commit a166174
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
23 changes: 22 additions & 1 deletion mlrun/feature_store/feature_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions mlrun/serving/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a166174

Please sign in to comment.