<jupyter_start><jupyter_text>Como Funciona as Pipelines Descrição variáveis: https://go.documentation.sas.com/?cdcId=vdmmlcdc&cdcVersion=8.5&docsetId=vdmmlref&docsetTarget=p0doq3u7i2yghzn1azsbn1eu9zmf.htm&locale=en<jupyter_code>library('randomForest')
data <- read.csv('./data/hmeq.csv', na.strings = '', stringsAsFactors = TRUE)
head(data)
library('missForest')
imp = missForest(data, maxiter = 2, ntree = 10) 

data_imp <- imp$ximp
head(data_imp)
data_imp$BAD <- as.factor(data_imp$BAD)
# RandomForest
dm_model <- randomForest(BAD ~ ., ntree=100, mtry=5, 
                         data=data_imp, importance=TRUE)
# Score
pred <- predict(dm_model, data_imp, type="prob")
scored_df <- data.frame(pred)
colnames(scored_df) <- c("P_BAD0", "P_BAD1")
head(scored_df)
# Print/plot model output
#png("rpt_forestMsePlot.png")

plot(dm_model, main='randomForest MSE Plot')
legend("right", colnames(dm_model$err.rate),col=1:3,cex=0.8,fill=1:3)
# dev.off
write.csv(importance(dm_model), 
          file="rpt_forestIMP.csv", 
          row.names=TRUE)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1560747663551402, 'fraction_numerical': 0.022429906542056073, 'mean_word_length': 5.735849056603773, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '253753', 'license': 'MIT', 'n_tokens_mistral': 457, 'n_tokens_neox': 430, 'n_words': 57, 'path': 'PT/ModelStudio/r_pipeline.ipynb', 'repo_name': 'pinduzera/R-SAS-Webinar', 'size': '1070'}