Making Linearized a transformer without FIT

parent db39f302
Pipeline #38365 failed with stage
in 4 minutes and 7 seconds
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment