I'm using Decision Tree Classifier with class weights {0:0.2, 1:0.8}, but I got an error "Class label 1 not present.", can anyone help me to fix this problem? thank you.
There is the link to my code: https://colab.research.google.com/drive/1riuGXWXKnfH8GbqlpFV1RC41gn2mMtIn?usp=sharing
# Drop dependent variable from dataframe and create the X(independent variable) matrix
x = data.drop(columns = 'BAD')
# Create dummy variables for the categorical variables - Hint: use the get_dummies() function
x = pd.get_dummies(x, drop_first = True)
# Create y(dependent varibale)
y = data['BAD']
# Split the data into training and test set
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.3, random_state = 1)
#Defining Decision tree model with class weights class_weight={0: 0.2, 1: 0.8}
d_tree = DecisionTreeClassifier(class_weight = {0:0.2, 1:0.8})
#fitting Decision tree model
d_tree.fit(x_train, y_train)