LoslegenKostenlos loslegen

Passing two tests

Put yourself in the shoes of one of the university students. You have two tests coming up in different subjects, and you're running out of time to study. You want to know how much time you have to study each subject to maximize the probability of passing both tests. Fortunately, there's data that you can use.

For subject A, you already fitted a logistic model in model_A, and for subject B you fitted a model in model_B. As well as preloading LogisticRegression from sklearn.linear_model and numpy as np, expit(), the inverse of the logistic function, has been imported for you from scipy.special.

Diese Übung ist Teil des Kurses

Foundations of Probability in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Specify values to predict
hours_of_study_test_A = [[____], [____], [____], [____], [____]]

# Pass values to predict
predicted_outcomes_A = model_A.predict(____)
print(predicted_outcomes_A)

# Specify values to predict
hours_of_study_test_B = [[____], [____], [____], [____]]

# Pass values to predict
predicted_outcomes_B = model_B.____(____)
print(predicted_outcomes_B)
Code bearbeiten und ausführen