google-research/timesfm

TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.

Python★ 31,116+342 that day#7 on trending

Analyzed September 5, 2026 at 0df95ae (master) with jscpd 5.4.0 in 0.4s. Code duplication stayed at 7.4% across 3 appearances since Sep 3.

7.4%duplicated code · 1,158 of 15,657 lines
48clones in code
61code files of 128 scanned
10.98%duplicated over all files · 134 clones

The code number leaves out tests, fixtures, docs, examples, data files, styles, translations and vendored code.

Largest clones in the code

  • 130 lines in 2 placespython1,056 tokens
    72class BatchedInContextXRegBase:
    73  """Helper class for in-context regression covariate formatting.
    74
    75  Attributes:
    76    targets: List of targets (responses) of the in-context regression.
    77    train_lens: List of lengths of each target vector from the context.
    78    test_lens: List of lengths of each forecast horizon.
    79    train_dynamic_numerical_covariates: Dict of covariate names mapping to the
    80      dynamic numerical covariates of each forecast task on the context. Their
    81      lengths should match the corresponding lengths in `train_lens`.
    

    First 10 of 130 lines.

  • 165 lines in 2 placespython777 tokens
    207  self.static_numerical_covariates = static_numerical_covariates or {}
    208  self.static_categorical_covariates = static_categorical_covariates or {}
    209
    210def _assert_covariates(self, assert_covariate_shapes: bool = False) -> None:
    211  """Verifies the validity of the covariate inputs."""
    212
    213  # Check presence.
    214  if (
    215    self.train_dynamic_numerical_covariates
    216    and not self.test_dynamic_numerical_covariates
    
    190  self.static_numerical_covariates = static_numerical_covariates or {}
    191  self.static_categorical_covariates = static_categorical_covariates or {}
    192
    193def _assert_covariates(self, assert_covariate_shapes: bool = False) -> None:
    194  """Verifies the validity of the covariate inputs."""
    195
    196  # Check presence.
    197  if (self.train_dynamic_numerical_covariates and
    198      not self.test_dynamic_numerical_covariates) or (
    199          not self.train_dynamic_numerical_covariates and
    

    First 10 of 165 lines, the second copy on the right.

  • 88 lines in 2 placespython626 tokens
    377  x_test = [(x_test - x_mean) / x_std]
    378
    379# Categorical features. Encode one by one.
    380one_hot_encoder = preprocessing.OneHotEncoder(
    381  drop=one_hot_encoder_drop,
    382  sparse_output=False,
    383  handle_unknown="ignore",
    384)
    385for name in sorted(self.train_dynamic_categorical_covariates.keys()):
    386  ohe_train = _unnest(self.train_dynamic_categorical_covariates[name])[
    
    355  x_test = [np.concatenate(norm_test, axis=0)]
    356
    357# Categorical features. Encode one by one.
    358one_hot_encoder = preprocessing.OneHotEncoder(
    359    drop=one_hot_encoder_drop,
    360    sparse_output=False,
    361    handle_unknown="ignore",
    362)
    363for name in sorted(self.train_dynamic_categorical_covariates.keys()):
    364  ohe_train = _unnest(
    

    First 10 of 88 lines, the second copy on the right.

7 more
Largest clones over all files, tests and data included
By format, code only
FormatFilesLinesClonesDuplicated linesDuplication
python5014,808481,1587.82%
bash10675000%
perl1174000%
By format, all files
FormatFilesLinesClonesDuplicated linesDuplication
json56,157742,11034.27%
python7820,433571,2386.06%
markdown152,4622140.57%
yaml37211622.22%
bash13798000%
csv5358000%
perl1174000%
toml2125000%
text4110000%
txt149000%

Trending appearances

DayRankStarsFilesLinesClonesAll filesCodeHealthCommit
Sep 5, 2026#731,116 (+342)12830,75213410.98%7.4%—0df95ae
Sep 4, 2026#430,771 (+1,618)12830,68113310.99%7.4%—aa48015
Sep 3, 2026#230,144 (+343)12830,68113310.99%7.4%—aa48015

Want this for your own project? Install jscpd and run jscpd ., or measure it the way the baselines were measured.