There are variables X_train, X_test, y_train, y_test created through sklearn train_test_split. They contain text data in string format. Convert them to float numbers.
X_train = [['a', 'b'], ['c', 'd']] y_train = ['a', 'b'] X_test = [['a', 'b'], ['c', 'd']] y_test = ['a', 'b'] def convert_to_float(text_data): return text_data.astype(float) X_train = convert_to_float(X_train) y_train = convert_to_float(y_train)