Skip to content

Commit

Permalink
name chunks so that weird figure switcheroo doesnt happen
Browse files Browse the repository at this point in the history
  • Loading branch information
christophM committed Mar 8, 2024
1 parent 53d41c3 commit dc8a7ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions manuscript/05-agnostic-decomposition.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $$y = \hat{f}(x_1, x_2) = 2 + e^{x_1} - x_2 + x_1 \cdot x_2$$
Think of the function as a machine learning model.
We can visualize the function with a 3D plot or a heatmap with contour lines:

```{r, fig.cap = "Prediction surface of a function with two features $X_1$ and $X_2$."}
```{r decomp-example, fig.cap = "Prediction surface of a function with two features $X_1$ and $X_2$."}
x1 = seq(from = -1, to = 1, length.out = 30)
x2 = seq(from = -1, to = 1, length.out = 30)
f = function(x1, x2){
Expand Down Expand Up @@ -64,7 +64,7 @@ The intercept is $\hat{f}_0\sim3.18$.
Since the other components are functions, we can visualize them:


```{r, fig.cap = "Decomposition of a function."}
```{r decomp-example-continued, fig.cap = "Decomposition of a function."}
pred.fun = function(model = NULL, newdata){
f(newdata$x1, newdata$x2)
}
Expand Down

0 comments on commit dc8a7ed

Please sign in to comment.