I'm trying to attack my random forest classifier.
clf = RandomForestClassifier(max_features="sqrt", n_estimators=500, n_jobs=-1, verbose=1, warm_start=True)
clf.fit(X_train, y_train)
After this definition I do my predictions and after that I did the code below:
from keras import backend
from cleverhans.utils_keras import KerasModelWrapper
from cleverhans.attacks import FastGradientMethod
sess = backend.get_session()
wrap = KerasModelWrapper(clf)
fgsm = FastGradientMethod(wrap, sess=sess)
fgsm_params = {'eps': 0.15,
'clip_min': 0.,
'clip_max': 1.}
adv_x = fgsm.generate_np(X_test, **fgsm_params)
adv_x.shape
And at --> 10 adv_x = fgsm.generate_np(X_test, **fgsm_params) I get an attribute error.
AttributeError: 'RandomForestClassifier' object has no attribute 'layers'
I mean, my classifier does not have layers but how can I do this fgsm attack? Is there a way to add randomforestclassifier to sequential model to have layers? Or is there another way to attack?