Skip to content

Commit

Permalink
Merge pull request #185 from Tqhuyen/patch-1
Browse files Browse the repository at this point in the history
Update h1st-graph.rst.txt

Thanks. Next time please describe the purpose of the PR a bit.
  • Loading branch information
ctn authored Feb 24, 2023
2 parents 1852836 + 7a83ec3 commit 728291e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/source/tutorials/quick-start/h1st-graph.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ number. The Action HelloPrinter is only passed the even-number data where the
model returned True.

.. code-block:: python
import h1st as h1
from h1st.model.model import Model
from h1st.h1flow.h1step import Action
class RuleBasedModel(Model):
"""
Simple rule-based model that "predicts" if a given value is an even number
"""
def process(self, input_data: dict) -> dict:
def predict(self, input_data: dict) -> dict:
predictions = [{'prediction': x % 2 == 0, 'value': x} for x in input_data["values"]]
return {"predictions": predictions}
Expand All @@ -51,7 +51,7 @@ The H1st graph itself is created by adding nodes incrementally.
# In the first Node, the data is passed to the RuleBasedModel's "process"
# method and a Decision is rendered from model output.
g.add(h1.Decision(RuleBasedModel(),
g.add(Decision(RuleBasedModel(),
result_field="predictions",
decision_field="prediction"))
Expand Down

0 comments on commit 728291e

Please sign in to comment.