import pandas as pd
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Embedding, LSTM, Dense, Dropout, Bidirectional, GlobalMaxPooling1D
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from sklearn.metrics import classification_report, roc_auc_score

data['v1'] = data['v1'].astype(str)

data['v1'] = data['v1'].map({'ham': 0, 'spam': 1})

data = data.dropna(subset=['v1', 'v2'])

X_text = data['v2'].values.tolist()
y = data['v1'].values

X_train_text, X_test_text, y_train, y_test = train_test_split(
    X_text, y, test_size=0.2, random_state=42
)

tokenizer = Tokenizer()
tokenizer.fit_on_texts(X_train_text)

X_train_seq = tokenizer.texts_to_sequences(X_train_text)
X_test_seq = tokenizer.texts_to_sequences(X_test_text)

max_length = 200
X_train_padded = pad_sequences(X_train_seq, maxlen=max_length, padding='post')
X_test_padded = pad_sequences(X_test_seq, maxlen=max_length, padding='post')

model = Sequential()
model.add(Embedding(input_dim=len(tokenizer.word_index) + 1, output_dim=128, input_length=max_length))

model.add(Bidirectional(LSTM(64, return_sequences=True)))
model.add(Dropout(0.5))
model.add(LSTM(32, return_sequences=True))
model.add(Dropout(0.5))
model.add(GlobalMaxPooling1D())
model.add(Dense(1, activation='sigmoid'))

model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])

history = model.fit(
    X_train_padded,
    y_train,
    validation_split=0.2,
    epochs=10, 
    batch_size=32
)

test_loss, test_accuracy = model.evaluate(X_test_padded, y_test)
print(f'Test Loss: {test_loss:.4f}, Test Accuracy: {test_accuracy:.4f}')

y_pred = model.predict(X_test_padded)

print(classification_report(y_test, y_pred))

почему матрица не строится?
ошибка:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[46], line 57
     53 print(f'Test Loss: {test_loss:.4f}, Test Accuracy: {test_accuracy:.4f}')
     55 y_pred = model.predict(X_test_padded)
---> 57 print(classification_report(y_test, y_pred))

File c:\Users\usicc\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\utils\_param_validation.py:213, in validate_params.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    207 try:
    208     with config_context(
    209         skip_parameter_validation=(
    210             prefer_skip_nested_validation or global_skip_validation
    211         )
    212     ):
--> 213         return func(*args, **kwargs)
    214 except InvalidParameterError as e:
    215     # When the function is just a wrapper around an estimator, we allow
    216     # the function to delegate validation to the estimator, but we replace
    217     # the name of the estimator by the name of the function in the error
    218     # message to avoid confusion.
    219     msg = re.sub(
    220         r"parameter of \w+ must be",
    221         f"parameter of {func.__qualname__} must be",
    222         str(e),
    223     )

File c:\Users\usicc\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\metrics\_classification.py:2626, in classification_report(y_true, y_pred, labels, target_names, sample_weight, digits, output_dict, zero_division)
   2491 @validate_params(
   2492     {
   2493         "y_true": ["array-like", "sparse matrix"],
   (...)
   2517     zero_division="warn",
   2518 ):
   2519     """Build a text report showing the main classification metrics.
   2520 
   2521     Read more in the :ref:`User Guide <classification_report>`.
   (...)
   2623     <BLANKLINE>
   2624     """
-> 2626     y_type, y_true, y_pred = _check_targets(y_true, y_pred)
   2628     if labels is None:
   2629         labels = unique_labels(y_true, y_pred)

File c:\Users\usicc\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\metrics\_classification.py:112, in _check_targets(y_true, y_pred)
    109     y_type = {"multiclass"}
    111 if len(y_type) > 1:
--> 112     raise ValueError(
    113         "Classification metrics can't handle a mix of {0} and {1} targets".format(
    114             type_true, type_pred
    115         )
    116     )
    118 # We can't have more than one value on y_type => The set is no more needed
    119 y_type = y_type.pop()

ValueError: Classification metrics can't handle a mix of binary and continuous targets