paddlets.models.representation.dl.cost

class CoST(segment_size: int, sampling_stride: int = 1, optimizer_fn: ~typing.Callable[[...], ~paddle.optimizer.optimizer.Optimizer] = <class 'paddle.optimizer.momentum.Momentum'>, optimizer_params: ~typing.Dict[str, ~typing.Any] = {'learning_rate': 0.001}, callbacks: ~typing.List[~paddlets.models.common.callbacks.callbacks.Callback] = [], batch_size: int = 128, max_epochs: int = 10, verbose: int = 1, seed: ~typing.Union[None, int] = None, repr_dims: int = 320, hidden_dims: int = 64, num_layers: int = 10, queue_size: int = 256, temperature: float = 0.07, alpha: float = 0.0005)[source]

Bases: ReprBaseModel

CoST[1] is a time series representation model published in ICLR 2022, It is a new time series representation learning framework for long sequence time series forecasting, which applies the contrastive learning method to learn disentangled seasonal-trend representations. CoST comprises both time domain and frequency domain contrastive losses to learn discriminative trend and seasonal representations, respectively.

[1] Woo G, et al. “CoST: Contrastive Learning of Disentangled Seasonal-Trend Representations for Time Series Forecasting”, https://arxiv.org/pdf/2202.01575.pdf

Parameters
  • segment_size (int) – The size of time series segment.

  • sampling_stride (int) – Sampling intervals between two adjacent samples.

  • optimizer_fn (Callable[..., Optimizer]) – Optimizer algorithm.

  • optimizer_params (Dict[str, Any]) – Optimizer parameters.

  • callbacks (List[Callback]) – Customized callback functions.

  • batch_size (int) – Number of samples per batch.

  • max_epochs (int) – Max epochs during training.

  • verbose (int) – Verbosity mode.

  • seed (int|None) – Global random seed.

  • repr_dims (int) – The dimension of representation.

  • hidden_dims (int) – The number of channels in the hidden layer.

  • num_layers (int) – The number of ConvLayer to be stacked.

  • queue_size (int) – The dynamic queue size for saving negative examples.

  • temperature (float) – The temperature coefficient.

  • alpha (float) – The weight of seasonal components in loss.

_segment_size

The size of time series segment.

Type

int

_sampling_stride

Sampling intervals between two adjacent samples.

Type

int

_optimizer_fn

Optimizer algorithm.

Type

Callable[…, Optimizer]

_optimizer_params

Optimizer parameters.

Type

Dict[str, Any]

_callbacks

Customized callback functions.

Type

List[Callback]

_batch_size

Number of samples per batch.

Type

int

_max_epochs

Max epochs during training.

Type

int

_verbose

Verbosity mode.

Type

int

_seed

Global random seed.

Type

int|None

_repr_dims

The dimension of representation.

Type

int

_hidden_dims

The number of channels in the hidden layer.

Type

int

_num_layers

The number of ConvLayer to be stacked.

Type

int

_queue_size

The dynamic queue size for saving negative examples.

Type

int

_temperature

The temperature coefficient.

Type

float

_alpha

The parameter control the weightage of seasonal components in loss.

Type

float