Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tried creating a confusion matrix but kept getting errors #2

Open
YusraGasm opened this issue Sep 20, 2022 · 2 comments
Open

Tried creating a confusion matrix but kept getting errors #2

YusraGasm opened this issue Sep 20, 2022 · 2 comments

Comments

@YusraGasm
Copy link

Can you guide me on how to create a confusion matrix for the code?

@norahb
Copy link

norahb commented Feb 22, 2023

Hi,
How to get X and y out of test set?
If i place this code inside the loop to get precision, recall, and accuracy
it only show the confusion matrix of the last batch.

`for batch in test.as_numpy_iterator():
X, y = batch
yhat = model.predict(X)

pre.update_state(y, yhat)
re.update_state(y, yhat)
acc.update_state(y, yhat)

p_pred = yhat.flatten()
# extract the predicted class labels
y_pred = np.where(p_pred > 0.5, 1, 0)
m = confusion_matrix(y, y_pred)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@norahb @YusraGasm and others