Hello all,

I hope I am writing to the correct mailing list about this issue that I am
having. Please apologize me if I am not.

I am attempting to use a pipeline to feed an ensemble voting classifier as
I want the ensemble learner to use models that train on different feature
sets. For this purpose, I followed the tutorial available at [1].

Following is the code that I could develop so far.























*y = df1.indexx = preprocessing.scale(df1)phy_features = ['A', 'B',
'C']phy_transformer = Pipeline(steps=[('imputer',
SimpleImputer(strategy='median')), ('scaler',
StandardScaler())])phy_processer = ColumnTransformer(transformers=[('phy',
phy_transformer, phy_features)])fa_features = ['D', 'E', 'F']fa_transformer
= Pipeline(steps=[('imputer', SimpleImputer(strategy='median')), ('scaler',
StandardScaler())])fa_processer = ColumnTransformer(transformers=[('fa',
fa_transformer, fa_features)])pipe_phy = Pipeline(steps=[('preprocessor',
phy_processer ),('classifier', SVM)])pipe_fa =
Pipeline(steps=[('preprocessor', fa_processer ),('classifier', SVM)])ens =
VotingClassifier(estimators=[pipe_phy, pipe_fa])cv = KFold(n_splits=10,
random_state=None, shuffle=True)for train_index, test_index in
cv.split(x):    x_train, x_test = x[train_index], x[test_index]    y_train,
y_test = y[train_index], y[test_index]    ens.fit(x_train,y_train)
print(ens.score(x_test, y_test))*

However, when running the code, I am getting an error saying *TypeError:
argument of type 'ColumnTransformer' is not iterable*, at the line
*ens.fit(x_train,y_train).*

What is the reason for this and how can I fix it?

Thank you,
Chamila
_______________________________________________
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn

Reply via email to