This package is dedicated to classification analysis using decision trees. Aside from decision tree model itself and prediction function it has got all necessary supporting tools - data cleaning, transformation function, plot of the results and calculation of accuracy of predictions and confusion matrix.
The functionalities are as follows.
- Data Cleaning
require("tree3")
#> Loading required package: tree3
#>
#> Attaching package: 'tree3'
#> The following object is masked from 'package:base':
#>
#> transform
data("bmarketing")
cleanedData <- clean(data = bmarketing,target_name = "y")- Data Transforming
cleanedData$cons.price.id <- transform(cleanedData,column = "cons.price.idx")- Finding a Model
treeModel <- model(input_data = cleanedData,target_name="y")- Getting the predictions
predictionData <- predictions(dt_model = treeModel,data = cleanedData)- Assessing the model accuracy
model_accuracy(real = cleanedData$y,pred = predictionData,chosenvar='yes')
#> $accuracy
#> [1] 0.9271668
#>
#> $confusion_matrix
#> pred
#> real no yes
#> no 3583 85
#> yes 215 236
#>
#> $sensitivity
#> [1] 0.5232816
#>
#> $specificity
#> [1] 0.9768266