0
$\begingroup$

I am trying to used SMOTE and Feature Selection by following this paper http://jad.shahroodut.ac.ir/article_825_679b8f128dec2874a8fbc314fc922127.pdf

In this paper, the authors have mentioned about 4 scenarios. I took 2 scenarios as example.

  1. Scenario 3 (S3): using CFS, we select features from the sampled data, and create the training dataset based on the original data.
  2. Scenario 4 (S4): using CFS, we select features from the sampled data, and create the training dataset based on the sampled data.

The codes for the scenarios (data sampling and feature selection) are:

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)
sm = SMOTE(random_state=2)
X_train_res, y_train_res = sm.fit_sample(X_train, y_train.ravel())
select = SelectFromModel(LogisticRegression(class_weight='balanced',penalty="l1",C=0.01,solver='liblinear'))
X_ = select.fit_transform(X_train_res, y_train_res)
model = LogisticRegression(class_weight='balanced',penalty='l2',C=0.01).fit(X_,y_train_res)
y_preds = model.predict(X_)

My question is how could I create training data based on the samples or the original data as mentioned in the scenarios?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.