Learn R Programming

blockcpd (version 1.0.0)

compare_model: 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)

Value

Returns a list containing four metrics:

  • "haus" Hausdorff distance;

  • "rand" Rand index;

  • "symdiff" Symmetric difference;

  • "jaccard" Jaccard index.

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab