LoginSignup
0
0

More than 3 years have passed since last update.

Kaggle:Introduction to Manual Feature Engineering その2

Posted at

列(Series)がどのデータタイプかをざっくり知りたい時は

df.dtypes

よく忘れる。

agg_funcやcount_categoricalなど
なんでも関数にしていくというのは、見やすさでも再利用という点でも優れていると思うが、特徴量エンジニアリングで果たしてそこまで関数化する必要があるかというとまだ実感はできていない。が、これもロングランでcompetitionを戦っていくのは必須なんだろうという想像はつく。

pandaでgroupbyしてaggrigationを"mean"に指定すると、どのレベルで平均を取っているのがイマイチ掴みづらい。。
が、途中でcategoricalのaggrigationをしているところで、

categorical[categorical['SK_ID_CURR'] == 100001]

と7つ行があり、

categorical.groupby('SK_ID_CURR').agg(['sum', "count",'mean'])

で、SK_ID_CURRが100001のデータはcountが7なのだから、
sumが3の列はmeanが0.428571、sumが7の列はmean=1という至極簡単なことであった。

The correlations between variables can show if we have collinear variables, that is, variables that are highly correlated with one another.

Often, we want to remove one in a pair of collinear variables because having both variables would be redundant.

ここらへんは何度もやったからなんとなく分かる。

download.png

targetでない変数同士のcorrelationsが高かったら冗長だから1個にしといたら、という話。多い分には学習が捗るような気もするのだが、そこはインプットが少ないうちは実際にfitさせて確かめられるのだ。
100個も200個もcorrelationsが相互に高いものがあったりしたら、確かにそれは「次元の呪い」的なものなのかもしれないが。

とはいいつつも

As the number of variables increases, the number of datapoints needed to learn the relationship between these variables and the target value increases exponentially.

などともある。datapointsとは・・?

欠損値を計算して今回は90%以上データがない場合はその特徴を消そう、ということになった。

続きは

  • Calculate Information for Testing Data

から。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0