Machine Learning Project

Hi All,
Greetings !

This post is regarding " Machine Learning Project Walkthrough: Making Predictions:

I am getting an error while running the below code in Jupiter notebook.
saying "NameError: name ‘predictions’ is not defined"

Machine Learning Project Walkthrough: Making Predictions

import pandas as pd

False positives.

fp_filter = (predictions == 1) & (loans[“loan_status”] == 0)
fp = len(predictions[fp_filter])

True positives.

tp_filter = (predictions == 1) & (loans[“loan_status”] == 1)
tp = len(predictions[tp_filter])

False negatives.

fn_filter = (predictions == 0) & (loans[“loan_status”] == 1)
fn = len(predictions[fn_filter])

True negatives

tn_filter = (predictions == 0) & (loans[“loan_status”] == 0)
tn = len(predictions[tn_filter])

Could you please help me .

Appreciate your response.

Hi @up2027719 and welcome to the community!

Since this is your first post, you may want to read this post for some great tips on how to ask technical questions in the community. Specifically, can you please provide a link to the screen you’re working on? It’s also good practice to wrap your lines of code inside a pair of triple backticks (ie ```) so that it’s easier to read and indentation is preserved.

It appears you are getting this error because the variable predictions is not defined in your notebook. What data are you expecting this variable to contain? Do you have a line of code that starts with:

predictions = ...

With a bit more context, I’m sure we can figure this out together.