diff --git a/vignettes/ml100k.Rmd b/vignettes/ml100k.Rmd index 1b24fb1..c5ac496 100644 --- a/vignettes/ml100k.Rmd +++ b/vignettes/ml100k.Rmd @@ -57,15 +57,21 @@ After fitting the MFAI model, we can use the `getImportance()` function to obtai ```{r} # Get importance score -importance <- as.data.frame(getImportance(mfairObject, which_factors = 1:3)) +importance <- as.data.frame( + getImportance(mfairObject, which_factors = 1:3) +) importance$Genre <- rownames(importance) +# Convert the wide table to the long table importance_long <- melt( data = importance, id.vars = "Genre", variable.name = "Factor", value.name = "Importance" ) -importance_long$Genre <- factor(importance_long$Genre, levels = rev(colnames(X))) +importance_long$Genre <- factor( + importance_long$Genre, + levels = rev(colnames(X)) +) # head(importance_long) ``` @@ -126,15 +132,21 @@ mfairObject_pmt <- fitGreedy(mfairObject_pmt, ```{r} # Get importance score -importance_pmt <- as.data.frame(getImportance(mfairObject_pmt, which_factors = 1:3)) +importance_pmt <- as.data.frame( + getImportance(mfairObject_pmt, which_factors = 1:3) +) importance_pmt$Genre <- rownames(importance_pmt) +# Convert the wide table to the long table importance_pmt_long <- melt( data = importance_pmt, id.vars = "Genre", variable.name = "Factor", value.name = "Importance" ) -importance_pmt_long$Genre <- factor(importance_pmt_long$Genre, levels = rev(colnames(X_pmt))) +importance_pmt_long$Genre <- factor( + importance_pmt_long$Genre, + levels = rev(colnames(X_pmt)) +) # head(importance_pmt_long) # Visualize the importance score @@ -179,15 +191,21 @@ mfairObject_both <- fitGreedy(mfairObject_both, ```{r} # Get importance score -importance_both <- as.data.frame(getImportance(mfairObject_both, which_factors = 1:3)) +importance_both <- as.data.frame( + getImportance(mfairObject_both, which_factors = 1:3) +) importance_both$Genre <- rownames(importance_both) +# Convert the wide table to the long table importance_both_long <- melt( data = importance_both, id.vars = "Genre", variable.name = "Factor", value.name = "Importance" ) -importance_both_long$Genre <- factor(importance_both_long$Genre, levels = rev(colnames(X_both))) +importance_both_long$Genre <- factor( + importance_both_long$Genre, + levels = rev(colnames(X_both)) +) # head(importance_both_long) # Visualize the importance score diff --git a/vignettes/neocortex.Rmd b/vignettes/neocortex.Rmd index 0f5a6ec..1584486 100644 --- a/vignettes/neocortex.Rmd +++ b/vignettes/neocortex.Rmd @@ -101,7 +101,9 @@ p <- ggplot( data = FX_long, aes( x = `Time period`, y = F, - linetype = `Neocortex area`, colour = `Neocortex area`, group = `Neocortex area` + linetype = `Neocortex area`, + colour = `Neocortex area`, + group = `Neocortex area` ) ) + geom_line(linewidth = 0.5) +