Is it possible to apply the sklearn pipeline for deep learning like this:
clf = Pipeline(
steps=[("preprocessor", preprocessor), ("classifier", LogisticRegression())]
)
clf.fit(X_train, y_train)
If it's possible, then how can one do it? My code below produces the subsequent error:
def model():
ann = tf.keras.models.Sequential()
ann.add(tf.keras.layers.Dense(units=6, activation='relu'))
ann.add(tf.keras.layers.Dense(units=6, activation='relu'))
ann.add(tf.keras.layers.Dense(units=1, activation='sigmoid'))
ann.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
return ann
clf = Pipeline(
steps = [
('pre', preprocessor),
('ann', model())
]
)
clf.fit(X_train, y_train, batch_size = 32, epochs = 100)
Error:
ValueError: Pipeline.fit does not accept the batch_size parameter. You can pass parameters to specific steps of your pipeline using the stepname__parameter format, e.g.
Pipeline.fit(X, y, logisticregression__sample_weight=sample_weight)
.