TransWikia.com

Create a pipeline for recursive eliminartion using artifical neural nets

Data Science Asked by Kanan H Patel on March 19, 2021

I am trying to use RFE with Artificial neural nets but I am getting the error that "’Sequential’ object has no attribute ‘_get_tags’" . Here is my code snippet. Any help would be appreciated.

model_2 = Sequential([
    Dense(9, activation='linear'),                  
    Dense(200, activation=tf.keras.layers.LeakyReLU(alpha=0.3)), 
    Dense(1, activation='linear'),                                  
])

adam = keras.optimizers.Adam(lr=0.0001, beta_1=0.9, beta_2=0.999,epsilon=None, decay=0.0, amsgrad=False) 
model_2.compile(optimizer=adam,loss='mse',metrics=['accuracy'])

rfe = RFE(model_2, n_features_to_select=5)
pipeline = Pipeline(steps=[('s',rfe),('m',model_2)])

hist_2 = pipeline.fit(X2_train.iloc[:,10:20].values,     y2_train.iloc[:,1].to_numpy(),
    m__batch_size=10, m__epochs=4000,
    m__validation_data=(X2_test.iloc[:,10:20].values, y2_test.iloc[:,1]))

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP