Skip to content

Commit

Permalink
Merge pull request #175 from slds-lmu/kl_ml_plot_corrections
Browse files Browse the repository at this point in the history
fix kl-ml plots and correct typo in info-ml slide
  • Loading branch information
chriskolb authored Jan 10, 2024
2 parents 70d83f4 + 985a910 commit 1631661
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified slides/information-theory/figure/kl_fitting_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ library(gridExtra)

# Define parameters for the Gaussian distributions
mean1 <- c(0, 0)
mean2 <- c(5, 5)
mean2 <- c(10, 10)
covariance <- matrix(c(1, 0, 0, 1), nrow = 2)

# Generate samples
Expand Down
3 changes: 2 additions & 1 deletion slides/information-theory/rsrc/make_kl_fitting_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ p2 <- ggplot(density_df, aes(x = value, y = density)) +
y = "Density") +
stat_function(fun = dnorm, args = list(mean = 2.5, sd = 3), aes(color = "q(x)")) +
scale_color_manual(name = "", values = c("p(x)" = "blue", "q(x)" = "red")) +
theme(legend.position = "right")
theme(legend.position = "right") +
ylim(0, 0.4)

plot = grid.arrange(p1, p2, ncol = 2, widths = c(1, 1.25))
ggsave("../figure/kl_fitting_plot.png", plot =plot, width = 8, height = 3)
2 changes: 1 addition & 1 deletion slides/information-theory/slides-info-ml.tex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
\end{vbframe}

\begin{vbframe}{KL vs Cross-Entropy Example}
Let $p(x)=N(0,1)$ and $q(x)=LP(0,3)$ and consider again
Let $p(x)=N(0,1)$ and $q(x)=LP(0,\sigma)$ and consider again
$$ \argmin_{\thetab} D_{KL}(p \| q_{\thetab}) = \argmin_{\thetab} -\E_{X \sim p} \log q(x|\thetab) = \argmin_{\thetab} H(p \| q_{\thetab}) $$

\begin{center}
Expand Down

0 comments on commit 1631661

Please sign in to comment.