平均発生率の計算
Predictor insight graph の表で最も重要な列は、ターゲットの発生率(target incidence)です。この列には、各グループにおけるターゲットの平均値が表示されます。
この演習はコースの一部です
Pythonで学ぶ予測分析入門
演習の手順
- 変数
targetとincomeのみを含む DataFramebasetable_incomeを作成します。 - この DataFrame を
incomeでグループ化します。 incomeの各グループについて、ターゲットの平均発生率を計算します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Select the income and target columns
basetable_income = basetable[["____","____"]]
# Group basetable_income by income
groups = basetable_income.____("____")
# Calculate the target incidence and print the result
incidence = groups["____"].agg(Incidence = '____').reset_index()
print(incidence)