Skip to content

Instantly share code, notes, and snippets.

@andodet
andodet / build_reports.sh
Created Mar 7, 2020
Replacing docker RUN cmds with a .sh script
View build_reports.sh
#!bin/sh
echo "options(renv.consent=TRUE)" >> .Rprofile
# Install R dependencies
sudo R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))" \
&& R -e "remotes::install_github('rstudio/renv')" \
&& R -e "renv::restore(confirm = FALSE)"
# Render reports
@andodet
andodet / cached_example.R
Created Mar 2, 2020
Toy examples for plot caching in Shiny
View cached_example.R
library(shiny)
library(dplyr)
library(ggplot2)
library(R6)
library(redux)
ui <- fluidPage(titlePanel("Plot Caching Test"),
sidebarLayout(sidebarPanel(
selectInput("number", choices = seq(80000, 100000, by = 10000),
View rsearch_results.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 20 columns, instead of 18. in line 2.
,mean_fit_time,std_fit_time,mean_score_time,std_score_time,param_n_estimators,param_min_samples_split,param_min_samples_leaf,param_max_features,param_max_depth,param_bootstrap,params,split0_test_score,split1_test_score,split2_test_score,split3_test_score,split4_test_score,mean_test_score,std_test_score,rank_test_score
1,448.5101426124573,5.3167800779414565,5.312238168716431,0.3358513032639484,40,10,1,auto,110,False,"{'n_estimators': 40, 'min_samples_split': 10, 'min_samples_leaf': 1, 'max_features': 'auto', 'max_depth': 110, 'bootstrap': False}",0.7692151468714805,0.7740230946882217,0.7709119147992013,0.7739123998445625,0.7742867193719798,0.7724684199627252,0.002040865591995547,1
15,397.7642039299011,3.1463341004142626,6.432087182998657,0.11780531491343235,53,5,1,sqrt,100,True,"{'n_estimators': 53, 'min_samples_split': 5, 'min_samples_leaf': 1, 'max_features': 'sqrt', 'max_depth': 100, 'bootstrap': True}",0.759928364381589,0.7603140877598152,0.7519229346941795,0.758479672840991,0.758308492714447,0.75779146821
View rsearch_results.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 20 columns, instead of 18. in line 2.
,mean_fit_time,std_fit_time,mean_score_time,std_score_time,param_n_estimators,param_min_samples_split,param_min_samples_leaf,param_max_features,param_max_depth,param_bootstrap,params,split0_test_score,split1_test_score,split2_test_score,split3_test_score,split4_test_score,mean_test_score,std_test_score,rank_test_score
0,879.4318630218506,6.616491437189391,17.00982060432434,0.9989063711188361,132,2,2,auto,100,False,"{'n_estimators': 132, 'min_samples_split': 2, 'min_samples_leaf': 2, 'max_features': 'auto', 'max_depth': 100, 'bootstrap': False}",0.6791905913631077,0.6757136258660508,0.666722135936691,0.6767084250846579,0.6769361796671048,0.6750547288702187,0.004318869299143393,15
1,448.5101426124573,5.3167800779414565,5.312238168716431,0.3358513032639484,40,10,1,auto,110,False,"{'n_estimators': 40, 'min_samples_split': 10, 'min_samples_leaf': 1, 'max_features': 'auto', 'max_depth': 110, 'bootstrap': False}",0.7692151468714805,0.7740230946882217,0.7709119147992013,0.7739123998445625,0.7742867193719798,0.7724684