Labelled Optimal Partitioning
install.packages("LOPART") ## OR devtools::install_github("tdhock/LOPART")
The main function that you should use is
set.seed(1);data.vec <- rnorm(4) label.df <- data.frame( start=c(1, 3), end=c(2, 4), changes=c(1, 0)) ## large penalty, few changepoints. fit1 <- LOPART::LOPART(data.vec, label.df, 10000) ## small penalty, many changepoints. fit2 <- LOPART::LOPART(data.vec, label.df, 0.001)
The resulting model fit list looks like
> fit2 $loss changes_total changes_labeled changes_unlabeled penalty_labeled 1: 2 1 1 0.001 penalty_unlabeled penalized_cost total_loss 1: 0.001 -0.712705 -0.714705 $cost cost_candidates cost_optimal mean last_change 1: Inf -0.3924444 -0.6264538 -1 2: -0.6880465 -0.4251692 0.1836433 0 3: -0.7127050 Inf Inf -2 4: Inf -0.7127050 0.3798261 1 $changes change 1: 1.5 2: 2.5 $segments start end mean 1: 1 1 -0.6264538 2: 2 2 0.1836433 3: 3 4 0.3798261 >
Each element is a data table:
n_updates
parameter).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4