Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pipelines
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.pipelines
Commits
dbb91073
Commit
dbb91073
authored
4 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
[nose] Improved test case
[nose] Improved test case
parent
9a3d419a
No related branches found
No related tags found
1 merge request
!48
Improvements on CheckpointWrapper
Pipeline
#45919
passed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/pipelines/tests/test_wrappers.py
+15
-9
15 additions, 9 deletions
bob/pipelines/tests/test_wrappers.py
with
15 additions
and
9 deletions
bob/pipelines/tests/test_wrappers.py
+
15
−
9
View file @
dbb91073
...
@@ -13,6 +13,7 @@ from sklearn.utils.validation import check_array
...
@@ -13,6 +13,7 @@ from sklearn.utils.validation import check_array
from
sklearn.utils.validation
import
check_is_fitted
from
sklearn.utils.validation
import
check_is_fitted
from
bob.pipelines.utils
import
hash_string
from
bob.pipelines.utils
import
hash_string
import
bob.pipelines
as
mario
import
bob.pipelines
as
mario
import
tempfile
def
_offset_add_func
(
X
,
offset
=
1
):
def
_offset_add_func
(
X
,
offset
=
1
):
...
@@ -176,15 +177,20 @@ def test_checkpoint_function_sample_transfomer():
...
@@ -176,15 +177,20 @@ def test_checkpoint_function_sample_transfomer():
_assert_all_close_numpy_array
(
oracle
,
[
s
.
data
for
s
in
features
])
_assert_all_close_numpy_array
(
oracle
,
[
s
.
data
for
s
in
features
])
# test when both model_path and features_dir is None
# test when both model_path and features_dir is None
transformer
=
mario
.
wrap
(
with
tempfile
.
TemporaryDirectory
()
as
dir_name
:
[
FunctionTransformer
,
"
sample
"
,
"
checkpoint
"
],
transformer
=
mario
.
wrap
(
func
=
_offset_add_func
,
[
FunctionTransformer
,
"
sample
"
,
"
checkpoint
"
],
kw_args
=
dict
(
offset
=
offset
),
func
=
_offset_add_func
,
validate
=
True
,
kw_args
=
dict
(
offset
=
offset
),
hash_fn
=
hash_string
,
validate
=
True
,
)
features_dir
=
dir_name
,
features
=
transformer
.
transform
(
samples
)
hash_fn
=
hash_string
,
_assert_all_close_numpy_array
(
oracle
,
[
s
.
data
for
s
in
features
])
)
features
=
transformer
.
transform
(
samples
)
# Checking if we have 8 chars in the second level
assert
len
(
features
[
0
].
load
.
args
[
0
].
split
(
"
/
"
)[
-
2
])
==
8
_assert_all_close_numpy_array
(
oracle
,
[
s
.
data
for
s
in
features
])
def
test_checkpoint_fittable_sample_transformer
():
def
test_checkpoint_fittable_sample_transformer
():
...
...
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