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
f7bf890b
Commit
f7bf890b
authored
5 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Making Linearized a transformer without FIT
parent
db39f302
No related branches found
No related tags found
1 merge request
!10
Making Linearized a transformer without FIT
Pipeline
#38365
failed
5 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/pipelines/mixins.py
+0
-1
0 additions, 1 deletion
bob/pipelines/mixins.py
bob/pipelines/transformers/linearize.py
+5
-9
5 additions, 9 deletions
bob/pipelines/transformers/linearize.py
with
5 additions
and
10 deletions
bob/pipelines/mixins.py
+
0
−
1
View file @
f7bf890b
...
...
@@ -222,7 +222,6 @@ class SampleMixin:
raise
ValueError
(
"
Type for sample not supported %s
"
%
type
(
samples
))
def
fit
(
self
,
samples
,
y
=
None
):
# if the super method is not fittable,
# there's no reason to stack those samples
if
hasattr
(
super
(),
"
fit
"
):
...
...
This diff is collapsed.
Click to expand it.
bob/pipelines/transformers/linearize.py
+
5
−
9
View file @
f7bf890b
...
...
@@ -4,21 +4,17 @@
from
bob.pipelines.mixins
import
CheckpointMixin
,
SampleMixin
from
sklearn.
preprocessing
import
Function
Transformer
from
sklearn.
base
import
Transformer
Mixin
import
numpy
as
np
def
linearize
(
X
):
X
=
np
.
asarray
(
X
)
return
np
.
reshape
(
X
,
(
X
.
shape
[
0
],
-
1
))
class
Linearize
(
FunctionTransformer
):
class
Linearize
(
TransformerMixin
):
"""
Extracts features by simply concatenating all elements of the data into one long vector.
"""
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
func
=
linearize
,
**
kwargs
)
def
transform
(
self
,
X
):
X
=
np
.
asarray
(
X
)
return
np
.
reshape
(
X
,
(
X
.
shape
[
0
],
-
1
))
class
SampleLinearize
(
SampleMixin
,
Linearize
):
...
...
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