Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Semantic Router
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
aurelio-labs
Semantic Router
Commits
0f1ecf70
Commit
0f1ecf70
authored
1 year ago
by
“Daniel Griffiths”
Browse files
Options
Downloads
Patches
Plain Diff
fix: added default values to tfidf tests
parent
6bd5da3b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unit/encoders/test_tfidf.py
+5
-4
5 additions, 4 deletions
tests/unit/encoders/test_tfidf.py
with
5 additions
and
4 deletions
tests/unit/encoders/test_tfidf.py
+
5
−
4
View file @
0f1ecf70
import
pytest
import
pytest
from
semantic_router.encoders
import
TfidfEncoder
from
semantic_router.encoders
import
TfidfEncoder
from
semantic_router.route
import
Route
from
semantic_router.route
import
Route
import
numpy
as
np
@pytest.fixture
@pytest.fixture
...
@@ -10,8 +11,8 @@ def tfidf_encoder():
...
@@ -10,8 +11,8 @@ def tfidf_encoder():
class
TestTfidfEncoder
:
class
TestTfidfEncoder
:
def
test_initialization
(
self
,
tfidf_encoder
):
def
test_initialization
(
self
,
tfidf_encoder
):
assert
tfidf_encoder
.
word_index
is
None
assert
tfidf_encoder
.
word_index
==
{}
assert
tfidf_encoder
.
idf
is
None
assert
(
tfidf_encoder
.
idf
==
np
.
array
([])).
all
()
def
test_fit
(
self
,
tfidf_encoder
):
def
test_fit
(
self
,
tfidf_encoder
):
routes
=
[
routes
=
[
...
@@ -21,8 +22,8 @@ class TestTfidfEncoder:
...
@@ -21,8 +22,8 @@ class TestTfidfEncoder:
)
)
]
]
tfidf_encoder
.
fit
(
routes
)
tfidf_encoder
.
fit
(
routes
)
assert
tfidf_encoder
.
word_index
is
not
None
assert
tfidf_encoder
.
word_index
!=
{}
assert
tfidf_encoder
.
idf
is
not
None
assert
not
np
.
array_equal
(
tfidf_encoder
.
idf
,
np
.
array
([]))
def
test_call_method
(
self
,
tfidf_encoder
):
def
test_call_method
(
self
,
tfidf_encoder
):
routes
=
[
routes
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment