Modellleistung bewerten
Um zu testen, welcher Ansatz besser ist — das Modell mit dem gesamten Datensatz oder die Modelle für jede Hausalterskategorie — musst du einige Kennzahlen berechnen. Hier vergleichst du das Bestimmtheitsmaß und den Residual Standard Error für jedes Modell.
Vier Modelle von Preis gegenüber Anzahl der Convenience Stores (mdl_all_ages, mdl_0_to_15, mdl_15_to_30 und mdl_30_to_45) stehen zur Verfügung.
Diese Übung ist Teil des Kurses
<Kurs>Fortgeschrittene Regression mit statsmodels in Python</Kurs>Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Print the coeff. of determination for mdl_all_ages
print("R-squared for mdl_all_ages: ", ____)
# Print the coeff. of determination for mdl_0_to_15
print("R-squared for mdl_0_to_15: ", ____)
# Print the coeff. of determination for mdl_15_to_30
print("R-squared for mdl_15_to_30: ", ____)
# Print the coeff. of determination for mdl_30_to_45
print("R-squared for mdl_30_to_45: ", ____)