Skip to content

Commit 84dfd05

Browse files
committed
Keep fixing documentation build fails due to precision in the output
1 parent ac19981 commit 84dfd05

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

autointent/modules/scoring/_linear.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class LinearScorer(ScoringModule):
2525
--------
2626
.. testcode::
2727
28+
import numpy as np
2829
from autointent.modules import LinearScorer
2930
scorer = LinearScorer(
3031
embedder_name="sergeyzh/rubert-tiny-turbo", cv=2
@@ -34,12 +35,13 @@ class LinearScorer(ScoringModule):
3435
scorer.fit(utterances, labels)
3536
test_utterances = ["hi", "bye"]
3637
probabilities = scorer.predict(test_utterances)
37-
print(probabilities)
38+
with np.printoptions(precision=4):
39+
print(probabilities)
3840
3941
.. testoutput::
4042
41-
[[0.50000032 0.49999968]
42-
[0.50000032 0.49999968]]
43+
[[0.5 0.5]]
44+
[0.5 0.5]]
4345
4446
"""
4547

autointent/modules/scoring/_mlknn/mlknn.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class MLKnnScorer(ScoringModule):
2424
2525
.. testcode::
2626
27+
import numpy as np
2728
from autointent.modules.scoring import MLKnnScorer
2829
utterances = ["what is your name?", "how are you?"]
2930
labels = [[1,0], [0,1]]
@@ -34,7 +35,8 @@ class MLKnnScorer(ScoringModule):
3435
scorer.fit(utterances, labels)
3536
test_utterances = ["Hi!", "What's up?"]
3637
probabilities = scorer.predict(test_utterances)
37-
print(probabilities) # Outputs predicted probabilities for each label
38+
with np.printoptions(precision=4):
39+
print(probabilities) # Outputs predicted probabilities for each label
3840
3941
.. testoutput::
4042

0 commit comments

Comments
 (0)