Skip to content

Instantly share code, notes, and snippets.

@zero731
Created March 11, 2021 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zero731/fdd87ca871da4607a86747726443d364 to your computer and use it in GitHub Desktop.
Save zero731/fdd87ca871da4607a86747726443d364 to your computer and use it in GitHub Desktop.
fit preprocessing pipeline for example churn analysis
## Preprocess training and test data
X_train_tf = preprocessing.fit_transform(X_train)
X_test_tf = preprocessing.transform(X_test)
## Get the feature names in the order they appear in preprocessed data
feature_names = preprocessing.named_transformers_['cat'].named_steps['encoder'].get_feature_names(cat_col)
feature_names = np.r_[feature_names, num_cols, rem_cols]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment