Skip to content

Commit 3ae5704

Browse files
gustavocidornelaswhoseoyster
authored andcommitted
Completes UNB-2240 - Deprecate categorical_features_map in favor of categorical_feature_names
1 parent 4333621 commit 3ae5704

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

unboxapi/__init__.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
class DeploymentType(Enum):
23-
""" Specify the storage medium being used by your Unbox deployment. """
23+
"""Specify the storage medium being used by your Unbox deployment."""
2424

2525
ONPREM = 1
2626
AWS = 2
@@ -71,7 +71,7 @@ def add_model(
7171
class_names: List[str],
7272
requirements_txt_file: Optional[str] = None,
7373
feature_names: List[str] = [],
74-
categorical_features_map: Dict[str, List[str]] = {},
74+
categorical_feature_names: List[str] = [],
7575
train_sample_df: pd.DataFrame = None,
7676
train_sample_label_column_name: str = None,
7777
setup_script: Optional[str] = None,
@@ -353,9 +353,11 @@ def add_model(
353353
raise UnboxException(
354354
"Feature / label column names not in train_sample_df"
355355
)
356-
self._validate_categorical_features(
357-
train_sample_df, categorical_features_map
358-
)
356+
357+
# TODO: replace validation
358+
# self._validate_categorical_features(
359+
# train_sample_df, categorical_features_map
360+
# )
359361

360362
with TempDirectory() as dir:
361363
bento_service = create_template_model(
@@ -427,7 +429,7 @@ def add_model(
427429
type=model_type.name,
428430
kwargs=list(kwargs.keys()),
429431
featureNames=feature_names,
430-
categoricalFeaturesMap=categorical_features_map,
432+
categoricalFeatureNames=categorical_feature_names,
431433
trainSampleLabelColumnName=train_sample_label_column_name,
432434
)
433435
print("Uploading model to Unbox...")
@@ -449,7 +451,7 @@ def add_dataset(
449451
label_column_name: str,
450452
feature_names: List[str] = [],
451453
text_column_name: Optional[str] = None,
452-
categorical_features_map: Dict[str, List[str]] = {},
454+
categorical_feature_names: List[str] = [],
453455
tag_column_name: Optional[str] = None,
454456
language: str = "en",
455457
sep: str = ",",
@@ -597,9 +599,11 @@ def add_dataset(
597599
raise UnboxException(
598600
"Must specify feature_names for TabularClassification"
599601
)
600-
self._validate_categorical_features(
601-
pd.read_csv(file_path, sep=sep), categorical_features_map
602-
)
602+
603+
# TODO: replace validation
604+
# self._validate_categorical_features(
605+
# pd.read_csv(file_path, sep=sep), categorical_features_map
606+
# )
603607
else:
604608
feature_names = []
605609

@@ -635,7 +639,7 @@ def add_dataset(
635639
language=language,
636640
sep=sep,
637641
featureNames=feature_names,
638-
categoricalFeaturesMap=categorical_features_map,
642+
categoricalFeatureNames=categorical_feature_names,
639643
)
640644
return Dataset(
641645
self.upload(
@@ -655,7 +659,7 @@ def add_dataframe(
655659
label_column_name: str,
656660
feature_names: List[str] = [],
657661
text_column_name: Optional[str] = None,
658-
categorical_features_map: Dict[str, List[str]] = {},
662+
categorical_feature_names: List[str] = [],
659663
description: Optional[str] = None,
660664
tag_column_name: Optional[str] = None,
661665
language: str = "en",
@@ -799,7 +803,7 @@ def add_dataframe(
799803
tag_column_name=tag_column_name,
800804
language=language,
801805
feature_names=feature_names,
802-
categorical_features_map=categorical_features_map,
806+
categorical_feature_names=categorical_feature_names,
803807
)
804808

805809
@staticmethod

0 commit comments

Comments
 (0)