<jupyter_start><jupyter_text>**AdaBoost**Using adaboost function from fastAdaboost package in R.<jupyter_code>suppressMessages(library(fastAdaboost))
load("../transformed data/golub3571.rda")
load("../transformed data/paper9.rda")
# Settings as specified in the paper
p = 40 # number of genes for FLDA
B = 50 # Aggregation predictors
N = 200 # repeat classification N times
d = c(0.05, 0.1,0.25, 0.5, 0.75, 1) # CPD parameter
set.seed(2017)
cbine_data = data.frame(response = factor(total3571_response), scale_golub_merge)
ada_error = numeric(N)
for(i in 1:N){
    ad_index = mysplit(nrow(cbine_data))
    ad_train = cbine_data[-ad_index,]
    ad_test = cbine_data[ad_index,]
    
    # gene selection
    temp_bw = order(BW(ad_train[, -1], ad_train$response), decreasing = T)[1:p]
    ad_train_t = data.frame(response = ad_train$response, ad_train[,temp_bw+1])
    ad_test_t= data.frame(response = ad_test$response, ad_test[,temp_bw+1])
    
    ada_cl = adaboost(response~., data = ad_train_t, 50)
    ada_test_pr = predict(ada_cl, ad_test_t)$class
   ada_error[i] = sum(ada_test_pr != ad_test_t$response)
}
resultAda = c(Median = median(ada_error), Upper_quartile = quantile(ada_error, 0.75))
resultAda<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1319838056680162, 'fraction_numerical': 0.03562753036437247, 'mean_word_length': 5.3061224489795915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '306445', 'license': 'MIT', 'n_tokens_mistral': 515, 'n_tokens_neox': 464, 'n_words': 93, 'path': 'ReproducingMLpipelines/Paper9/ModelAdaboost.ipynb', 'repo_name': 'CompareML/AIM-Manuscript', 'size': '1235'}