mutualInformation: 特徴選択の相互情報量モード

特徴選択変換 selectFeatures で使用される特徴選択の相互情報量モード。

使用方法

  mutualInformation(numFeaturesToKeep = 1000, numBins = 256, ...)

引数

numFeaturesToKeep

保持する特徴の数が n に指定されている場合、変換では、従属変数との間で最も高い相互情報量を持つ n 個の特徴が選択されます。 既定値は 1000 です。

numBins

数値のビンの最大数。 2 の累乗をお勧めします。 既定値は 256 です。

...

Microsoft コンピューティング エンジンに直接渡される追加の引数。

説明

2 つのランダムな変数 XY の相互情報量は、変数間の相互の依存関係の尺度です。 正式には、相互情報量は次のように記述できます。

I(X;Y) = E[log(p(x,y)) - log(p(x)) - log(p(y))]

ただし、予測は XY の結合分布上で行われます。 ここで、p(x,y)XY の結合確率密度関数、p(x)p(y) はそれぞれ、XY の周辺確率密度関数です。 一般に、従属変数 (またはラベル) と独立変数 (または特徴) の間の相互情報量が大きい場合は、ラベルとその特徴の相互依存関係が強いことを意味します。

相互情報量特徴選択モードでは、相互情報量に基づいて特徴が選択されます。 ラベルとの間で最大の相互情報量を持つ上位 numFeaturesToKeep 個の特徴が保持されます。

モードを定義する文字列。

作成者

Microsoft Corporation Microsoft Technical Support

リファレンス

Wikipedia: Mutual Information

こちらもご覧ください

minCountselectFeatures


 trainReviews <- data.frame(review = c( 
         "This is great",
         "I hate it",
         "Love it",
         "Do not like it",
         "Really like it",
         "I hate it",
         "I like it a lot",
         "I kind of hate it",
         "I do like it",
         "I really hate it",
         "It is very good",
         "I hate it a bunch",
         "I love it a bunch",
         "I hate it",
         "I like it very much",
         "I hate it very much.",
         "I really do love it",
         "I really do hate it",
         "Love it!",
         "Hate it!",
         "I love it",
         "I hate it",
         "I love it",
         "I hate it",
         "I love it"),
      like = c(TRUE, FALSE, TRUE, FALSE, TRUE,
         FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE,
         FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, 
         FALSE, TRUE, FALSE, TRUE), stringsAsFactors = FALSE
     )

     testReviews <- data.frame(review = c(
         "This is great",
         "I hate it",
         "Love it",
         "Really like it",
         "I hate it",
         "I like it a lot",
         "I love it",
         "I do like it",
         "I really hate it",
         "I love it"), stringsAsFactors = FALSE)

 # Use a categorical hash transform which generated 128 features.
 outModel1 <- rxLogisticRegression(like~reviewCatHash, data = trainReviews, l1Weight = 0, 
     mlTransforms = list(categoricalHash(vars = c(reviewCatHash = "review"), hashBits = 7)))
 summary(outModel1)

 # Apply a categorical hash transform and a count feature selection transform
 # which selects only those hash features that has value.
 outModel2 <- rxLogisticRegression(like~reviewCatHash, data = trainReviews, l1Weight = 0, 
     mlTransforms = list(
   categoricalHash(vars = c(reviewCatHash = "review"), hashBits = 7), 
   selectFeatures("reviewCatHash", mode = minCount())))
 summary(outModel2)

 # Apply a categorical hash transform and a mutual information feature selection transform
 # which selects those features appearing with at least a count of 5.
 outModel3 <- rxLogisticRegression(like~reviewCatHash, data = trainReviews, l1Weight = 0, 
     mlTransforms = list(
   categoricalHash(vars = c(reviewCatHash = "review"), hashBits = 7), 
   selectFeatures("reviewCatHash", mode = minCount(count = 5))))
 summary(outModel3)