ベーステーブルを探索する
モデル構築に入る前に、扱うデータを理解しておくことが重要です。この演習では、与えられたベーステーブルから母集団サイズ、ターゲット数、ターゲット発生率の求め方を学びます。
この演習はコースの一部です
Pythonで学ぶ予測分析入門
演習の手順
- ベーステーブルは pandas オブジェクト
basetableに読み込まれています。行数を変数population_sizeに代入し、出力してください。 - 値が 1 のターゲット数を変数
targets_countに代入し、出力してください。 - ターゲット発生率(
targets_countをpopulation_sizeで割った比)を出力してください。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Assign the number of rows in the basetable to the variable 'population_size'.
population_size = ____(____)
# Print the population size.
print(____)
# Assign the number of targets to the variable 'targets_count'.
targets_count = ____(____[____])
# Print the number of targets.
print(____)
# Print the target incidence.
print(____ / ____)