# DAL ToolBox
# version 1.01.727
source("https://raw.githubusercontent.com/cefet-rj-dal/daltoolbox/main/jupyter.R")
#loading DAL
load_library("daltoolbox")
Loading required package: daltoolbox Registered S3 method overwritten by 'quantmod': method from as.zoo.data.frame zoo Attaching package: ‘daltoolbox’ The following object is masked from ‘package:base’: transform
#load dataset
data(iris)
General entropy of dataset
# setup clustering
model <- cluster_pam(k=3)
# build model
model <- fit(model, iris[,1:4])
clu <- cluster(model, iris[,1:4])
table(clu)
clu 1 2 3 50 62 38
# evaluate model using external metric
eval <- evaluate(model, clu, iris$Species)
eval
x | ce | qtd | ceg |
---|---|---|---|
<fct> | <dbl> | <int> | <dbl> |
1 | 0.0000000 | 50 | 0.00000000 |
2 | 0.7706291 | 62 | 0.31852668 |
3 | 0.2974722 | 38 | 0.07535964 |