Giter Site home page Giter Site logo

brian-j-smith / machineshop Goto Github PK

View Code? Open in Web Editor NEW
62.0 8.0 10.0 14.28 MB

MachineShop: R package of models and tools for machine learning

Home Page: https://brian-j-smith.github.io/MachineShop/

R 98.16% C 0.16% TeX 1.68%
r machine-learning predictive-modeling classification-models regression-models survival-models

machineshop's People

Contributors

brian-j-smith avatar topepo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

machineshop's Issues

Documentation about outer loop in nested resampling

Maybe I missed it, but I could not find documentation about how the outer loop is being performed when nested resampling is done. I assume the inner loop is defined via one of the algorithms in section 9.1 in the user guide, e.g. via BootOptimismControl() or CVControl(). How can the outer loop be controlled or looked up?

BootOptimismControl not working on Linux

The following code that uses the optimism-corrected bootstrap resampling works on Windows and Mac OS, but not on Linux. Any idea what is going on (fyi, using CVControl() works under Linux)?

library(MachineShop, warn.conflicts = FALSE)
tuned_model <- TunedModel( 
  XGBTreeModel, 
  grid =  TuningGrid(), 
  control = BootOptimismControl()
)
MachineShop::fit(mpg ~ ., data = mtcars, model = tuned_model)
#> Error in .fit_optim(object, ...): Resampling failed for all models.
#> XGBTreeModel.1: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")
#> XGBTreeModel.2: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")
#> XGBTreeModel.3: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")
#> XGBTreeModel.4: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")
#> XGBTreeModel.5: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")
#> XGBTreeModel.6: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")
#> XGBTreeModel.7: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")
#> XGBTreeModel.8: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")
#> XGBTreeModel.9: `...` must be empty.
#> ✖ Problematic argument:
#> • group = case_comp_name(df, "groups")

sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: TUXEDO OS 2
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=de_DE.UTF-8    
#>  [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=de_DE.UTF-8   
#>  [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] MachineShop_3.6.2
#> 
#> loaded via a namespace (and not attached):
#>  [1] tidyr_1.3.0         splines_4.1.2       foreach_1.5.2      
#>  [4] prodlim_2023.08.28  stats4_4.1.2        coin_1.4-2         
#>  [7] yaml_2.3.7          progress_1.2.2      globals_0.16.2     
#> [10] ipred_0.9-14        pillar_1.9.0        lattice_0.20-45    
#> [13] glue_1.6.2          digest_0.6.33       hardhat_1.3.0      
#> [16] sandwich_3.0-2      colorspace_2.1-0    recipes_1.0.8      
#> [19] htmltools_0.5.6     Matrix_1.6-1        timeDate_4022.108  
#> [22] pkgconfig_2.0.3     DiceDesign_1.9      listenv_0.9.0      
#> [25] purrr_1.0.2         mvtnorm_1.2-3       scales_1.2.1       
#> [28] gower_1.0.1         lava_1.7.2.1        timechange_0.2.0   
#> [31] tibble_3.2.1        generics_0.1.3      ggplot2_3.4.3      
#> [34] party_1.3-13        TH.data_1.1-2       withr_2.5.0        
#> [37] furrr_0.3.1         nnet_7.3-17         cli_3.6.1          
#> [40] strucchange_1.5-3   survival_3.2-13     magrittr_2.0.3     
#> [43] crayon_1.5.2        polspline_1.1.23    evaluate_0.21      
#> [46] fs_1.6.3            future_1.33.0       fansi_1.0.4        
#> [49] parallelly_1.36.0   MASS_7.3-55         dials_1.2.0        
#> [52] class_7.3-20        tools_4.1.2         data.table_1.14.8  
#> [55] prettyunits_1.1.1   hms_1.1.3           multcomp_1.4-25    
#> [58] lifecycle_1.0.3     matrixStats_1.0.0   kernlab_0.9-32     
#> [61] rsample_1.2.0       munsell_0.5.0       reprex_2.0.2       
#> [64] compiler_4.1.2      rlang_1.1.1         grid_4.1.2         
#> [67] iterators_1.0.14    rstudioapi_0.15.0   rmarkdown_2.24     
#> [70] gtable_0.3.4        codetools_0.2-18    abind_1.4-5        
#> [73] R6_2.5.1            zoo_1.8-12          lubridate_1.9.2    
#> [76] knitr_1.44          dplyr_1.1.3         fastmap_1.1.1      
#> [79] future.apply_1.11.0 utf8_1.2.3          libcoin_1.0-9      
#> [82] modeltools_0.2-23   parallel_4.1.2      Rcpp_1.0.11        
#> [85] vctrs_0.6.3         rpart_4.1.16        tidyselect_1.2.0   
#> [88] xfun_0.40

Created on 2023-09-15 with reprex v2.0.2

Update to use print_step() instead of printer() in print methods

Hello 👋

In the most recent CRAN release of {recipes}, we took the first step towards updating the printing infrastructure to use {cli}. This means that in order for your steps to print properly when the next version of {recipes} gets on CRAN, you will need to have adopted this change as well. Failure to do so won't result in errors, only malformed printing. The change itself is fairly minimal. Please see the following PR tidymodels/recipes#871 for examples of how this change is to be done. Please let me know if you have any questions!

See example below:

# Old
print.step_pls <- function(x, width = max(20, options()$width - 35), ...) {
  cat("PLS feature extraction with ")
  printer(x$columns, x$terms, x$trained, width = width)
  invisible(x)
}

# New
print.step_pls <- function(x, width = max(20, options()$width - 35), ...) {
  title <- "PLS feature extraction with "
  print_step(x$columns, x$terms, x$trained, width = width, title = title)
  invisible(x)
}

prep.ModelRecipe() skips prep.recipe()

Hi there! We've made a few changes in recipes to fully support modern tidyselect. You can see that PR here
tidymodels/recipes#595

In the process, we slightly tweaked bake() to more directly use an element of a prepped recipe called $last_term_info. This element is only added to the recipe at prep() time, and is something we now left_join() against in bake().

It seems that prep.ModelRecipe() can skip the call to prep() if the recipe looks fully trained.

prep.ModelRecipe <- function(x, ...) {
if (!recipes::fully_trained(x)) {
x <- new(class(x), prep(as(x, "recipe"), retain = FALSE))
case_name_var <- "(names)"
x$template[[case_name_var]] <- as.character(x$template[[case_name_var]])
x$orig_lvls[[case_name_var]] <- list(values = NA, ordered = NA)
x$levels[[case_name_var]] <- x$orig_lvls[[case_name_var]]
}
x
}

For better or worse, a recipe looks fully trained if there are 0 steps, which means that prep.recipe() won't be called in those cases - meaning that $last_term_info won't get added onto the recipe. This causes this failure in our revdeps
tidymodels/recipes#595 (comment)

Is there any way you can just let prep.recipe() get called unconditionally in prep.ModelRecipe()?

As an FYI, we plan to submit recipes to CRAN fairly soon.

neural network with mnist

Hi,
The model gives an error in the neural network operation of the mnist data. Could the model not work in the multi-factor target variable?
thanks.

Release MachineShop 2.8.0.9000

Prepare for release:

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Feature importance p-values

In addition to the permutation-based feature importance, there is permutation-based p-values for the feature importance (Altmann, A., Tolosi, L., Sander, O. & Lengauer, T. (2010). Permutation importance: a corrected feature importance measure, Bioinformatics 26:1340-1347). There is essentially only the ranger package that implements this via the importance_pvalues function. Would you think that such a function is helpful? I could imagine that this may aid in judging whether a feature is relevant or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.