MCPcopy Create free account

hub / github.com/amazon-science/chronos-forecasting / functions

Functions323 in github.com/amazon-science/chronos-forecasting

↓ 50 callersFunctionvalidate_tensor
(a: torch.Tensor, shape: Tuple[int, ...], dtype: Optional[torch.dtype] = None)
test/util.py:9
↓ 39 callersFunctioncreate_df
Helper to create test context DataFrames.
test/util.py:17
↓ 37 callersMethodpredict
Get forecasts for the given time series. Refer to the base method (``BaseChronosPipeline.predict``) for details on shared pa
src/chronos/chronos.py:430
↓ 24 callersMethodfrom_pretrained
Load the model, either from a local path S3 prefix or from the HuggingFace Hub. Supports the same arguments as ``AutoConfig`` and ``A
src/chronos/chronos.py:536
↓ 23 callersMethodpredict_df
Perform forecasting on time series data in a long-format pandas DataFrame. Parameters ---------- df Time
src/chronos/base.py:136
↓ 19 callersFunctionnormalize_df
Return a df with the timestamp column coerced to datetime, rows grouped by id (in first-appearance order, or `order` if given), and sorted by
src/chronos/df_utils.py:105
↓ 17 callersFunctionget_forecast_start_times
(df, freq="h")
test/util.py:43
↓ 16 callersFunctionfrom_list_of_dicts
Convert list of dicts to list[PreparedInput]. Each dict has: - "target": np.ndarray, shape (context_length,) or (n_targets, context_leng
src/chronos/chronos2/preprocess.py:217
↓ 15 callersFunctioncreate_future_df
Helper to create test future DataFrames.
test/util.py:31
↓ 15 callersFunctionfrom_data_frame
Convert long-format DataFrame to list[PreparedInput]. Assumptions (when validate_inputs=False) ----------------------------------------
src/chronos/chronos2/preprocess.py:115
↓ 10 callersFunctionlog_on_main
Log the given message using the given logger, if we're on the main process.
scripts/training/train.py:64
↓ 9 callersMethodpredict_quantiles
Refer to the base method (``BaseChronosPipeline.predict_quantiles``).
src/chronos/chronos.py:513
↓ 9 callersFunctionvalidate_df
Validate DataFrame structure. Raises ValueError on failure. Checks: - Required columns exist - Target columns are numeric - know
src/chronos/df_utils.py:139
↓ 8 callersMethod__init__
(self, config: Chronos2CoreConfig)
src/chronos/chronos2/layers.py:154
↓ 7 callersMethodcreate_tokenizer
(self)
src/chronos/chronos.py:54
↓ 7 callersMethodembed
Get encoder embeddings for the given time series. Parameters ---------- context Input series. This is ei
src/chronos/chronos.py:399
↓ 7 callersMethodfit
Fine-tune a copy of the current Chronos-2 model on the given inputs and return a new pipeline. Parameters ----------
src/chronos/chronos2/pipeline.py:99
↓ 7 callersFunctioninfer_freq_from_df
Infer the (shared) frequency of the time series in a normalized df. ``pd.infer_freq`` requires at least 3 observations, so series shorter th
src/chronos/df_utils.py:22
↓ 7 callersFunctionmake_future_df
Build the forecast-horizon timestamps for each series in a normalized df. For each item, generates the timestamps for the next ``prediction_
src/chronos/df_utils.py:62
↓ 6 callersFunction_target_encode
Per-item target encoding using vectorized bincount operations. Computes smoothed mean target value for each (item, category) pair: e
src/chronos/chronos2/preprocess.py:612
↓ 5 callersMethodcontext_input_transform
Turn a batch of time series into token IDs, attention map, and tokenizer_state. Parameters ---------- context
src/chronos/chronos.py:68
↓ 5 callersFunctionvalidate_and_normalize_df
Validate and normalize df (and future_df) for the DataFrame-based prediction paths. Runs ``validate_df`` then ``normalize_df`` so that the r
src/chronos/df_utils.py:198
↓ 4 callersMethod__init__
(self, patch_size: int, patch_stride: int)
src/chronos/chronos_bolt.py:75
↓ 4 callersMethod_input_transform
( self, context: torch.Tensor, scale: Optional[torch.Tensor] = None )
src/chronos/chronos.py:170
↓ 4 callersMethod_prepare_and_validate_context
(self, context: Union[torch.Tensor, List[torch.Tensor]])
src/chronos/chronos.py:388
↓ 4 callersFunctioninterpolate_quantiles
Interpolates quantile values at specified query levels using linear interpolation using original quantile levels and their corresponding valu
src/chronos/utils.py:22
↓ 4 callersMethodinverse
(self, x: torch.Tensor, loc_scale: tuple[torch.Tensor, torch.Tensor])
src/chronos/chronos_bolt.py:124
↓ 4 callersMethodoutput_transform
Turn a batch of sample token IDs into real values. Parameters ---------- samples A tensor of integers, s
src/chronos/chronos.py:131
↓ 3 callersMethod_create_instance_splitter
(self, mode: str)
scripts/training/train.py:353
↓ 3 callersMethod_fev_window_to_df
Convert a fev evaluation window into the (past_df, future_df, target_columns) inputs for `predict_df`.
src/chronos/base.py:314
↓ 3 callersFunction_is_unavailable
A future-covariate value is 'unavailable' if it is None or an empty sequence.
src/chronos/chronos2/preprocess.py:607
↓ 3 callersFunctioneval_pipeline_and_save_results
( pipeline: BaseChronosPipeline, config_path: Path, metrics_path: Path, model_id: str, bat
scripts/evaluation/evaluate.py:116
↓ 3 callersFunctionfrom_tensor
Convert 3D tensor to list[PreparedInput]. All variates are treated as targets (no covariates). Parameters ---------- data
src/chronos/chronos2/preprocess.py:28
↓ 3 callersFunctionleft_pad_and_stack_1D
(tensors: List[torch.Tensor])
src/chronos/utils.py:11
↓ 2 callersMethod__init__
(self, config: Chronos2CoreConfig)
src/chronos/chronos2/model.py:214
↓ 2 callersMethod_append_eos_token
( self, token_ids: torch.Tensor, attention_mask: torch.Tensor )
src/chronos/chronos.py:198
↓ 2 callersMethod_build_batch
Build a batch from given input indices.
src/chronos/chronos2/dataset.py:244
↓ 2 callersFunction_build_prepared_inputs
Build list[PreparedInput] from stacked covariate columns. Handles categorical encoding. Assumptions ----------- - Rows are stacked i
src/chronos/chronos2/preprocess.py:369
↓ 2 callersFunction_create_t5_stack
Create a T5Stack with the given config and embed_tokens. This helper function provides backward compatibility between transformers v4 and v5
src/chronos/chronos_bolt.py:42
↓ 2 callersMethod_generate_sequential_batches
(self)
src/chronos/chronos2/dataset.py:300
↓ 2 callersMethod_get_prob_mass_per_quantile_level
Computes normalized probability masses for quantile levels using trapezoidal rule approximation. Each quantile receives probability
src/chronos/chronos2/pipeline.py:51
↓ 2 callersMethod_predict_step
( self, context: torch.Tensor, group_ids: torch.Tensor, future_covariates: tor
src/chronos/chronos2/pipeline.py:720
↓ 2 callersFunction_stack_covariate
Concatenate a covariate column across dicts into a Series: float32 if numeric, else "category".
src/chronos/chronos2/preprocess.py:312
↓ 2 callersFunctionagg_relative_score
(model_csv: Path, baseline_csv: Path)
scripts/evaluation/agg-relative-score.py:10
↓ 2 callersFunctionconvert_df_input_to_list_of_dicts_input
[DEPRECATED] Convert from dataframe input format to a list of dictionaries input format. .. deprecated:: 2.3.0 Use :func:`chronos.ch
src/chronos/df_utils.py:239
↓ 2 callersFunctiondownload_model_files_from_s3
( bucket: str, prefix: str, local_path: Path, force_download: bool = False, boto3_session:
src/chronos/boto_utils.py:55
↓ 2 callersMethodencode
( self, context: torch.Tensor, mask: Optional[torch.Tensor] = None )
src/chronos/chronos_bolt.py:277
↓ 2 callersMethodencode
( self, context: torch.Tensor, context_mask: torch.Tensor | None = None, group
src/chronos/chronos2/model.py:569
↓ 2 callersFunctionfrom_list_of_tensors
Convert list of 1D/2D tensors to list[PreparedInput]. All variates are treated as targets (no covariates). Parameters ----------
src/chronos/chronos2/preprocess.py:72
↓ 2 callersFunctionis_main_process
Check if we're on the main process.
scripts/training/train.py:55
↓ 2 callersMethodpredict_fev
Make predictions for evaluation on a fev.Task. Parameters ---------- task Benchmark task on which the ev
src/chronos/base.py:247
↓ 2 callersMethodrotate_half
Rotates half the hidden dims of the input.
src/chronos/chronos2/layers.py:95
↓ 2 callersMethodsave_pretrained
Save the underlying model to a local directory or to HuggingFace Hub.
src/chronos/chronos2/pipeline.py:1185
↓ 2 callersMethodto_hf_format
(self, entry: dict)
scripts/training/train.py:396
↓ 1 callersMethod__init__
(self, config: ChronosConfig, model: PreTrainedModel)
src/chronos/chronos.py:256
↓ 1 callersMethod__init__
( self, datasets: list, probabilities: List[float], tokenizer: ChronosTokenize
scripts/training/train.py:300
↓ 1 callersMethod_autoregressive_unroll_for_long_horizon
( self, context: torch.Tensor, group_ids: torch.Tensor, future_covariates: tor
src/chronos/chronos2/pipeline.py:419
↓ 1 callersMethod_compute_loss
( self, quantile_preds: torch.Tensor, future_target: torch.Tensor, future_targ
src/chronos/chronos2/model.py:518
↓ 1 callersMethod_construct_and_invert_group_time_mask
( group_ids: torch.Tensor, attention_mask: torch.Tensor, floating_type: torch.dtype )
src/chronos/chronos2/model.py:123
↓ 1 callersMethod_construct_slice
(self, input_idx: int)
src/chronos/chronos2/dataset.py:182
↓ 1 callersMethod_eager_attention
Eager attention implementation using manual matmul. Args: query_states: [batch, n_heads, seq_len, kv_proj_dim] key_st
src/chronos/chronos2/layers.py:212
↓ 1 callersFunction_encode_categorical
Encode one categorical covariate to float32. The future series is mapped onto the past's categories so codes line up. NaN is its own category
src/chronos/chronos2/preprocess.py:319
↓ 1 callersMethod_expand_and_invert_time_attention_mask
( attention_mask: torch.Tensor, floating_type: torch.dtype )
src/chronos/chronos2/model.py:109
↓ 1 callersMethod_generate_train_batches
(self)
src/chronos/chronos2/dataset.py:276
↓ 1 callersMethod_init_decoder
(self, config)
src/chronos/chronos_bolt.py:395
↓ 1 callersMethod_predict_batch
( self, context: torch.Tensor, group_ids: torch.Tensor, future_covariates: tor
src/chronos/chronos2/pipeline.py:656
↓ 1 callersMethod_prepare_inputs_for_long_horizon_unrolling
( self, context: torch.Tensor, group_ids: torch.Tensor, future_covariates: tor
src/chronos/chronos2/pipeline.py:384
↓ 1 callersMethod_prepare_patched_context
( self, context: torch.Tensor, context_mask: torch.Tensor | None = None )
src/chronos/chronos2/model.py:392
↓ 1 callersMethod_prepare_patched_future
( self, future_covariates: torch.Tensor | None, future_covariates_mask: torch.Tensor |
src/chronos/chronos2/model.py:444
↓ 1 callersMethod_sdpa_attention
SDPA attention implementation using torch.nn.functional.scaled_dot_product_attention. Args: query_states: [batch, n_heads, seq_le
src/chronos/chronos2/layers.py:240
↓ 1 callersMethod_slide_context_and_future_covariates
( context: torch.Tensor, future_covariates: torch.Tensor, slide_by: int )
src/chronos/chronos2/pipeline.py:750
↓ 1 callersMethod_validate_input
( self, context: torch.Tensor, context_mask: torch.Tensor | None, group_ids: t
src/chronos/chronos2/model.py:334
↓ 1 callersFunction_validate_list_of_dicts
Validate list[dict] structure. Raises ValueError on failure. Checks: - Each dict has only allowed keys, and "target" is present - pa
src/chronos/chronos2/preprocess.py:481
↓ 1 callersMethodapply_rotary_pos_emb
Applies Rotary Position Embedding to the query and key tensors. Args: q (`torch.Tensor`): The query tensor. k (`torch
src/chronos/chronos2/layers.py:102
↓ 1 callersFunctioncache_model_from_s3
( s3_uri: str, force_download: bool = False, boto3_session: boto3.Session | None = None, )
src/chronos/boto_utils.py:105
↓ 1 callersMethodcompute_default_rope_parameters
Computes the inverse frequencies for RoPE embeddings. Args: config: The model configuration containing rope_theta and d_
src/chronos/chronos2/layers.py:52
↓ 1 callersMethodcreate_test_data
(self, data)
scripts/training/train.py:388
↓ 1 callersMethodcreate_training_data
(self, data)
scripts/training/train.py:378
↓ 1 callersMethodcreate_validation_data
(self, data)
scripts/training/train.py:392
↓ 1 callersMethoddecode
Parameters ---------- input_embeds: torch.Tensor Patched and embedded inputs. Shape (batch_size, patched_context_
src/chronos/chronos_bolt.py:401
↓ 1 callersFunctiondownload_model_files_from_cloudfront
( cloudfront_url: str, bucket: str, prefix: str, local_path: Path, force_download: bool =
src/chronos/boto_utils.py:27
↓ 1 callersMethodencode
Extract the encoder embedding for the given token sequences. Parameters ---------- input_ids Tensor of i
src/chronos/chronos.py:265
↓ 1 callersFunctiongenerate_forecasts
( test_data_input: Iterable, pipeline: BaseChronosPipeline, prediction_length: int, batch_size
scripts/evaluation/evaluate.py:73
↓ 1 callersFunctionget_next_path
Gets the next available path in a directory. For example, if `base_fname="results"` and `base_dir` has files ["results-0.yaml", "results-1.ya
scripts/training/train.py:122
↓ 1 callersFunctionget_training_job_info
Returns info about this training job.
scripts/training/train.py:72
↓ 1 callersMethodlabel_input_transform
Turn a batch of label slices of time series into token IDs and attention map using the ``tokenizer_state`` provided by ``context_inpu
src/chronos/chronos.py:100
↓ 1 callersFunctionleft_pad_and_cat_2D
Left pads tensors in the list to the length of the longest tensor along the second axis, then concats these equal length tensors along the fi
src/chronos/chronos2/dataset.py:32
↓ 1 callersFunctionload_and_split_dataset
(backtest_config: dict)
scripts/evaluation/evaluate.py:50
↓ 1 callersFunctionload_model
Load the specified HuggingFace model, adjusting the vocabulary size, special token IDs, and initialization options. This allows to set a
scripts/training/train.py:157
↓ 1 callersFunctionmaybe_autocast
(device_type=None, enabled=True)
src/chronos/chronos2/layers.py:21
↓ 1 callersMethodpredict
Get forecasts for the given time series. Refer to the base method (``BaseChronosPipeline.predict``) for details on shared pa
src/chronos/chronos_bolt.py:500
↓ 1 callersMethodpredict
Generate forecasts for the given time series. Parameters ---------- inputs The time series to generate f
src/chronos/chronos2/pipeline.py:468
↓ 1 callersMethodpredict_df
Perform forecasting on time series data in a long-format pandas DataFrame. Parameters ---------- df Time
src/chronos/chronos2/pipeline.py:822
↓ 1 callersMethodpredict_quantiles
Get quantile and mean forecasts for given time series. Predictions will be returned in fp32 on the cpu. Parameters -
src/chronos/base.py:101
↓ 1 callersMethodpredict_quantiles
Refer to ``Chronos2Pipeline.predict`` for shared parameters. Additional parameters --------------------- quantile_le
src/chronos/chronos2/pipeline.py:763
↓ 1 callersFunctionsample_from_gp_prior
Draw a sample from a GP prior. Parameters ---------- kernel The GP covaraince kernel. X The input "time" points.
scripts/kernel-synth.py:82
↓ 1 callersFunctionsave_training_info
Save info about this training job in a json file for documentation.
scripts/training/train.py:109
↓ 1 callersMethodshuffle
(self, shuffle_buffer_length: int = 100)
scripts/training/train.py:262
↓ 1 callersFunctiontimeout_callback
Return a callback object that raises an exception if time limit is exceeded.
test/util.py:50
↓ 1 callersFunctionto_gluonts_univariate
(hf_dataset: datasets.Dataset)
scripts/evaluation/evaluate.py:25
next →1–100 of 323, ranked by callers