Learn R Programming

dtwclust (version 3.1.1)

create_dtwclust: Create formal dtwclust objects

Description

Helper function to manually create formal dtwclust-class objects

Usage

create_dtwclust(..., override.family = TRUE)

Arguments

...
Any valid slots of dtwclust-class.
override.family
Attempt to substitute the default family with one that conforms to the provided elements? See details.

Value

A dtwclust-class object.

Details

This function can calculate some of the slots if certain elements are provided by the user. In order to get a fully functional object at least the following slots should be provided:

  • type: "partitional", "hierarchical", "fuzzy" or "tadpole".
  • datalist: The data in one of the supported formats.
  • centroids: The time series centroids in one of the supported formats.
  • cluster: The cluster indices for each series in the datalist.
  • control*: A dtwclustControl object (or a named list) with the desired parameters.
  • distance*: A string indicating the distance that should be used.
  • centroid*: A string indicating the centroid to use (only necessary for partitional clustering).

*Necessary when overriding the default family for the calculation of other slots, CVIs or prediction. Maybe not always needed, e.g. for plotting.

Examples

Run this code

data(uciCT)

# Assuming this was generated by some clustering procedure
centroids <- CharTraj[seq(1L, 100L, 5L)]
control <- new("dtwclustControl", window.size = 8L, norm = "L2")
cluster <- unclass(CharTrajLabels)

pc_obj <- create_dtwclust(type = "partitional", datalist = CharTraj, centroids = centroids,
                          control = control, cluster = cluster,
                          distance = "sbd", centroid = "dba",
                          dots = list(step.pattern = symmetric1))

fc_obj <- create_dtwclust(type = "fuzzy", datalist = CharTraj, centroids = centroids,
                          control = control, cluster = cluster,
                          distance = "sbd", centroid = "fcm")

fc_obj

Run the code above in your browser using DataLab