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
| def target_encode_multiclass(X,y): #X,y are pandas df and series | |
| y=y.astype(str) #convert to string to onehot encode | |
| enc=ce.OneHotEncoder().fit(y) | |
| y_onehot=enc.transform(y) | |
| class_names=y_onehot.columns #names of onehot encoded columns | |
| X_obj=X.select_dtypes('object') #separate categorical columns |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.