Description Usage Arguments Value Examples
Ensemble Prediction without using training labels
1 | nonet_ensemble(object, best_modelname)
|
object |
prediction_list object, as from 'tune_models' |
best_modelname |
Best model name is one which performance better while evaluating using any evaluation matrix like confusion matrix. |
A list of ensembled predictions. You can evaluate the performance of ensembled prediction using the evaulation matrix as Confusion matrix or AUROC.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # nonet_ensemble functionality can be explained via below example
# Setup
library(caret)
library(nonet)
library(rlist)
# Load Data
dataframe <- data.frame(banknote_authentication[600:900, ])
dataframe$class <- as.factor(ifelse(dataframe$class >= 1, 'Yes', 'No'))
# First Model
# Spliting into train and test
index <- createDataPartition(dataframe$class, p=0.75, list=FALSE)
trainSet <- dataframe[ index,]
testSet <- dataframe[-index,]
#Feature selection
control <- rfeControl(functions = rfFuncs,
method = "repeatedcv",
repeats = 1,
verbose = FALSE)
outcomeName <- 'class'
predictors <- c("variance", "skewness")
banknote_rf <- train(trainSet[,predictors],trainSet[,outcomeName],method='rf')
preds_rf_first <- predict.train(object=banknote_rf,testSet[,predictors],type="prob")
preds_rf_first_raw <- predict.train(object=banknote_rf,testSet[,predictors],type="raw")
# Second Model
# Spliting into train and test
index <- createDataPartition(dataframe$class, p=0.75, list=FALSE)
trainSet <- dataframe[ index,]
testSet <- dataframe[-index,]
#Feature selection
control <- rfeControl(functions = rfFuncs,
method = "repeatedcv",
repeats = 2,
verbose = FALSE)
outcomeName <- 'class'
predictors <- c("curtosis", "entropy")
banknote_rf <- train(trainSet[,predictors],trainSet[,outcomeName],method='rf')
preds_rf_second <- predict.train(object=banknote_rf,testSet[,predictors],type="prob")
preds_rf_second_raw <- predict.train(object=banknote_rf,testSet[,predictors],type="raw")
Stack_object <- list(preds_rf_first$Yes, preds_rf_second$Yes)
names(Stack_object) <- c("model_rf_first", "model_rf_second")
# Prediction using nonet_ensemble function
prediction_nonet <- nonet_ensemble(Stack_object, "model_rf_second")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.