Skip to content

Commit

Permalink
Merge pull request #175 from mdruiter/fix-np.NaN
Browse files Browse the repository at this point in the history
Fix deprecated np.NaN
  • Loading branch information
wgifford authored Oct 31, 2024
2 parents c20be46 + 19708be commit 861f2fd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tsfm_public/toolkit/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,9 @@ def apply_masking_specification(self, past_values_tensor: np.ndarray) -> np.ndar
for col_name, spec in self.masking_specification:
col_idx = self.column_name_to_index_map[col_name]
if isinstance(spec, (tuple, list)) and len(spec) == 2:
past_values_tensor[spec[0] : spec[1], col_idx] = np.NaN
past_values_tensor[spec[0] : spec[1], col_idx] = np.nan
else:
past_values_tensor[spec:, col_idx] = np.NaN
past_values_tensor[spec:, col_idx] = np.nan
return past_values_tensor

def __getitem__(self, index):
Expand Down
2 changes: 1 addition & 1 deletion tsfm_public/toolkit/time_series_forecasting_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def postprocess(self, input, **kwargs):
for i, c in enumerate(kwargs["target_columns"]):
ground_truth = input["future_values"][:, :, i].numpy()
missing = ~input["future_observed_mask"][:, :, i].numpy()
ground_truth[missing] = np.NaN
ground_truth[missing] = np.nan
out[c] = ground_truth.tolist()

if "timestamp_column" in kwargs:
Expand Down
2 changes: 1 addition & 1 deletion tsfm_public/toolkit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ def convert_tsf(filename: str) -> pd.DataFrame:
forecast_horizon,
contain_missing_values,
contain_equal_length,
) = convert_tsf_to_dataframe(filename, replace_missing_vals_with=np.NaN)
) = convert_tsf_to_dataframe(filename, replace_missing_vals_with=np.nan)

id_column_name = "id"
timestamp_column_name = "timestamp"
Expand Down

0 comments on commit 861f2fd

Please sign in to comment.