dardenkyle / Credit-Card-Users-Churn-Prediction

Analyze the data and come up with a predictive model to determine if a customer will leave the credit card services or not and the reason behind it
0 stars 0 forks source link

Can you help me here? thanks #1

Open rgupta1234 opened 3 months ago

rgupta1234 commented 3 months ago

name 'model_performance_classification_sklearn' is not defined


NameError Traceback (most recent call last) in <cell line: 2>() 1 # Checking the tuned model's performance metrics on the validation data. ----> 2 model_performance_classification_sklearn(Ada_org_tuned, X_val, y_val)

NameError: name 'model_performance_classification_sklearn' is not defined

dardenkyle commented 3 months ago

Have you ran the code block defining the function model_performance_classification_sklearn()?

My first guess is the function hasn't been defined.

rgupta1234 commented 3 months ago

Thanks, I don't see it defined in your notebook? can you paste it here?

On Tue, Jun 18, 2024 at 12:11 PM Kyle Darden @.***> wrote:

Have you ran the code block defining the function model_performance_classification_sklearn()?

My first guess is the function hasn't been defined.

— Reply to this email directly, view it on GitHub https://github.com/dardenkyle/Credit-Card-Users-Churn-Prediction/issues/1#issuecomment-2176589568, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASDNZLDEX6B5W4QBBMRTPLZIBS3XAVCNFSM6AAAAABJQN72KCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZWGU4DSNJWHA . You are receiving this because you authored the thread.Message ID: @.*** com>

-- Ravi Gupta Solutions Architect 773-544-6894 Austin Texas https://www.redhat.com/en

dardenkyle commented 3 months ago

Defining a function to compute different metrics to check performance of a classification model built using sklearn.

def model_performance_classification_sklearn(model, predictors, target): """ Function to compute different metrics to check classification model performance

model: classifier
predictors: independent variables
target: dependent variable
"""

# Predicting using the independent variables.
pred = model.predict(predictors)

acc = accuracy_score(target, pred)  # To compute Accuracy.
recall = recall_score(target, pred)  # To compute Recall.
precision = precision_score(target, pred)  # To compute Precision.
f1 = f1_score(target, pred)  # To compute F1-score.

# Creating a dataframe of metrics.
df_perf = pd.DataFrame(
    {
        "Accuracy": acc,
        "Recall": recall,
        "Precision": precision,
        "F1": f1

    },
    index=[0],
)

return df_perf

Its posting is weird on the comments.. it should be code block 721
rgupta1234 commented 3 months ago

Thank you so much

On Tue, Jun 18, 2024 at 12:20 PM Kyle Darden @.***> wrote:

Defining a function to compute different metrics to check performance of a classification model built using sklearn.

def model_performance_classification_sklearn(model, predictors, target): """ Function to compute different metrics to check classification model performance

model: classifier predictors: independent variables target: dependent variable """

Predicting using the independent variables.

pred = model.predict(predictors)

acc = accuracy_score(target, pred) # To compute Accuracy. recall = recall_score(target, pred) # To compute Recall. precision = precision_score(target, pred) # To compute Precision. f1 = f1_score(target, pred) # To compute F1-score.

Creating a dataframe of metrics.

df_perf = pd.DataFrame( { "Accuracy": acc, "Recall": recall, "Precision": precision, "F1": f1

},
index=[0],

)

return df_perf

Its posting is weird on the comments.. it should be code block 721

— Reply to this email directly, view it on GitHub https://github.com/dardenkyle/Credit-Card-Users-Churn-Prediction/issues/1#issuecomment-2176604217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASDNZJBMJ5DQG2KDDKENZ3ZIBT4HAVCNFSM6AAAAABJQN72KCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZWGYYDIMRRG4 . You are receiving this because you authored the thread.Message ID: @.*** com>

-- Ravi Gupta Solutions Architect 773-544-6894 Austin Texas https://www.redhat.com/en

dardenkyle commented 3 months ago

For sure!

On Jun 18, 2024, at 12:39 PM, rgupta1234 @.***> wrote:



Thank you so much

On Tue, Jun 18, 2024 at 12:20 PM Kyle Darden @.***> wrote:

Defining a function to compute different metrics to check performance of a classification model built using sklearn.

def model_performance_classification_sklearn(model, predictors, target): """ Function to compute different metrics to check classification model performance

model: classifier predictors: independent variables target: dependent variable """

Predicting using the independent variables.

pred = model.predict(predictors)

acc = accuracy_score(target, pred) # To compute Accuracy. recall = recall_score(target, pred) # To compute Recall. precision = precision_score(target, pred) # To compute Precision. f1 = f1_score(target, pred) # To compute F1-score.

Creating a dataframe of metrics.

df_perf = pd.DataFrame( { "Accuracy": acc, "Recall": recall, "Precision": precision, "F1": f1

}, index=[0], )

return df_perf

Its posting is weird on the comments.. it should be code block 721

— Reply to this email directly, view it on GitHub https://github.com/dardenkyle/Credit-Card-Users-Churn-Prediction/issues/1#issuecomment-2176604217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASDNZJBMJ5DQG2KDDKENZ3ZIBT4HAVCNFSM6AAAAABJQN72KCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZWGYYDIMRRG4 . You are receiving this because you authored the thread.Message ID: @.*** com>

-- Ravi Gupta Solutions Architect 773-544-6894 Austin Texas https://www.redhat.com/en

— Reply to this email directly, view it on GitHubhttps://github.com/dardenkyle/Credit-Card-Users-Churn-Prediction/issues/1#issuecomment-2176635979, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACRCH6QELKZOSQMUYWKJQHDZIBWFDAVCNFSM6AAAAABJQN72KCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZWGYZTKOJXHE. You are receiving this because you commented.Message ID: @.***>