-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stuck in replication example in Chapter 7 #176
Comments
Hello @melyale! I'm sorry to hear you are running into issues. Can you run the following code for me and tell me what you get? If you can make a reprex that would be great. If you've never heard of a reprex before, start by reading "What is a reprex", and follow the advice further down that page. library(tidyverse)
library(tidymodels)
library(textrecipes)
library(discrim)
complaints <- read_csv("https://raw.githubusercontent.com/emilhvitfeldt/smltar/master/data/complaints.csv.gz")
set.seed(1234)
complaints2class <- complaints %>%
mutate(product = factor(if_else(
product == paste("Credit reporting, credit repair services,",
"or other personal consumer reports"),
"Credit", "Other"
)))
complaints_split <- initial_split(complaints2class, strata = product)
complaints_train <- training(complaints_split)
complaints_test <- testing(complaints_split)
complaints_rec <-
recipe(product ~ consumer_complaint_narrative, data = complaints_train)
complaints_rec <- complaints_rec %>%
step_tokenize(consumer_complaint_narrative) %>%
step_tokenfilter(consumer_complaint_narrative, max_tokens = 1e3) %>%
step_tfidf(consumer_complaint_narrative)
complaint_wf <- workflow() %>%
add_recipe(complaints_rec)
nb_spec <- naive_Bayes() %>%
set_mode("classification") %>%
set_engine("naivebayes")
nb_fit <- complaint_wf %>%
add_model(nb_spec) %>%
fit(data = complaints_train)
|
Thanks for your message! Error in app$vspace(new_style$ I tried to make a reprex but I received the exact same message as well Error in app$vspace(new_style$ |
Hello, I am trying to replicate the first classification example in Chapter 7 but I receive an error.
I am trying to run this code
nb_fit <- complaint_wf %>%
add_model(nb_spec) %>%
fit(data = complaints_train)
But I am receiving the following error
Error in app$vspace(new_style$
margin-top
%||% 0) :attempt to apply non-function
Do you have an idea what can be happening? I am stuck in this part.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: