compare_model: Compare or evaluate model performance with respect to other...

View source: R/compare_model.R

compare_modelR Documentation

Compare or evaluate model performance with respect to other model or ground truth

Description

Compares or evaluates model estimated change point set against another model or ground truth. The comparison is made using common metrics to compare clusters. The metrics provided are

  • "hausdorff": Hausdorff Distance metric;

  • "rand": Rand Index ;

  • "symdiff": Symmetric difference metric;

  • "jaccard": Jaccard similarity index.

Usage

compare_model(model1, model2, ncol = NULL)

Arguments

model1

The first blockcpd object or list of sorted integers representing the change point set.

model2

The second blockcpd object or list of sorted integers representing the change point set.

ncol

The number of variables which the model was fitted on. Only needs to be passed if both arguments are change point sets instead of a blockcpd object.

Value

Returns a list containing four metrics:

  • "haus" Hausdorff distance;

  • "rand" Rand index;

  • "symdiff" Symmetric difference;

  • "jaccard" Jaccard index.

Examples

model1 = fit_blockcpd(c(0, 1, 0, 1), lambda = 0)
model2 = fit_blockcpd(c(0, 1, 0, 1), lambda = Inf)
comparison = compare_model(model1, model2)
# change-point sets can also be passed directly with ncol
compare_model(c(1,2,3,4), c(3), 10)

Lucas-Prates/blockcpd documentation built on Aug. 19, 2022, 12:55 a.m.