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
Merge requests
!10
"README.md" did not exist on "9a6771beb44662c6eb7b257dc0f92eeb001809db"
Making Linearized a transformer without FIT
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Making Linearized a transformer without FIT
linearize-fit
into
master
Overview
1
Commits
1
Pipelines
1
Changes
2
Closed
Tiago de Freitas Pereira
requested to merge
linearize-fit
into
master
5 years ago
Overview
1
Commits
1
Pipelines
1
Changes
2
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
f7bf890b
1 commit,
5 years ago
2 files
+
5
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
bob/pipelines/transformers/linearize.py
+
5
−
9
Options
@@ -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
):
Loading