Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.pipelines
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.pipelines
Commits
a201b15e
Commit
a201b15e
authored
Nov 25, 2020
by
Tiago de Freitas Pereira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sphinx] Updated examples
parent
e1b35e5b
Pipeline
#46064
passed with stage
in 3 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
doc/python/pipeline_example_dask.py
doc/python/pipeline_example_dask.py
+5
-3
doc/python/pipeline_example_dask_sge.py
doc/python/pipeline_example_dask_sge.py
+5
-3
doc/python/pipeline_example_dask_sge_adaptive.py
doc/python/pipeline_example_dask_sge_adaptive.py
+2
-2
No files found.
doc/python/pipeline_example_dask.py
View file @
a201b15e
...
...
@@ -25,7 +25,7 @@ class MyFitTranformer(TransformerMixin, BaseEstimator):
def
__init__
(
self
):
self
.
_fit_model
=
None
def
transform
(
self
,
X
):
def
transform
(
self
,
X
,
metadata
=
None
):
# Transform `X`
return
[
x
@
self
.
_fit_model
for
x
in
X
]
...
...
@@ -40,7 +40,7 @@ X = numpy.zeros((2, 2))
X_as_sample
=
[
Sample
(
X
,
key
=
str
(
i
),
metadata
=
1
)
for
i
in
range
(
10
)]
# Building an arbitrary pipeline
model_path
=
"
~
/dask_tmp"
model_path
=
"
.
/dask_tmp"
os
.
makedirs
(
model_path
,
exist_ok
=
True
)
pipeline
=
make_pipeline
(
MyTransformer
(),
MyFitTranformer
())
...
...
@@ -48,13 +48,15 @@ pipeline = make_pipeline(MyTransformer(), MyFitTranformer())
pipeline
=
bob
.
pipelines
.
wrap
(
[
"sample"
,
"checkpoint"
,
"dask"
],
pipeline
,
model_path
=
model_path
,
model_path
=
os
.
path
.
join
(
model_path
,
"model.pickle"
),
features_dir
=
model_path
,
transform_extra_arguments
=
((
"metadata"
,
"metadata"
),),
)
# Create a dask graph from a pipeline
# Run the task graph in the local computer in a single tread
X_transformed
=
pipeline
.
fit_transform
(
X_as_sample
).
compute
(
scheduler
=
"single-threaded"
)
import
shutil
shutil
.
rmtree
(
model_path
)
doc/python/pipeline_example_dask_sge.py
View file @
a201b15e
...
...
@@ -28,7 +28,7 @@ class MyFitTranformer(TransformerMixin, BaseEstimator):
def
__init__
(
self
):
self
.
_fit_model
=
None
def
transform
(
self
,
X
):
def
transform
(
self
,
X
,
metadata
=
None
):
# Transform `X`
return
[
x
@
self
.
_fit_model
for
x
in
X
]
...
...
@@ -43,7 +43,7 @@ X = numpy.zeros((2, 2))
X_as_sample
=
[
Sample
(
X
,
key
=
str
(
i
),
metadata
=
1
)
for
i
in
range
(
10
)]
# Building an arbitrary pipeline
model_path
=
"
~
/dask_tmp"
model_path
=
"
.
/dask_tmp"
os
.
makedirs
(
model_path
,
exist_ok
=
True
)
pipeline
=
make_pipeline
(
MyTransformer
(),
MyFitTranformer
())
...
...
@@ -51,7 +51,8 @@ pipeline = make_pipeline(MyTransformer(), MyFitTranformer())
pipeline
=
bob
.
pipelines
.
wrap
(
[
"sample"
,
"checkpoint"
,
"dask"
],
pipeline
,
model_path
=
model_path
,
model_path
=
os
.
path
.
join
(
model_path
,
"model.pickle"
),
features_dir
=
model_path
,
transform_extra_arguments
=
((
"metadata"
,
"metadata"
),),
)
...
...
@@ -62,6 +63,7 @@ client = Client(cluster) # Creating the scheduler
# Run the task graph in the local computer in a single tread
X_transformed
=
pipeline
.
fit_transform
(
X_as_sample
).
compute
(
scheduler
=
client
)
import
shutil
shutil
.
rmtree
(
model_path
)
doc/python/pipeline_example_dask_sge_adaptive.py
View file @
a201b15e
...
...
@@ -28,7 +28,7 @@ class MyFitTranformer(TransformerMixin, BaseEstimator):
def
__init__
(
self
):
self
.
_fit_model
=
None
def
transform
(
self
,
X
):
def
transform
(
self
,
X
,
metadata
=
None
):
# Transform `X`
return
[
x
@
self
.
_fit_model
for
x
in
X
]
...
...
@@ -43,7 +43,7 @@ X = numpy.zeros((2, 2))
X_as_sample
=
[
Sample
(
X
,
key
=
str
(
i
),
metadata
=
1
)
for
i
in
range
(
10
)]
# Building an arbitrary pipeline
model_path
=
"
~
/dask_tmp"
model_path
=
"
.
/dask_tmp"
os
.
makedirs
(
model_path
,
exist_ok
=
True
)
pipeline
=
make_pipeline
(
MyTransformer
(),
MyFitTranformer
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment