new_viewpoint: New viewpoint

Description Usage Arguments Value See Also

View source: R/viewpoints.R

Description

Defines a new viewpoint.

Usage

1
new_viewpoint(name, label, alphabet_size, discrete, f_obs, f_all)

Arguments

name

(Character scalar) Name for the viewpoint (e.g. pc_chord).

label

(Character scalar) Label for the viewpoint (e.g. "Pitch-class chord").

alphabet_size

For a discrete viewpoint, the number of symbols in the viewpoint's alphabet; for a continuous viewpoint, NA.

discrete

(Logical scalar) Whether the viewpoint is discrete as opposed to continuous.

f_obs

A function that takes a chord sequence as input and returns an integer vector corresponding to the observed feature value for each chord. This function must accept three arguments, though the function is free to ignore some of these arguments:

  • chord_ids - An integer-encoded version of the chord sequence, using the pc_chord encoding from the hrep package (see encode).

  • chords - The same chord sequence expressed as a list of pc_chord objects.

  • verbose - (Logical scalar) Whether or not to print computation progress statements.

f_all

A function that takes a chord sequence as input and returns a matrix of feature values corresponding to all possible chords that could have been observed at each point in the chord sequence. In particular, element [i, j] should correspond to the feature value observed if the chord sequence up to and including the i - 1th event were to be followed by chord j, where chord j is encoded using the pc_chord encoding from the hrep package. The function should accept the same argments as those listed above for the f_obs argument.

Value

A viewpoint object that can be passed to compute_viewpoints.

See Also

new_static_viewpoint provides an efficient way to define viewpoints that do not depend on the preceding chords.


pmcharrison/hvr documentation built on April 14, 2020, 2:47 a.m.