Skip to content
Snippets Groups Projects
Commit f7bf890b authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Making Linearized a transformer without FIT

parent db39f302
No related branches found
No related tags found
1 merge request!10Making Linearized a transformer without FIT
Pipeline #38365 failed
......@@ -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"):
......
......@@ -4,21 +4,17 @@
from bob.pipelines.mixins import CheckpointMixin, SampleMixin
from sklearn.preprocessing import FunctionTransformer
from sklearn.base import TransformerMixin
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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment