model_name: Retrieve the name of the model that a segmenter or model used

View source: R/aaa_generics.R

model_nameR Documentation

Retrieve the name of the model that a segmenter or model used

Description

Retrieve the name of the model that a segmenter or model used

Usage

model_name(object, ...)

## Default S3 method:
model_name(object, ...)

## S3 method for class 'character'
model_name(object, ...)

## S3 method for class 'mod_cpt'
model_name(object, ...)

## S3 method for class 'seg_basket'
model_name(object, ...)

## S3 method for class 'seg_cpt'
model_name(object, ...)

## S3 method for class 'tidycpt'
model_name(object, ...)

## S3 method for class 'ga'
model_name(object, ...)

## S3 method for class 'cpt'
model_name(object, ...)

## S3 method for class 'wbs'
model_name(object, ...)

Arguments

object

A segmenter object.

...

currently ignored

Details

Every segmenter works by fitting a model to the data. model_name() returns the name of a model that can be passed to whomademe() to retrieve the model fitting function. These functions must begin with the prefix fit_. Note that the model fitting functions exist in tidychangepoint are are not necessarily the actual functions used by the segmenter.

Models also implement model_name().

Value

A character vector of length 1.

See Also

Other model-fitting: fit_lmshift(), fit_meanshift(), fit_meanvar(), fit_nhpp(), model_args(), new_fun_cpt(), whomademe()

Other tidycpt-generics: as.model(), as.segmenter(), changepoints(), diagnose(), fitness()

Examples

# Segment a time series using PELT
x <- segment(CET, method = "pelt")

# Retrieve the name of the model from the segmenter
x |>
  as.segmenter() |>
  model_name()

# What function created the model? 
x |>
  model_name() |>
  whomademe()
model_name(x$segmenter)

# Retrieve the name of the model from the model
x |>
  as.model() |>
  model_name()
  

tidychangepoint documentation built on April 4, 2025, 4:31 a.m.