Skip to content

Commit

Permalink
leave any unmapped numeric features as numerics
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgard committed Dec 29, 2023
1 parent 10615e6 commit c7e197b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tableshift/core/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,11 @@ def get_passthrough_columns(self, data: pd.DataFrame,
if self.config.numeric_features == "passthrough":
passthrough_columns += get_numeric_columns(data)

elif self.config.numeric_features == "map_values":
# add any unmapped numeric columns
unmapped_numerics = [f for f in get_numeric_columns(data) if self.feature_list[f].value_mapping is None]
passthrough_columns += unmapped_numerics

if self.config.categorical_features == "passthrough":
passthrough_columns += get_categorical_columns(data)

Expand All @@ -550,7 +555,8 @@ def get_passthrough_columns(self, data: pd.DataFrame,
passthrough_columns.append(domain_label_colname)
if not self.config.map_targets:
passthrough_columns.append(target_colname)
return passthrough_columns

return list(set(passthrough_columns))

def map_names_extended(self, colnames: List[str]) -> List[str]:
"""Map the original feature names to any extended feature names."""
Expand Down

0 comments on commit c7e197b

Please sign in to comment.