weight_decay: Compute a vector of weights with a decay rate.

View source: R/FMAT.R

weight_decayR Documentation

Compute a vector of weights with a decay rate.

Description

Compute a vector of weights with a decay rate.

Usage

weight_decay(vector, decay)

Arguments

vector

Vector of sequence.

decay

Decay factor for computing weights. A smaller decay value would give greater weight to the former items than to the latter items. The i-th item has raw weight = decay ^ i.

  • decay = 1: all items are equally important

  • 0 < decay < 1: first items are more important

  • decay > 1: last items are more important

Value

Normalized weights (i.e., sum of weights = 1).

See Also

FMAT_run()

Examples

# "individualism"
weight_decay(c("individual", "##ism"), 0.5)
weight_decay(c("individual", "##ism"), 0.8)
weight_decay(c("individual", "##ism"), 1)
weight_decay(c("individual", "##ism"), 2)

# "East Asian people"
weight_decay(c("East", "Asian", "people"), 0.5)
weight_decay(c("East", "Asian", "people"), 0.8)
weight_decay(c("East", "Asian", "people"), 1)
weight_decay(c("East", "Asian", "people"), 2)


FMAT documentation built on Jan. 12, 2026, 9:08 a.m.