{"action":"created","issue":{"url":"https://api.github.com/repos/jurrr/modelplotr/issues/6","repository_url":"https://api.github.com/repos/jurrr/modelplotr","labels_url":"https://api.github.com/repos/jurrr/modelplotr/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/jurrr/modelplotr/issues/6/comments","events_url":"https://api.github.com/repos/jurrr/modelplotr/issues/6/events","html_url":"https://github.com/jurrr/modelplotr/issues/6","id":364379807,"node_id":"MDU6SXNzdWUzNjQzNzk4MDc=","number":6,"title":"Do you have plan to support caret?","user":{"login":"statkclee","id":5325425,"node_id":"MDQ6VXNlcjUzMjU0MjU=","avatar_url":"https://avatars0.githubusercontent.com/u/5325425?v=4","gravatar_id":"","url":"https://api.github.com/users/statkclee","html_url":"https://github.com/statkclee","followers_url":"https://api.github.com/users/statkclee/followers","following_url":"https://api.github.com/users/statkclee/following{/other_user}","gists_url":"https://api.github.com/users/statkclee/gists{/gist_id}","starred_url":"https://api.github.com/users/statkclee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/statkclee/subscriptions","organizations_url":"https://api.github.com/users/statkclee/orgs","repos_url":"https://api.github.com/users/statkclee/repos","events_url":"https://api.github.com/users/statkclee/events{/privacy}","received_events_url":"https://api.github.com/users/statkclee/received_events","type":"User","site_admin":false},"labels":[{"id":931583355,"node_id":"MDU6TGFiZWw5MzE1ODMzNTU=","url":"https://api.github.com/repos/jurrr/modelplotr/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"state":"closed","locked":false,"assignee":{"login":"jurrr","id":13237470,"node_id":"MDQ6VXNlcjEzMjM3NDcw","avatar_url":"https://avatars0.githubusercontent.com/u/13237470?v=4","gravatar_id":"","url":"https://api.github.com/users/jurrr","html_url":"https://github.com/jurrr","followers_url":"https://api.github.com/users/jurrr/followers","following_url":"https://api.github.com/users/jurrr/following{/other_user}","gists_url":"https://api.github.com/users/jurrr/gists{/gist_id}","starred_url":"https://api.github.com/users/jurrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jurrr/subscriptions","organizations_url":"https://api.github.com/users/jurrr/orgs","repos_url":"https://api.github.com/users/jurrr/repos","events_url":"https://api.github.com/users/jurrr/events{/privacy}","received_events_url":"https://api.github.com/users/jurrr/received_events","type":"User","site_admin":false},"assignees":[{"login":"jurrr","id":13237470,"node_id":"MDQ6VXNlcjEzMjM3NDcw","avatar_url":"https://avatars0.githubusercontent.com/u/13237470?v=4","gravatar_id":"","url":"https://api.github.com/users/jurrr","html_url":"https://github.com/jurrr","followers_url":"https://api.github.com/users/jurrr/followers","following_url":"https://api.github.com/users/jurrr/following{/other_user}","gists_url":"https://api.github.com/users/jurrr/gists{/gist_id}","starred_url":"https://api.github.com/users/jurrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jurrr/subscriptions","organizations_url":"https://api.github.com/users/jurrr/orgs","repos_url":"https://api.github.com/users/jurrr/repos","events_url":"https://api.github.com/users/jurrr/events{/privacy}","received_events_url":"https://api.github.com/users/jurrr/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-09-27T09:19:18Z","updated_at":"2018-11-05T07:57:03Z","closed_at":"2018-11-03T11:25:19Z","author_association":"NONE","body":"I've got the following error message... do you have any plan to support caret object?\r\n\r\n``` r\r\n# 0. 환경설정 -----\r\nlibrary(tidyverse)\r\n#> -- Attaching packages ------------------------------------------------------ tidyverse 1.2.1 --\r\n#> √ ggplot2 3.0.0     √ purrr   0.2.5\r\n#> √ tibble  1.4.2     √ dplyr   0.7.6\r\n#> √ tidyr   0.8.1     √ stringr 1.3.1\r\n#> √ readr   1.1.1     √ forcats 0.3.0\r\n#> -- Conflicts --------------------------------------------------------- tidyverse_conflicts() --\r\n#> x dplyr::filter() masks stats::filter()\r\n#> x dplyr::lag()    masks stats::lag()\r\nlibrary(caret)\r\n#> 필요한 패키지를 로딩중입니다: lattice\r\n#> \r\n#> 다음의 패키지를 부착합니다: 'caret'\r\n#> The following object is masked from 'package:purrr':\r\n#> \r\n#>     lift\r\nlibrary(modelplotr)  # devtools::install_github('modelplot/modelplotr')\r\n#> Package modelplotr loaded! Happy model plotting!\r\n\r\n# 1. 데이터 다운로드 ----- download.file(url =\r\n# 'https://archive.ics.uci.edu/ml/machine-learning-databases/00222/bank-additional.zip',\r\n# destfile = 'data//bank-additional.zip', mode='wb') # 1.1. 압축풀기 -----\r\n# unzip('data/bank-additional.zip', exdir='./data')\r\n\r\n# 1.2. 불러오기 -----\r\nbank_dat <- read_delim(\"data/bank-additional/bank-additional-full.csv\", delim = \";\", \r\n  col_types = cols(.default = col_character(), age = col_integer(), duration = col_integer(), \r\n    campaign = col_integer(), pdays = col_integer(), previous = col_integer(), \r\n    emp.var.rate = col_double(), cons.price.idx = col_double(), cons.conf.idx = col_double(), \r\n    euribor3m = col_double(), nr.employed = col_double()))\r\n\r\n\r\nbank_df <- bank_dat %>% select_(\"y\", \"duration\", \"campaign\", \"pdays\", \"previous\", \r\n  \"euribor3m\")\r\n\r\n\r\nbank_df <- bank_df %>% mutate(y = factor(y, levels = c(\"no\", \"yes\")))\r\n\r\nbank_df %>% count(y) %>% mutate(pcnt = n/sum(n))\r\n#> # A tibble: 2 x 3\r\n#>   y         n  pcnt\r\n#>   <fct> <int> <dbl>\r\n#> 1 no    36548 0.887\r\n#> 2 yes    4640 0.113\r\n\r\nlibrary(caret)\r\n\r\nbank_index <- createDataPartition(bank_df$y, times = 1, p = 0.3, list = FALSE)\r\n\r\ntrain_df <- bank_df[bank_index, ]\r\ntest_df <- bank_df[-bank_index, ]\r\n\r\ncv_folds <- createMultiFolds(train_df$y, k = 10, times = 3)\r\n\r\ncv_cntrl <- trainControl(method = \"repeatedcv\", number = 10, repeats = 3, index = cv_folds)\r\n\r\nlibrary(doSNOW)\r\n#> 필요한 패키지를 로딩중입니다: foreach\r\n#> \r\n#> 다음의 패키지를 부착합니다: 'foreach'\r\n#> The following objects are masked from 'package:purrr':\r\n#> \r\n#>     accumulate, when\r\n#> 필요한 패키지를 로딩중입니다: iterators\r\n#> 필요한 패키지를 로딩중입니다: snow\r\n\r\n# 실행시간\r\nstart.time <- Sys.time()\r\n\r\ncl <- makeCluster(4, type = \"SOCK\")\r\nregisterDoSNOW(cl)\r\n\r\nbank_rpart <- train(y ~ ., data = train_df, method = \"rpart\", trControl = cv_cntrl, \r\n  tuneLength = 7)\r\n\r\nbank_glm <- train(y ~ ., data = train_df, method = \"glm\", family = \"binomial\", \r\n  trControl = cv_cntrl, tuneLength = 7)\r\n\r\n\r\nstopCluster(cl)\r\n\r\ntotal.time <- Sys.time() - start.time\r\ntotal.time\r\n#> Time difference of 13.84579 secs\r\n\r\nbank_rpart_m <- bank_rpart$finalModel\r\nbank_glm_m <- bank_glm$finalModel\r\n\r\nplot(bank_rpart_m)\r\n```\r\n\r\n![](https://i.imgur.com/azebQqu.png)\r\n\r\n``` r\r\n\r\n\r\n# transform datasets and model objects into scored data and calculate\r\n# deciles\r\nprepare_scores_and_deciles(datasets = list(\"train_df\", \"test_df\"), dataset_labels = list(\"train_df\", \r\n  \"test_df\"), models = list(\"bank_glm_m\"), model_labels = list(\"GLM\"), target_column = \"y\")\r\n#> Error in prepare_scores_and_deciles(datasets = list(\"train_df\", \"test_df\"), : model objects need to be generated with mlr package\r\n\r\nplotting_scope(select_model_label = \"XGBoost\", select_dataset_label = \"test data\")\r\n#> Error in plotting_scope(select_model_label = \"XGBoost\", select_dataset_label = \"test data\"): prepared_input unavailable and input dataframe scores_and_deciles to create prepared_input\r\n#>           not available! First run prepare_scores_and_deciles() to generate scores_and_deciles.\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/jurrr/modelplotr/issues/comments/435784036","html_url":"https://github.com/jurrr/modelplotr/issues/6#issuecomment-435784036","issue_url":"https://api.github.com/repos/jurrr/modelplotr/issues/6","id":435784036,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTc4NDAzNg==","user":{"login":"statkclee","id":5325425,"node_id":"MDQ6VXNlcjUzMjU0MjU=","avatar_url":"https://avatars0.githubusercontent.com/u/5325425?v=4","gravatar_id":"","url":"https://api.github.com/users/statkclee","html_url":"https://github.com/statkclee","followers_url":"https://api.github.com/users/statkclee/followers","following_url":"https://api.github.com/users/statkclee/following{/other_user}","gists_url":"https://api.github.com/users/statkclee/gists{/gist_id}","starred_url":"https://api.github.com/users/statkclee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/statkclee/subscriptions","organizations_url":"https://api.github.com/users/statkclee/orgs","repos_url":"https://api.github.com/users/statkclee/repos","events_url":"https://api.github.com/users/statkclee/events{/privacy}","received_events_url":"https://api.github.com/users/statkclee/received_events","type":"User","site_admin":false},"created_at":"2018-11-05T07:57:03Z","updated_at":"2018-11-05T07:57:03Z","author_association":"NONE","body":"Excellent !!!"}}
{"actor":{"display_login":"statkclee"}}