-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Description
library(tidymodels)
#> -- Attaching packages ------------------------------------------------------------------------- tidymodels 0.0.2 --
#> v broom 0.5.1 v purrr 0.2.5
#> v dials 0.0.2 v recipes 0.1.4
#> v dplyr 0.7.8 v rsample 0.0.4
#> v ggplot2 3.1.0 v tibble 2.0.1
#> v infer 0.4.0 v yardstick 0.0.2
#> v parsnip 0.0.1
#> -- Conflicts ---------------------------------------------------------------------------- tidymodels_conflicts() --
#> x purrr::discard() masks scales::discard()
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag() masks stats::lag()
#> x recipes::step() masks stats::step()
analysis=data.frame(target=sample(c(0,1),100,replace=T),
x1=rnorm(100),
x2=rnorm(100))
head(analysis)
#> target x1 x2
#> 1 1 -0.5611995 1.4630014
#> 2 1 1.7830997 -1.6015657
#> 3 1 1.2500967 -1.5411327
#> 4 1 -0.4197018 -0.4608742
#> 5 0 -0.4842685 0.1226822
#> 6 1 0.7493446 -1.2447351
dsplit <- initial_split(analysis, strata = 'target')
trn=training(dsplit)
tst=testing(dsplit)
lrm_fit <- logistic_reg() %>%
set_engine('glm') %>%
fit(target~x1+x2,data=trn)
lrm_fit %>%
predict(tst, type='prob')
#> Error: Columns 1, 2 must be named.
#> Use .name_repair to specify repair.Created on 2019-01-16 by the reprex package (v0.2.1)
Metadata
Metadata
Assignees
Labels
No labels