<jupyter_start><jupyter_text>Bayesion Network Classfier(genes classification)For each feature selection methods, we check both 50 and 90 genes selection below.<jupyter_code>suppressMessages(library(bnlearn))
set.seed(201703)
load("../transformed data/paper29.rda")
k = c(5,10,20,30,50,70,90)
# kmeans method
km_50 = empty.graph(c("class", colnames(data.frame(train_kmeans))))
#km_set = cbind( from = colnames(data.frame(golub_train_p_trans[,kmeans_id])), to = rep("class", k[5]))
arcs(km_50) = matrix(c(rep("class", k[5]), 
                    colnames(data.frame(train_kmeans))), 
                  ncol = 2, byrow = F, dimnames = list(c(), c("from", "to")))
#plot(km)
km_fitted_50 = bn.fit(km_50, train_kmeans_50)
km_predict_train_50 = predict(km_fitted_50, node = "class", method="bayes-lw", train_kmeans_50)
km_predict_test_50 = predict(km_fitted_50, node = "class", method="bayes-lw", test_kmeans_50)
table(Predict_train = km_predict_train_50, True = train_kmeans_50$class)
table(Predict_test = km_predict_test_50, True = golub_test_r)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1485981308411215, 'fraction_numerical': 0.052336448598130844, 'mean_word_length': 6.489510489510489, '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': '7399', 'license': 'MIT', 'n_tokens_mistral': 453, 'n_tokens_neox': 403, 'n_words': 70, 'path': 'ReproducingMLpipelines/Paper29/ModelBN.ipynb', 'repo_name': 'CompareML/AIM-Manuscript', 'size': '1070'}