Share via


mutualInformation: modalità di informazione reciproca per la selezione di funzionalità

Modalità informativa reciproca di selezione delle funzionalità usata nella trasformazione della selezione delle funzionalità selectFeatures.

Utilizzo

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

Arguments

numFeaturesToKeep

Se il numero di caratteristiche da mantenere deve essere n, la trasformazione seleziona le caratteristiche n con l'informazione mutua più elevata tra quelle con la variabile dipendente. Il valore predefinito è 1000.

numBins

Numero massimo di bin per i valori numerici. Sono consigliati multipli di 2. Il valore predefinito è 256.

...

Argomenti aggiuntivi da passare direttamente al motore di calcolo Microsoft.

Dettagli

L'informazione mutua di due variabili casuali X e Y è una misura della dipendenza reciproca tra le variabili. Formalmente, l'informazione mutua può essere scritta come:

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

dove l'aspettativa deriva dalla distribuzione congiunta di X e Y. p(x,y) è la funzione di densità di probabilità congiunta di X e Y; p(x) e p(y) sono rispettivamente le funzioni di densità di probabilità marginale di X e Y. In generale, un'informazione mutua più elevata tra la variabile dipendente (o etichetta) e una variabile indipendente (o caratteristica) significa che l'etichetta ha una dipendenza mutua superiore rispetto alla caratteristica.

La modalità di selezione della caratteristica di informazione mutua seleziona le caratteristiche in base all'informazione mutua. Mantiene le principali caratteristiche numFeaturesToKeep con l'informazione mutua più elevata e con etichetta.

Valore

stringa di caratteri che definisce la modalità.

Autore/i

Microsoft Corporation Microsoft Technical Support

Riferimenti

Wikipedia: Mutual Information

Vedi anche

minCountselectFeatures

Esempi


 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)