), f"Please make sure that features are not NULL; row {i}"
for j, value in feature_map.items():
j_index = self.feature_id_to_index.get(j, None)
if j_index is None:
continue
dense_data[i][j_index] = value
dense_presence[i][j_index] = 1
if self.set_missing_value_to_zero:
// When we set missing values to 0, we don"t know what is and isn"t missing
After Change
missing_value = normalization.MISSING_VALUE
if self.set_missing_value_to_zero:
missing_value = 0.0
state_features_df = pd.DataFrame(sparse_data).fillna(missing_value)
// Add columns identified by normalization, but not present in batch
for col in self.sorted_features:
if col not in state_features_df.columns:
state_features_df[col] = missing_value
values = torch.from_numpy(
state_features_df[self.sorted_features].values
).float()
if self.set_missing_value_to_zero:
// When we set missing values to 0, we don"t know what is and isn"t missing
presence = torch.ones_like(values, dtype=torch.bool)
else: