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

NLP Exercise, step 5, solution code fails .check() #261

Open
MichelFloyd opened this issue Apr 3, 2020 · 0 comments
Open

NLP Exercise, step 5, solution code fails .check() #261

MichelFloyd opened this issue Apr 3, 2020 · 0 comments

Comments

@MichelFloyd
Copy link

If you run step_5.solution() you get:

def evaluate(model, texts, labels):
        # Get predictions from textcat model
        predicted_class = predict(model, texts)

        # From labels, get the true class as a list of integers (POSITIVE -> 1, NEGATIVE -> 0)
        true_class = [int(each['cats']['POSITIVE']) for each in labels]

        # A boolean or int array indicating correct predictions
        correct_predictions = predicted_class == true_class

        # The accuracy, number of correct predictions divided by all predictions
        accuracy = correct_predictions.mean()

        return accuracy

but if you use that and run step_5.check() it says incorrect. I can't find an answer to this question that passes step_5.check() even though many solutions seem correct and run correctly in the next step.

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

1 participant