Closed moloscripts closed 8 months ago
Hello @moloscripts 👋
Are you sure you are running all the code chunks in the chapter before getting to this point?
The errors comes because estimate
, .pred_1
in this case, ins't a factor. This should be the case if keras_predict()
was used
No, I started implementing the code chunks from 9.8 The full game LSTM. Should I start from 9.1?
You need a couple of code chunks before 9.8,
# Code from 8.1 to load in data and split it
kickstarter <- read_csv("https://github.com/EmilHvitfeldt/smltar/raw/master/data/kickstarter.csv.gz")
set.seed(1234)
kickstarter_split <- kickstarter %>%
filter(nchar(blurb) >= 15) %>%
initial_split()
kickstarter_train <- training(kickstarter_split)
kickstarter_test <- testing(kickstarter_split)
# 8.2.4 to get keras_predict()
keras_predict <- function(model, baked_data, response) {
predictions <- predict(model, baked_data)[, 1]
tibble(
.pred_1 = predictions,
.pred_class = if_else(.pred_1 < 0.5, 0, 1),
state = response
) %>%
mutate(across(c(state, .pred_class), ## create factors
~ factor(.x, levels = c(1, 0)))) ## with matching levels
}
Let me try it out
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.
Tips for a helpful bug report:
While implementing LSTM using this book - https://smltar.com/dllstm.html#lstmfull. I wanted to reproduce a confusion matrix based on the code in section 9.8 The full game LSTM Below is my code produced using reprex
I get an error on my terminal saying
Below is the screenshot of the whole error in my terminal. What could be wrong?