# Code error in evaluation the model

does anyone can help on this?
from sklearn.metrics import f1_score, precision_score, recall_score
from sklearn.metrics import mean_squared_error, mean_absolute_error, f1_score, precision_score, recall_score
import time

# Evaluate the model on the test set

y_pred = model.predict(X_test)
y_pred = (y_pred > 0.5).astype(int) # Convert probabilities to binary predictions
print(“Unique values in y_test:”, np.unique(y_test))
print(“Unique values in y_pred:”, np.unique(y_pred))

# Calculate the metrics

precision = precision_score(y_test, y_pred)
recall = recall_score(y_test, y_pred)
f1 = f1_score(y_test, y_pred)
cm = confusion_matrix(y_test, y_pred)

# Calculate the error rate

error_rate = 1 - model.evaluate(X_test, y_test, verbose=0)[1]

# Print the results

print(f"Precision: {precision:.4f}“)
print(f"Recall: {recall:.4f}”)
print(f"F1-score: {f1:.4f}“)
print(“Confusion Matrix:”)
print(cm)
print(f"Error Rate: {error_rate:.4f}”)
print(f"Training time: {training_time:.2f} seconds")

## and I got this error: Unique values in y_test: [0. 1.] Unique values in y_pred: [0 1]

ValueError Traceback (most recent call last)
in
8 print(“Unique values in y_pred:”, np.unique(y_pred))
9 # Calculate the metrics
—> 10 precision = precision_score(y_test, y_pred)
11 recall = recall_score(y_test, y_pred)
12 f1 = f1_score(y_test, y_pred)

c:\Users\ayael\anaconda3\envs\tftf\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
61 extra_args = len(args) - len(all_args)
62 if extra_args <= 0:
—> 63 return f(*args, **kwargs)
64
65 # extra_args > 0

c:\Users\ayael\anaconda3\envs\tftf\lib\site-packages\sklearn\metrics_classification.py in precision_score(y_true, y_pred, labels, pos_label, average, sample_weight, zero_division)
1660 warn_for=(‘precision’,),
1661 sample_weight=sample_weight,
→ 1662 zero_division=zero_division)
1663 return p
1664

c:\Users\ayael\anaconda3\envs\tftf\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
61 extra_args = len(args) - len(all_args)

—> 93 “and {1} targets”.format(type_true, type_pred))
94
95 # We can’t have more than one value on y_type => The set is no more needed

ValueError: Classification metrics can’t handle a mix of binary and unknown targets

by chance are you working with hot-encoded data?