Skip to content

Commit

Permalink
Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemDoum committed May 13, 2019
1 parent 9462eca commit 6ff0eea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 11 additions & 4 deletions docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,18 @@ the dataset we generated earlier:
engine.fit(dataset)
Note that the training of the engine is not deterministic by default. This
means that if you train your NLU twice on the same data you'll end up
the output of the NLU can be different.
Note that by default, the training of the engine is non-deterministic: if you
train your NLU twice on the same data and test it on the same input, you'll get
different outputs.

To
If you want to run training in a reproducible way you can pass a random seed to
your engine:

.. code-block:: python
seed = 42
engine = SnipsNLUEngine(config=CONFIG_EN, random_state=seed)
engine.fit(dataset)
Parsing
Expand Down
2 changes: 2 additions & 0 deletions snips_nlu/tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def test_nlu_engine_training_is_deterministic(self):

ref_log_reg, ref_crfs = None, None
for _ in range(num_runs):
# When
engine = SnipsNLUEngine(random_state=random_state).fit(dataset)
log_reg = _extract_log_reg(engine)
crfs = _extract_crfs(engine)
Expand All @@ -74,6 +75,7 @@ def test_nlu_engine_training_is_deterministic(self):
ref_log_reg = log_reg
ref_crfs = crfs
else:
# Then
self.assertDictEqual(ref_log_reg, log_reg)
self.assertDictEqual(ref_crfs, crfs)

Expand Down

0 comments on commit 6ff0eea

Please sign in to comment.