Skip to content
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

Fitting a lm model #20

Open
chendaniely opened this issue Feb 15, 2020 · 0 comments
Open

Fitting a lm model #20

chendaniely opened this issue Feb 15, 2020 · 0 comments

Comments

@chendaniely
Copy link
Contributor

Right before "Your turn 2" in the 01-prediction slides (https://conf20-intro-ml.netlify.com/materials/01-predicting/)

You use the custom fit_dat function to fit the lm model

lm_spec <- 
   linear_reg() %>% # Pick linear regression
   set_engine(engine = "lm") # set engine

fit_data(Sale_Price ~ Gr_Liv_Area, model = lm_spec, data = ames)

You can also do it straight in parsnip now without using the custom fit_data function now

lm_spec <- parsnip::linear_reg() %>%
  parsnip::set_engine(engine = "lm")

parsnip::fit(lm_spec, Sale_Price ~ Gr_Liv_Area, data = ames)

It's even pipe-able!

Not sure if this is a new feature that was added or just to stay consistent with the trees/random forest slides later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant