Created
June 28, 2020 19:19
-
-
Save Younes-Charfaoui/ce9e1bc8e64fe7625eb792cabd331a7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import the pandas and James Stein encoders libraries. | |
| import pandas as pd | |
| from category_encoders import JamesSteinEncoder | |
| # get you data. | |
| data = pd.read_csv("yourData.csv") | |
| # create the encoder. | |
| encoder = JamesSteinEncoder(return_df=True) | |
| # fit and transform the data. | |
| new_x_train = encoder.fit_transform(x_train, y_train) | |
| new_x_test = encoder.transform(x_test, y_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment